#
✕ nick:marcan
#asahi · 2021-06-16 17:45
marcan(was just a typo in one of the wrappers though, not the core code)
#asahi · 2021-06-16 17:45
marcan(and I still ran into a broken untested codepath at least once while doing the hv thing :p)
#asahi · 2021-06-16 17:45
marcanthere's no way to make that kind of code work properly without tests :)
#asahi · 2021-06-16 17:35
marcanso next up will be building the scaffolding for easily writing higher level tracers with RegMaps, and finishing the sync/hook support (which is broken/not finished right now)
#asahi · 2021-06-16 17:32
marcanwhich is PrintTracer everything except the exceptions in that script, and the PMU hack, and VUART
#asahi · 2021-06-16 17:31
marcanwith the trace_all script you end up with this page table: https://mrcn.st/p/suiSn7HJ
#asahi · 2021-06-16 17:30
marcanyes, that one
#asahi · 2021-06-16 17:29
marcanso again that's no different from the map_sw it replaces :-)
#asahi · 2021-06-16 17:29
marcanso that'll map_sw everything with async tracing turned on
#asahi · 2021-06-16 17:28
marcanthat's asking for a mmiotrace of everything
#asahi · 2021-06-16 17:28
marcanbut that's the point
#asahi · 2021-06-16 17:28
marcanj_ey: oh that will go through C
#asahi · 2021-06-16 17:28
marcan(which in this case does ~double the number of proxy calls but whatever)
#asahi · 2021-06-16 17:28
marcanwhile now since it gets coalesced and updated rangewise, it'll hw_map a bit, sw_map a bit, hw_map a bit, etc in address order, without overlaps
#asahi · 2021-06-16 17:27
marcanthe main difference is before we were stacking and mutating page tables (map everything hw, replace some bits with sw maps)
#asahi · 2021-06-16 17:27
marcannote that this isn't massively different from what I was doing earlier; the commit replaces a hw_map of the entire MMIO range with setting up the HW tracer
#asahi · 2021-06-16 17:26
marcanbasically the HW alignment is 16K and the SW alignment is 4b (due to the extra fake pagetable level I maintain, which only works for SPTEs)
#asahi · 2021-06-16 17:25
marcan(so in those unaligned cases it will go through C)
#asahi · 2021-06-16 17:25
marcan(I did make the python side fall back to sw_map for weird alignment or sub-page chunks at the start and end, because it makes the rest of the code easier to write instead of having to deal with the page-alignment requirement of the underlying hv_map() in hw mode)
#asahi · 2021-06-16 17:23
marcanthat are therefore handled by the MMU as stage 2 translation
#asahi · 2021-06-16 17:23
marcanhw_map(), modulo unaligned sub-page maps, creates real page table mappings
#asahi · 2021-06-16 17:23
marcanwell, and also for actual missing maps (which means the guest accessed nonexistent hardware or you forgot to map a range)
#asahi · 2021-06-16 17:22
marcanotherwise it should never happen since the CPU should have taken care of it
#asahi · 2021-06-16 17:22
marcanyes; that path triggers when you forget to invalidate the TLBs :-)
#asahi · 2021-06-16 17:15
marcan(originally I wasn't going to do that but it turns out that's the easiest way, code-wise, instead of trying to fill in holes in the RangeMap with map_hw)
#asahi · 2021-06-16 17:14
marcanso now the base MMIO map is actually a "HW" OFF tracer that underlies the entire address range
#asahi · 2021-06-16 17:14
marcanyup
#asahi · 2021-06-16 17:14
marcanso now I automatically call pt_update after every exception before returning to the guest
#asahi · 2021-06-16 17:13
marcanand if it's empty (which is a cheap check) it does nothing
#asahi · 2021-06-16 17:13
marcanthat's what that dirty_maps thing is for
#asahi · 2021-06-16 17:13
marcanj_ey: no, only the parts that changed
#asahi · 2021-06-16 17:08
marcan(and which is configured the same way)
#asahi · 2021-06-16 17:08
marcan... it's just that there is a default tracer now that just so happens to implement the same exact behavior the old code had
#asahi · 2021-06-16 17:08
marcanI mean I basically changed the entire way MMIO tracing works
#asahi · 2021-06-16 17:07
marcanquarkyalice: or in this case preparing for new features later (and fixing problems)
#asahi · 2021-06-16 17:06
marcanand also flushes the TLBs
#asahi · 2021-06-16 17:06
marcanpagetable updates are now automatically done based on whatever tracers you configure, and it keeps track of dirty sections and updates as necessary
#asahi · 2021-06-16 17:06
marcanone thing this does do is fix the "clobbering the vuart" problem
#asahi · 2021-06-16 17:05
marcanasync MMIO tracing now uses the stacked tracer concept I mentioned above (sync/hooks are still TODO)
#asahi · 2021-06-16 17:05
marcanyup
#asahi · 2021-06-16 17:04
marcan(...yet)
#asahi · 2021-06-16 17:04
marcanit's great when you work for a few hours on a bunch of code and the end result is everything works exactly the way it did before and no new features have been added :P
#asahi · 2021-06-16 09:56
marcanbisecting to a commit that exposes the bug but isn't the bug, then having to bisect again adding that
#asahi · 2021-06-16 09:55
marcanbut it was a layer 2 bisect
#asahi · 2021-06-16 09:55
marcanat least the repro is trivial
#asahi · 2021-06-16 09:55
marcannot quite as bad: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4764
#asahi · 2021-06-16 09:49
marcanat least my menus aren't flashing any more
#asahi · 2021-06-16 09:49
marcanthrows it over to the mesa folks to look at
#asahi · 2021-06-16 09:49
marcanalways fun to bisect a GPU driver bug down to a memory coherency change
#asahi · 2021-06-15 17:34
marcanyou can probably get an idea of how I want to use this as a base for building the mmiotrace stuff :-)

plus ›