Re: spin loop 100x faster in user mode (CPL=3) than superuser (CPL=0)?

2021-11-21 Thread Peter Maydell
On Fri, 19 Nov 2021 at 20:56, Garrick Toubassi wrote: > But the question remains as to whether the behavior is expected that if you > have pages which are executable and also written to, the writes will be > persistently slow? Or is that a possible (fringe) bug? I think that is just always goi

Re: spin loop 100x faster in user mode (CPL=3) than superuser (CPL=0)?

2021-11-19 Thread Garrick Toubassi
I debugged this a bit more and am closer to an explanation. Some crude rdtsc cycle profiling led me to the fact that notdirty_write is called a ton in the slow case, and, in aggregate, takes up most of the time. Running qemu with "-trace memory_notdirty_write_access" shows that in the slow case it

Re: spin loop 100x faster in user mode (CPL=3) than superuser (CPL=0)?

2021-11-12 Thread Garrick Toubassi
Thanks Alex! Thanks for the pointer to gdbstub. I just single stepped through the loop and see it behaving "as expected", which leads me to believe the performance issue doesn't show up in the execution of the client code. But it sounds like you are saying you see evidence of it executing at 0x9

Re: spin loop 100x faster in user mode (CPL=3) than superuser (CPL=0)?

2021-11-12 Thread Alex Bennée
Alex Bennée writes: > Garrick Toubassi writes: > >> I went ahead and created a short repro case which can be found at >> https://github.com/gtoubassi/qemu-spinrepro. Would appreciate >> thoughts from anyone or guidance on how to debug. > > Well something weird is going on that is chewing thr

Re: spin loop 100x faster in user mode (CPL=3) than superuser (CPL=0)?

2021-11-12 Thread Alex Bennée
Garrick Toubassi writes: > I went ahead and created a short repro case which can be found at > https://github.com/gtoubassi/qemu-spinrepro. Would appreciate > thoughts from anyone or guidance on how to debug. Well something weird is going on that is chewing through the code generation logic.

Re: spin loop 100x faster in user mode (CPL=3) than superuser (CPL=0)?

2021-10-29 Thread Garrick Toubassi
I went ahead and created a short repro case which can be found at https://github.com/gtoubassi/qemu-spinrepro. Would appreciate thoughts from anyone or guidance on how to debug. On Tue, Oct 19, 2021 at 3:05 PM Garrick Toubassi wrote: > Hello > > I have a mystery I haven't been able to run down

spin loop 100x faster in user mode (CPL=3) than superuser (CPL=0)?

2021-10-19 Thread Garrick Toubassi
Hello I have a mystery I haven't been able to run down and would appreciate any explanation or advice. On a mac/intel I am running qemu-system-x86_64 on a simple image which bootstraps into 64 bit long mode and then runs a simple spin loop (literally for (int i = 0; i < 1000; i++) {}). This