gem5  v19.0.0.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
mshr.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2012-2013, 2015-2019 ARM Limited
3  * All rights reserved.
4  *
5  * The license below extends only to copyright in the software and shall
6  * not be construed as granting a license to any other intellectual
7  * property including but not limited to intellectual property relating
8  * to a hardware implementation of the functionality of the software
9  * licensed hereunder. You may use the software subject to the license
10  * terms below provided that you ensure that this notice is replicated
11  * unmodified and in its entirety in all distributions of the software,
12  * modified or unmodified, in source code or in binary form.
13  *
14  * Copyright (c) 2002-2005 The Regents of The University of Michigan
15  * Copyright (c) 2010 Advanced Micro Devices, Inc.
16  * All rights reserved.
17  *
18  * Redistribution and use in source and binary forms, with or without
19  * modification, are permitted provided that the following conditions are
20  * met: redistributions of source code must retain the above copyright
21  * notice, this list of conditions and the following disclaimer;
22  * redistributions in binary form must reproduce the above copyright
23  * notice, this list of conditions and the following disclaimer in the
24  * documentation and/or other materials provided with the distribution;
25  * neither the name of the copyright holders nor the names of its
26  * contributors may be used to endorse or promote products derived from
27  * this software without specific prior written permission.
28  *
29  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
30  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
31  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
32  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
33  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
34  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
35  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
36  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
37  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
38  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
39  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40  *
41  * Authors: Erik Hallnor
42  * Dave Greene
43  * Nikos Nikoleris
44  */
45 
51 #include "mem/cache/mshr.hh"
52 
53 #include <cassert>
54 #include <string>
55 
56 #include "base/logging.hh"
57 #include "base/trace.hh"
58 #include "base/types.hh"
59 #include "debug/Cache.hh"
60 #include "mem/cache/base.hh"
61 #include "mem/request.hh"
62 #include "sim/core.hh"
63 
64 MSHR::MSHR() : downstreamPending(false),
65  pendingModified(false),
66  postInvalidate(false), postDowngrade(false),
67  wasWholeLineWrite(false), isForward(false)
68 {
69 }
70 
72  : needsWritable(false), hasUpgrade(false), allocOnFill(false),
73  hasFromCache(false)
74 {}
75 
76 
77 void
79  bool alloc_on_fill)
80 {
81  if (source != Target::FromSnoop) {
82  if (pkt->needsWritable()) {
83  needsWritable = true;
84  }
85 
86  // StoreCondReq is effectively an upgrade if it's in an MSHR
87  // since it would have been failed already if we didn't have a
88  // read-only copy
89  if (pkt->isUpgrade() || pkt->cmd == MemCmd::StoreCondReq) {
90  hasUpgrade = true;
91  }
92 
93  // potentially re-evaluate whether we should allocate on a fill or
94  // not
95  allocOnFill = allocOnFill || alloc_on_fill;
96 
97  if (source != Target::FromPrefetcher) {
99 
100  updateWriteFlags(pkt);
101  }
102  }
103 }
104 
105 void
107 {
108  resetFlags();
109  for (auto& t: *this) {
110  updateFlags(t.pkt, t.source, t.allocOnFill);
111  }
112 }
113 
114 void
116 {
117  if (isWholeLineWrite()) {
118  // if we have already seen writes for the full block
119  // stop here, this might be a full line write followed
120  // by other compatible requests (e.g., reads)
121  return;
122  }
123 
124  if (canMergeWrites) {
125  if (!pkt->isWrite()) {
126  // We won't allow further merging if this hasn't
127  // been a write
128  canMergeWrites = false;
129  return;
130  }
131 
132  // Avoid merging requests with special flags (e.g.,
133  // strictly ordered)
134  const Request::FlagsType no_merge_flags =
139  const auto &req_flags = pkt->req->getFlags();
140  bool compat_write = !req_flags.isSet(no_merge_flags);
141 
142  // if this is the first write, it might be a whole
143  // line write and even if we can't merge any
144  // subsequent write requests, we still need to service
145  // it as a whole line write (e.g., SECURE whole line
146  // write)
147  bool first_write = empty();
148  if (first_write || compat_write) {
149  auto offset = pkt->getOffset(blkSize);
150  auto begin = writesBitmap.begin() + offset;
151  std::fill(begin, begin + pkt->getSize(), true);
152  }
153 
154  // We won't allow further merging if this has been a
155  // special write
156  canMergeWrites &= compat_write;
157  }
158 }
159 
160 inline void
162  Counter order, Target::Source source, bool markPending,
163  bool alloc_on_fill)
164 {
165  updateFlags(pkt, source, alloc_on_fill);
166  if (markPending) {
167  // Iterate over the SenderState stack and see if we find
168  // an MSHR entry. If we do, set the downstreamPending
169  // flag. Otherwise, do nothing.
170  MSHR *mshr = pkt->findNextSenderState<MSHR>();
171  if (mshr != nullptr) {
172  assert(!mshr->downstreamPending);
173  mshr->downstreamPending = true;
174  } else {
175  // No need to clear downstreamPending later
176  markPending = false;
177  }
178  }
179 
180  emplace_back(pkt, readyTime, order, source, markPending, alloc_on_fill);
181 }
182 
183 
184 static void
186 {
187  // remember if the current packet has data allocated
188  bool has_data = pkt->hasData() || pkt->hasRespData();
189 
190  if (pkt->cmd == MemCmd::UpgradeReq) {
191  pkt->cmd = MemCmd::ReadExReq;
192  DPRINTF(Cache, "Replacing UpgradeReq with ReadExReq\n");
193  } else if (pkt->cmd == MemCmd::SCUpgradeReq) {
195  DPRINTF(Cache, "Replacing SCUpgradeReq with SCUpgradeFailReq\n");
196  } else if (pkt->cmd == MemCmd::StoreCondReq) {
198  DPRINTF(Cache, "Replacing StoreCondReq with StoreCondFailReq\n");
199  }
200 
201  if (!has_data) {
202  // there is no sensible way of setting the data field if the
203  // new command actually would carry data
204  assert(!pkt->hasData());
205 
206  if (pkt->hasRespData()) {
207  // we went from a packet that had no data (neither request,
208  // nor response), to one that does, and therefore we need to
209  // actually allocate space for the data payload
210  pkt->allocate();
211  }
212  }
213 }
214 
215 
216 void
218 {
219  if (!hasUpgrade)
220  return;
221 
222  for (auto& t : *this) {
223  replaceUpgrade(t.pkt);
224  }
225 
226  hasUpgrade = false;
227 }
228 
229 
230 void
231 MSHR::TargetList::clearDownstreamPending(MSHR::TargetList::iterator begin,
232  MSHR::TargetList::iterator end)
233 {
234  for (auto t = begin; t != end; t++) {
235  if (t->markedPending) {
236  // Iterate over the SenderState stack and see if we find
237  // an MSHR entry. If we find one, clear the
238  // downstreamPending flag by calling
239  // clearDownstreamPending(). This recursively clears the
240  // downstreamPending flag in all caches this packet has
241  // passed through.
242  MSHR *mshr = t->pkt->findNextSenderState<MSHR>();
243  if (mshr != nullptr) {
244  mshr->clearDownstreamPending();
245  }
246  t->markedPending = false;
247  }
248  }
249 }
250 
251 void
253 {
254  clearDownstreamPending(begin(), end());
255 }
256 
257 
258 bool
260 {
261  for (auto& t : *this) {
262  if (pkt->trySatisfyFunctional(t.pkt)) {
263  return true;
264  }
265  }
266 
267  return false;
268 }
269 
270 
271 void
272 MSHR::TargetList::print(std::ostream &os, int verbosity,
273  const std::string &prefix) const
274 {
275  for (auto& t : *this) {
276  const char *s;
277  switch (t.source) {
278  case Target::FromCPU:
279  s = "FromCPU";
280  break;
281  case Target::FromSnoop:
282  s = "FromSnoop";
283  break;
285  s = "FromPrefetcher";
286  break;
287  default:
288  s = "";
289  break;
290  }
291  ccprintf(os, "%s%s: ", prefix, s);
292  t.pkt->print(os, verbosity, "");
293  ccprintf(os, "\n");
294  }
295 }
296 
297 
298 void
299 MSHR::allocate(Addr blk_addr, unsigned blk_size, PacketPtr target,
300  Tick when_ready, Counter _order, bool alloc_on_fill)
301 {
302  blkAddr = blk_addr;
303  blkSize = blk_size;
304  isSecure = target->isSecure();
305  readyTime = when_ready;
306  order = _order;
307  assert(target);
308  isForward = false;
309  wasWholeLineWrite = false;
310  _isUncacheable = target->req->isUncacheable();
311  inService = false;
312  downstreamPending = false;
313 
316 
317  // Don't know of a case where we would allocate a new MSHR for a
318  // snoop (mem-side request), so set source according to request here
319  Target::Source source = (target->cmd == MemCmd::HardPFReq) ?
321  targets.add(target, when_ready, _order, source, true, alloc_on_fill);
322 
323  // All targets must refer to the same block
324  assert(target->matchBlockAddr(targets.front().pkt, blkSize));
325 }
326 
327 
328 void
330 {
331  assert(downstreamPending);
332  downstreamPending = false;
333  // recursively clear flag on any MSHRs we will be forwarding
334  // responses to
336 }
337 
338 void
339 MSHR::markInService(bool pending_modified_resp)
340 {
341  assert(!inService);
342 
343  inService = true;
344  pendingModified = targets.needsWritable || pending_modified_resp;
345  postInvalidate = postDowngrade = false;
346 
347  if (!downstreamPending) {
348  // let upstream caches know that the request has made it to a
349  // level where it's going to get a response
351  }
352  // if the line is not considered a whole-line write when sent
353  // downstream, make sure it is also not considered a whole-line
354  // write when receiving the response, and vice versa
356 }
357 
358 
359 void
361 {
362  assert(targets.empty());
364  assert(deferredTargets.isReset());
365  inService = false;
366 }
367 
368 /*
369  * Adds a target to an MSHR
370  */
371 void
373  bool alloc_on_fill)
374 {
375  // assume we'd never issue a prefetch when we've got an
376  // outstanding miss
377  assert(pkt->cmd != MemCmd::HardPFReq);
378 
379  // if there's a request already in service for this MSHR, we will
380  // have to defer the new target until after the response if any of
381  // the following are true:
382  // - there are other targets already deferred
383  // - there's a pending invalidate to be applied after the response
384  // comes back (but before this target is processed)
385  // - the MSHR's first (and only) non-deferred target is a cache
386  // maintenance packet
387  // - the new target is a cache maintenance packet (this is probably
388  // overly conservative but certainly safe)
389  // - this target requires a writable block and either we're not
390  // getting a writable block back or we have already snooped
391  // another read request that will downgrade our writable block
392  // to non-writable (Shared or Owned)
393  PacketPtr tgt_pkt = targets.front().pkt;
394  if (pkt->req->isCacheMaintenance() ||
395  tgt_pkt->req->isCacheMaintenance() ||
396  !deferredTargets.empty() ||
397  (inService &&
398  (hasPostInvalidate() ||
399  (pkt->needsWritable() &&
400  (!isPendingModified() || hasPostDowngrade() || isForward))))) {
401  // need to put on deferred list
402  if (inService && hasPostInvalidate())
403  replaceUpgrade(pkt);
404  deferredTargets.add(pkt, whenReady, _order, Target::FromCPU, true,
405  alloc_on_fill);
406  } else {
407  // No request outstanding, or still OK to append to
408  // outstanding request: append to regular target list. Only
409  // mark pending if current request hasn't been issued yet
410  // (isn't in service).
411  targets.add(pkt, whenReady, _order, Target::FromCPU, !inService,
412  alloc_on_fill);
413  }
414 }
415 
416 bool
418 {
419  DPRINTF(Cache, "%s for %s\n", __func__, pkt->print());
420 
421  // when we snoop packets the needsWritable and isInvalidate flags
422  // should always be the same, however, this assumes that we never
423  // snoop writes as they are currently not marked as invalidations
424  panic_if((pkt->needsWritable() != pkt->isInvalidate()) &&
425  !pkt->req->isCacheMaintenance(),
426  "%s got snoop %s where needsWritable, "
427  "does not match isInvalidate", name(), pkt->print());
428 
429  if (!inService || (pkt->isExpressSnoop() && downstreamPending)) {
430  // Request has not been issued yet, or it's been issued
431  // locally but is buffered unissued at some downstream cache
432  // which is forwarding us this snoop. Either way, the packet
433  // we're snooping logically precedes this MSHR's request, so
434  // the snoop has no impact on the MSHR, but must be processed
435  // in the standard way by the cache. The only exception is
436  // that if we're an L2+ cache buffering an UpgradeReq from a
437  // higher-level cache, and the snoop is invalidating, then our
438  // buffered upgrades must be converted to read exclusives,
439  // since the upper-level cache no longer has a valid copy.
440  // That is, even though the upper-level cache got out on its
441  // local bus first, some other invalidating transaction
442  // reached the global bus before the upgrade did.
443  if (pkt->needsWritable() || pkt->req->isCacheInvalidate()) {
446  }
447 
448  return false;
449  }
450 
451  // From here on down, the request issued by this MSHR logically
452  // precedes the request we're snooping.
453  if (pkt->needsWritable() || pkt->req->isCacheInvalidate()) {
454  // snooped request still precedes the re-request we'll have to
455  // issue for deferred targets, if any...
457  }
458 
459  PacketPtr tgt_pkt = targets.front().pkt;
460  if (hasPostInvalidate() || tgt_pkt->req->isCacheInvalidate()) {
461  // a prior snoop has already appended an invalidation or a
462  // cache invalidation operation is in progress, so logically
463  // we don't have the block anymore; no need for further
464  // snooping.
465  return true;
466  }
467 
468  // Start by determining if we will eventually respond or not,
469  // matching the conditions checked in Cache::handleSnoop
470  const bool will_respond = isPendingModified() && pkt->needsResponse() &&
471  !pkt->isClean();
472  if (isPendingModified() || pkt->isInvalidate()) {
473  // We need to save and replay the packet in two cases:
474  // 1. We're awaiting a writable copy (Modified or Exclusive),
475  // so this MSHR is the orgering point, and we need to respond
476  // after we receive data.
477  // 2. It's an invalidation (e.g., UpgradeReq), and we need
478  // to forward the snoop up the hierarchy after the current
479  // transaction completes.
480 
481  // The packet we are snooping may be deleted by the time we
482  // actually process the target, and we consequently need to
483  // save a copy here. Clear flags and also allocate new data as
484  // the original packet data storage may have been deleted by
485  // the time we get to process this packet. In the cases where
486  // we are not responding after handling the snoop we also need
487  // to create a copy of the request to be on the safe side. In
488  // the latter case the cache is responsible for deleting both
489  // the packet and the request as part of handling the deferred
490  // snoop.
491  PacketPtr cp_pkt = will_respond ? new Packet(pkt, true, true) :
492  new Packet(std::make_shared<Request>(*pkt->req), pkt->cmd,
493  blkSize, pkt->id);
494 
495  if (will_respond) {
496  // we are the ordering point, and will consequently
497  // respond, and depending on whether the packet
498  // needsWritable or not we either pass a Shared line or a
499  // Modified line
500  pkt->setCacheResponding();
501 
502  // inform the cache hierarchy that this cache had the line
503  // in the Modified state, even if the response is passed
504  // as Shared (and thus non-writable)
506 
507  // in the case of an uncacheable request there is no need
508  // to set the responderHadWritable flag, but since the
509  // recipient does not care there is no harm in doing so
510  } else if (isPendingModified() && pkt->isClean()) {
511  // this cache doesn't respond to the clean request, a
512  // destination xbar will respond to this request, but to
513  // do so it needs to know if it should wait for the
514  // WriteCleanReq
515  pkt->setSatisfied();
516  }
517 
518  targets.add(cp_pkt, curTick(), _order, Target::FromSnoop,
520 
521  if (pkt->needsWritable() || pkt->isInvalidate()) {
522  // This transaction will take away our pending copy
523  postInvalidate = true;
524  }
525  }
526 
527  if (!pkt->needsWritable() && !pkt->req->isUncacheable()) {
528  // This transaction will get a read-shared copy, downgrading
529  // our copy if we had a writable one
530  postDowngrade = true;
531  // make sure that any downstream cache does not respond with a
532  // writable (and dirty) copy even if it has one, unless it was
533  // explicitly asked for one
534  pkt->setHasSharers();
535  }
536 
537  return will_respond;
538 }
539 
542 {
543  TargetList ready_targets;
544  ready_targets.init(blkAddr, blkSize);
545  // If the downstream MSHR got an invalidation request then we only
546  // service the first of the FromCPU targets and any other
547  // non-FromCPU target. This way the remaining FromCPU targets
548  // issue a new request and get a fresh copy of the block and we
549  // avoid memory consistency violations.
550  if (pkt->cmd == MemCmd::ReadRespWithInvalidate) {
551  auto it = targets.begin();
552  assert((it->source == Target::FromCPU) ||
553  (it->source == Target::FromPrefetcher));
554  ready_targets.push_back(*it);
555  it = targets.erase(it);
556  while (it != targets.end()) {
557  if (it->source == Target::FromCPU) {
558  it++;
559  } else {
560  assert(it->source == Target::FromSnoop);
561  ready_targets.push_back(*it);
562  it = targets.erase(it);
563  }
564  }
565  ready_targets.populateFlags();
566  } else {
567  std::swap(ready_targets, targets);
568  }
570 
571  return ready_targets;
572 }
573 
574 bool
576 {
577  if (targets.empty() && deferredTargets.empty()) {
578  // nothing to promote
579  return false;
580  }
581 
582  // the deferred targets can be generally promoted unless they
583  // contain a cache maintenance request
584 
585  // find the first target that is a cache maintenance request
586  auto it = std::find_if(deferredTargets.begin(), deferredTargets.end(),
587  [](MSHR::Target &t) {
588  return t.pkt->req->isCacheMaintenance();
589  });
590  if (it == deferredTargets.begin()) {
591  // if the first deferred target is a cache maintenance packet
592  // then we can promote provided the targets list is empty and
593  // we can service it on its own
594  if (targets.empty()) {
595  targets.splice(targets.end(), deferredTargets, it);
596  }
597  } else {
598  // if a cache maintenance operation exists, we promote all the
599  // deferred targets that precede it, or all deferred targets
600  // otherwise
601  targets.splice(targets.end(), deferredTargets,
602  deferredTargets.begin(), it);
603  }
604 
607  order = targets.front().order;
608  readyTime = std::max(curTick(), targets.front().readyTime);
609 
610  return true;
611 }
612 
613 void
614 MSHR::promoteIf(const std::function<bool (Target &)>& pred)
615 {
616  // if any of the deferred targets were upper-level cache
617  // requests marked downstreamPending, need to clear that
618  assert(!downstreamPending); // not pending here anymore
619 
620  // find the first target does not satisfy the condition
621  auto last_it = std::find_if_not(deferredTargets.begin(),
622  deferredTargets.end(),
623  pred);
624 
625  // for the prefix of the deferredTargets [begin(), last_it) clear
626  // the downstreamPending flag and move them to the target list
628  last_it);
629  targets.splice(targets.end(), deferredTargets,
630  deferredTargets.begin(), last_it);
631  // We need to update the flags for the target lists after the
632  // modifications
634 }
635 
636 void
638 {
639  if (!deferredTargets.empty() && !hasPostInvalidate()) {
640  // We got a non invalidating response, and we have the block
641  // but we have deferred targets which are waiting and they do
642  // not need writable. This can happen if the original request
643  // was for a cache clean operation and we had a copy of the
644  // block. Since we serviced the cache clean operation and we
645  // have the block, there's no need to defer the targets, so
646  // move them up to the regular target list.
647 
648  auto pred = [](Target &t) {
649  assert(t.source == Target::FromCPU);
650  return !t.pkt->req->isCacheInvalidate() &&
651  !t.pkt->needsWritable();
652  };
653  promoteIf(pred);
654  }
655 }
656 
657 void
659 {
660  PacketPtr def_tgt_pkt = deferredTargets.front().pkt;
663  !def_tgt_pkt->req->isCacheInvalidate()) {
664  // We got a writable response, but we have deferred targets
665  // which are waiting to request a writable copy (not because
666  // of a pending invalidate). This can happen if the original
667  // request was for a read-only block, but we got a writable
668  // response anyway. Since we got the writable copy there's no
669  // need to defer the targets, so move them up to the regular
670  // target list.
671  assert(!targets.needsWritable);
672  targets.needsWritable = true;
673 
674  auto pred = [](Target &t) {
675  assert(t.source == Target::FromCPU);
676  return !t.pkt->req->isCacheInvalidate();
677  };
678 
679  promoteIf(pred);
680  }
681 }
682 
683 
684 bool
686 {
687  // For printing, we treat the MSHR as a whole as single entity.
688  // For other requests, we iterate over the individual targets
689  // since that's where the actual data lies.
690  if (pkt->isPrint()) {
691  pkt->trySatisfyFunctional(this, blkAddr, isSecure, blkSize, nullptr);
692  return false;
693  } else {
694  return (targets.trySatisfyFunctional(pkt) ||
696  }
697 }
698 
699 bool
701 {
702  return cache.sendMSHRQueuePacket(this);
703 }
704 
705 void
706 MSHR::print(std::ostream &os, int verbosity, const std::string &prefix) const
707 {
708  ccprintf(os, "%s[%#llx:%#llx](%s) %s %s %s state: %s %s %s %s %s %s\n",
709  prefix, blkAddr, blkAddr + blkSize - 1,
710  isSecure ? "s" : "ns",
711  isForward ? "Forward" : "",
712  allocOnFill() ? "AllocOnFill" : "",
713  needsWritable() ? "Wrtbl" : "",
714  _isUncacheable ? "Unc" : "",
715  inService ? "InSvc" : "",
716  downstreamPending ? "DwnPend" : "",
717  postInvalidate ? "PostInv" : "",
718  postDowngrade ? "PostDowngr" : "",
719  hasFromCache() ? "HasFromCache" : "");
720 
721  if (!targets.empty()) {
722  ccprintf(os, "%s Targets:\n", prefix);
723  targets.print(os, verbosity, prefix + " ");
724  }
725  if (!deferredTargets.empty()) {
726  ccprintf(os, "%s Deferred Targets:\n", prefix);
727  deferredTargets.print(os, verbosity, prefix + " ");
728  }
729 }
730 
731 std::string
732 MSHR::print() const
733 {
734  std::ostringstream str;
735  print(str);
736  return str.str();
737 }
738 
739 bool
740 MSHR::matchBlockAddr(const Addr addr, const bool is_secure) const
741 {
742  assert(hasTargets());
743  return (blkAddr == addr) && (isSecure == is_secure);
744 }
745 
746 bool
748 {
749  assert(hasTargets());
750  return pkt->matchBlockAddr(blkAddr, isSecure, blkSize);
751 }
752 
753 bool
754 MSHR::conflictAddr(const QueueEntry* entry) const
755 {
756  assert(hasTargets());
757  return entry->matchBlockAddr(blkAddr, isSecure);
758 }
Miss Status and Handling Register (MSHR) declaration.
void ccprintf(cp::Print &print)
Definition: cprintf.hh:131
#define DPRINTF(x,...)
Definition: trace.hh:229
Declares a basic cache interface BaseCache.
The request is to an uncacheable address.
Definition: request.hh:115
const PacketId id
Definition: packet.hh:324
bool isSecure
True if the entry targets the secure memory space.
Definition: queue_entry.hh:120
void setResponderHadWritable()
On responding to a snoop request (which only happens for Modified or Owned lines), make sure that we can transform an Owned response to a Modified one.
Definition: packet.hh:645
bool needsWritable() const
The pending* and post* flags are only valid if inService is true.
Definition: mshr.hh:314
bool hasPostInvalidate() const
Definition: mshr.hh:325
bool isExpressSnoop() const
Definition: packet.hh:634
void setHasSharers()
On fills, the hasSharers flag is used by the caches in combination with the cacheResponding flag...
Definition: packet.hh:617
bool inService
True if the entry has been sent downstream.
Definition: queue_entry.hh:108
std::string print() const
A no-args wrapper of print(std::ostream...) meant to be invoked from DPRINTFs avoiding string overhea...
Definition: mshr.cc:732
T * findNextSenderState() const
Go through the sender state stack and return the first instance that is of type T (as determined by a...
Definition: packet.hh:510
const std::string & name()
Definition: trace.cc:54
void resetFlags()
Definition: mshr.hh:205
bool trySatisfyFunctional(PacketPtr pkt)
Definition: mshr.cc:685
bool isUpgrade() const
Definition: packet.hh:530
The request is a Load locked/store conditional.
Definition: request.hh:148
This request is for a memory swap.
Definition: request.hh:150
This request is made in privileged mode.
Definition: request.hh:129
bool trySatisfyFunctional(PacketPtr pkt)
Definition: mshr.cc:259
Declaration of a request, the overall memory request consisting of the parts of the request that are ...
bool hasPostDowngrade() const
Definition: mshr.hh:329
bool matchBlockAddr(const Addr addr, const bool is_secure, const int blk_size) const
Check if packet corresponds to a given block-aligned address and address space.
Definition: packet.cc:397
ip6_addr_t addr
Definition: inet.hh:335
bool isClean() const
Definition: packet.hh:545
bool allocOnFill
Set when the response should allocate on fill.
Definition: mshr.hh:171
The request is required to be strictly ordered by CPU models and is non-speculative.
Definition: request.hh:125
bool isPendingModified() const
Definition: mshr.hh:321
The request targets the secure memory space.
Definition: request.hh:176
Bitfield< 23, 0 > offset
Definition: types.hh:154
Addr blkSize
Size of the cache block.
Definition: mshr.hh:288
void promoteWritable()
Promotes deferred targets that do not require writable.
Definition: mshr.cc:658
Tick readyTime
Tick when ready to issue.
Definition: queue_entry.hh:73
Counter order
Order number assigned to disambiguate writes and misses.
Definition: queue_entry.hh:111
TargetList deferredTargets
Definition: mshr.hh:375
bool allocOnFill() const
Definition: mshr.hh:335
bool isWrite() const
Definition: packet.hh:529
bool isInvalidate() const
Definition: packet.hh:543
void setSatisfied()
Set when a request hits in a cache and the cache is not going to respond.
Definition: packet.hh:681
Bitfield< 17 > os
Definition: misc.hh:805
void print(std::ostream &os, int verbosity, const std::string &prefix) const
Definition: mshr.cc:272
bool needsWritable() const
Definition: packet.hh:533
RequestPtr req
A pointer to the original request.
Definition: packet.hh:327
void updateWriteFlags(PacketPtr pkt)
Add the specified packet in the TargetList.
Definition: mshr.cc:115
unsigned getSize() const
Definition: packet.hh:736
A coherent cache that can be arranged in flexible topologies.
Definition: cache.hh:69
bool postInvalidate
Did we snoop an invalidate while waiting for data?
Definition: mshr.hh:114
Tick curTick()
The current simulated tick.
Definition: core.hh:47
bool canMergeWrites
Indicates whether we can merge incoming write requests.
Definition: mshr.hh:291
bool isReset() const
Tests if the flags of this TargetList have their default values.
Definition: mshr.hh:238
bool needsResponse() const
Definition: packet.hh:542
void allocateTarget(PacketPtr target, Tick when, Counter order, bool alloc_on_fill)
Add a request to the list of targets.
Definition: mshr.cc:372
void markInService(bool pending_modified_resp)
Definition: mshr.cc:339
void init(Addr blk_addr, Addr blk_size)
Reset state.
Definition: mshr.hh:197
Bitfield< 4 > s
Addr getOffset(unsigned int blk_size) const
Definition: packet.hh:745
bool needsWritable
Definition: mshr.hh:168
uint64_t Tick
Tick count type.
Definition: types.hh:63
bool trySatisfyFunctional(PacketPtr other)
Check a functional request against a memory value stored in another packet (i.e.
Definition: packet.hh:1264
Miss Status and handling Register.
Definition: mshr.hh:72
A basic cache interface.
Definition: base.hh:93
bool hasData() const
Definition: packet.hh:548
bool isWholeLineWrite() const
Check if this list contains writes that cover an entire cache line.
Definition: mshr.hh:277
This request is to a memory mapped register.
Definition: request.hh:127
std::vector< char > writesBitmap
Track which bytes are written by requests in this target list.
Definition: mshr.hh:300
void clearDownstreamPending()
Definition: mshr.cc:252
TargetList targets
List of all requests that match the address.
Definition: mshr.hh:373
static void replaceUpgrade(PacketPtr pkt)
Definition: mshr.cc:185
bool conflictAddr(const QueueEntry *entry) const override
Check if given entry&#39;s packets conflict with this&#39; entries packets.
Definition: mshr.cc:754
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,16,32,64}_t.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:142
void promoteIf(const std::function< bool(Target &)> &pred)
Promotes deferred targets that satisfy a predicate.
Definition: mshr.cc:614
int64_t Counter
Statistics counter type.
Definition: types.hh:58
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
Definition: packet.hh:255
A queue entry base class, to be used by both the MSHRs and write-queue entries.
Definition: queue_entry.hh:61
void updateFlags(PacketPtr pkt, Target::Source source, bool alloc_on_fill)
Use the provided packet and the source to update the flags of this TargetList.
Definition: mshr.cc:78
void populateFlags()
Goes through the list of targets and uses them to populate the flags of this TargetList.
Definition: mshr.cc:106
bool hasUpgrade
Definition: mshr.hh:169
bool fromCache() const
Definition: packet.hh:546
virtual bool matchBlockAddr(const Addr addr, const bool is_secure) const =0
Check if entry corresponds to the one being looked for.
bool wasWholeLineWrite
Track if we sent this as a whole line write or not.
Definition: mshr.hh:122
void clearDownstreamPending()
Definition: mshr.cc:329
bool hasRespData() const
Definition: packet.hh:549
Addr blkAddr
Address of the cache block for this list of targets.
Definition: mshr.hh:285
bool matchBlockAddr(const Addr addr, const bool is_secure) const override
Check if entry corresponds to the one being looked for.
Definition: mshr.cc:740
bool handleSnoop(PacketPtr target, Counter order)
Definition: mshr.cc:417
void replaceUpgrades()
Convert upgrades to the equivalent request if the cache line they refer to would have been invalid (U...
Definition: mshr.cc:217
void print(std::ostream &o, int verbosity=0, const std::string &prefix="") const
Definition: packet.cc:376
MemCmd cmd
The command field of the packet.
Definition: packet.hh:322
TargetList extractServiceableTargets(PacketPtr pkt)
Extracts the subset of the targets that can be serviced given a received response.
Definition: mshr.cc:541
bool isForward
True if the entry is just a simple forward from an upper level.
Definition: mshr.hh:125
void promoteReadable()
Promotes deferred targets that do not require writable.
Definition: mshr.cc:637
MSHR()
A simple constructor.
Definition: mshr.cc:64
bool promoteDeferredTargets()
Definition: mshr.cc:575
bool pendingModified
Here we use one flag to track both if:
Definition: mshr.hh:111
bool isPrint() const
Definition: packet.hh:556
bool hasFromCache
Determine whether there was at least one non-snooping target coming from another cache.
Definition: mshr.hh:176
virtual bool sendMSHRQueuePacket(MSHR *mshr)
Take an MSHR, turn it into a suitable downstream packet, and send it out.
Definition: base.cc:1659
bool hasTargets() const
Returns true if there are targets left.
Definition: mshr.hh:446
bool isSecure() const
Definition: packet.hh:755
bool sendPacket(BaseCache &cache) override
Send this queue entry as a downstream packet, with the exact behaviour depending on the specific entr...
Definition: mshr.cc:700
void deallocate()
Mark this MSHR as free.
Definition: mshr.cc:360
Bitfield< 5 > t
uint64_t FlagsType
Definition: request.hh:91
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
Definition: logging.hh:185
void add(PacketPtr pkt, Tick readyTime, Counter order, Target::Source source, bool markPending, bool alloc_on_fill)
Add the specified packet in the TargetList.
Definition: mshr.cc:161
void allocate(Addr blk_addr, unsigned blk_size, PacketPtr pkt, Tick when_ready, Counter _order, bool alloc_on_fill)
Allocate a miss to this MSHR.
Definition: mshr.cc:299
void allocate()
Allocate memory for the packet.
Definition: packet.hh:1232
bool downstreamPending
Flag set by downstream caches.
Definition: mshr.hh:85
ProbePointArg< PacketInfo > Packet
Packet probe point.
Definition: mem.hh:104
bool hasFromCache() const
Determine if there are non-deferred requests from other caches.
Definition: mshr.hh:344
void setCacheResponding()
Snoop flags.
Definition: packet.hh:585
bool postDowngrade
Did we snoop a read while waiting for data?
Definition: mshr.hh:117
bool _isUncacheable
True if the entry is uncacheable.
Definition: queue_entry.hh:76

Generated on Fri Feb 28 2020 16:27:01 for gem5 by doxygen 1.8.13