Packet: Enable functional reads of partial data to packet class
Review Request #915 - Created Nov. 28, 2011 and submitted
| Information | |
|---|---|
| Geoffrey Blake | |
| gem5 | |
| default | |
| Reviewers | |
| Default | |
| ali, gblack, nate, stever | |
Packet: Enable functional reads of partial data to packet class This patch fixes a long standing defficiency in the packet class where it was unable to handle finding data that partially satisfied a request. This splits out changes made to the packet class in the checkercpu patch as requested by Ali.
Compiles. No functional changes made from CheckerCPU patch to this patch for packet class, and CheckerCPU fully exercised this code path during testing.
Posted (Nov. 28, 2011, 1:11 a.m.)
-
src/mem/packet.hh (Diff revision 1) -
Doxygen comments for this function?
just fix up the doxygen comment
Posted (Nov. 28, 2011, 1:15 a.m.)
-
src/mem/packet.hh (Diff revision 1) -
In most on-chip protocols there is a notion of beats (i.e. multiples of the physical word width) in a burst, and a mask of byte enables. The latter are usually per word and have to be the same for all beats, e.g. forming a burst of half words. Is this bytes_valid to be used similar to a burst length? In other words, is it always a multiple of the interface width? Is there a way to avoid the confusion? Would the problem with dynamic allocation go away if we introduced a maximum burst length?
Posted (Nov. 28, 2011, 7:01 p.m.)
-
src/mem/packet.hh (Diff revision 1) -
Ok maybe I got things confused here. Is the idea that you can have an address that is not aligned to any word (e.g. only byte aligned) and that any bytes could be valid within the burst (hence the mask)? Do the bytes have to come in whole words or can they be partial? Do the valid bytes all reside at the beginning of the burst, i.e. from the start address or could they be anywhere? I am merely trying to understand if this is indeed a byte enable (and if so how organised) or if it is more a way of having smaller than "getBlockSize()" bursts. Does that make sense?
Review request changed
Updated (Nov. 29, 2011, 12:18 a.m.)
Diff: |
Revision 2 (+66 -8) |
|---|
Posted (Dec. 3, 2011, 4:33 a.m.)
Functionally it looks fine to me. My only concern is that we're adding some (small) overhead to every single Packet just to deal with this one extremely rare corner case. Packets get dynamically allocated a *lot* in timing simulation, so it's painful to me to see us adding any overhead there. Is there a way we can at least avoid calling bytes_valid.resize() in every constructor? I'm not sure how much space a std::vector<bool> takes, or how much the default constructor costs; if either one is not negligible, it might even be worth just putting a pointer in the Packet and dynamically allocating the vector itself only when needed. I don't know if that is really worthwhile or not though.
Posted (Dec. 12, 2011, 4:45 a.m.)
Made a derived class FunctionalPacket to enable partial functional reads to not induce more overhead in the Packet class as requested by Steve, Nate and Ali. Modified blobHelper() in src/mem/port.cc to use FunctionalPacket instead of Packet. Over areas could use functional packets (src/arch/x86/pagetable_walker.cc and src/cpu/testers/memtest/memtest.cc) but have left them alone because they do not really need to be fixed. Tested by compiling and running using the CheckerCPU that exercises this code path heavily. No bugs found.
Looks good to me, assuming it works. Thanks for making the separate class.
Review request changed
Updated (Dec. 21, 2011, 4:35 a.m.)
Diff: |
Revision 4 (+106 -10) |
|---|
Posted (Dec. 21, 2011, 4:39 a.m.)
Removed derived class. Added two uint16_t's: bytesValidStart and bytesValidEnd to Packet class to represent the range of values copied in a partial read. Added back functionality in Packet class to satisfy partial functional read. Tested with CheckerCPU to see if I hit any dis-contiguous byte ranges. Nothing triggered the panic for this case. Anybody have recommendations for the variables I used to construct the range checks to figure out which bytes to copy instead of a,b,c, and d? I did put extensive comments in the code to explain what they were being used for.
Review request changed
Updated (Dec. 21, 2011, 4:49 a.m.)
Diff: |
Revision 5 (+106 -10) |
|---|
Posted (Dec. 21, 2011, 4:49 a.m.)
Fix compile bug from overly aggressive white space checker.
