[Qemu-devel] [PATCH v2 0/3] Enable MTTCG on PPC64

Nikunj A Dadhania posted 3 patches 7 years ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20170407060752.31313-1-nikunj@linux.vnet.ibm.com
Test checkpatch passed
Test docker passed
Test s390x passed
cputlb.c               |  8 +++++++-
target/ppc/translate.c | 37 +++++++++++++++++++++++++++++++------
2 files changed, 38 insertions(+), 7 deletions(-)
[Qemu-devel] [PATCH v2 0/3] Enable MTTCG on PPC64
Posted by Nikunj A Dadhania 7 years ago
The series enables Multi-Threaded TCG on PPC64

Patch 01: Use atomic_cmpxchg in store conditional
      02: Handle first write to page during atomic operation
      03: Generate memory barriers for sync/isync and load/store conditional

Patches are based on ppc-for-2.10

Changelog:
v1:
* Rewrote store_conditional as suggested by Richard

Tested using following:
./ppc64-softmmu/qemu-system-ppc64 -cpu POWER8 -vga none -nographic -machine pseries,usb=off -m 2G  -smp 8,cores=8,threads=1 -accel tcg,thread=multi  f23.img

Todo:
* Implement lqarx and stqcx
* Enable other machine types and PPC32.
* More testing for corner cases.

Nikunj A Dadhania (3):
  target/ppc: Emulate LL/SC using cmpxchg helpers
  cputlb: handle first atomic write to the page
  target/ppc: Generate fence operations

 cputlb.c               |  8 +++++++-
 target/ppc/translate.c | 37 +++++++++++++++++++++++++++++++------
 2 files changed, 38 insertions(+), 7 deletions(-)

-- 
2.9.3


Re: [Qemu-devel] [Qemu-ppc] [PATCH v2 0/3] Enable MTTCG on PPC64
Posted by luigi burdo 7 years ago
Tested on PowerMac G5 Quad  and 380% of system load and working on

Fedora 25 PPC64 host and Ubuntu Mate 17.04 guest  (patched the 2.9 rc3)


The machine configuration was this

sudo ./qemu-system-ppc64 -cpu POWER8 -vga none -machine pseries-2.5,usb=off -m 2G  -smp 4,cores=4,threads=1 -accel tcg,thread=multi  -kerne vmlinuz    -append root=/dev/sda   -device ich9-ahci,id=ahci   -device ide-drive,drive=disk0 -drive file=/dev/sda4,if=none,id=disk0   -net nic,model=pcnet -net user -soundhw hda  -display sdl -vga virtio


vga virtio working too

here a shot

https://scontent-mxp1-1.xx.fbcdn.net/v/t1.0-9/17796379_10208795258860396_7825547329794577576_n.jpg?oh=526d6ddeb67c817053582d5b9ee56c71&oe=594D7BDF


Thanks

Luigi

Re: [Qemu-devel] [Qemu-ppc] [PATCH v2 0/3] Enable MTTCG on PPC64
Posted by G 3 7 years ago
On Apr 7, 2017, at 1:49 PM, luigi burdo wrote:

> Tested on PowerMac G5 Quad  and 380% of system load and working on
> Fedora 25 PPC64 host and Ubuntu Mate 17.04 guest  (patched the 2.9  
> rc3)
>
> The machine configuration was this
>
> sudo ./qemu-system-ppc64 -cpu POWER8 -vga none -machine  
> pseries-2.5,usb=off -m 2G  -smp 4,cores=4,threads=1 -accel  
> tcg,thread=multi  -kerne vmlinuz    -append root=/dev/sda   -device  
> ich9-ahci,id=ahci   -device ide-drive,drive=disk0 -drive file=/dev/ 
> sda4,if=none,id=disk0   -net nic,model=pcnet -net user -soundhw  
> hda  -display sdl -vga virtio
>
> vga virtio working too
> here a shot
> https://scontent-mxp1-1.xx.fbcdn.net/v/ 
> t1.0-9/17796379_10208795258860396_7825547329794577576_n.jpg? 
> oh=526d6ddeb67c817053582d5b9ee56c71&oe=594D7BDF
>
> Thanks
> Luigi

Do you have any timings? Did the guest run faster?

Re: [Qemu-devel] [Qemu-ppc] [PATCH v2 0/3] Enable MTTCG on PPC64
Posted by luigi burdo 7 years ago
Hi i dint made much tests,

but for sure all is faster compared one thread only.

Fore sure tcg need to be optimized (in all emulated architectures) compared some old commercial emulators but all is better than before.

I will made more tests tomorrow and report.

ciao

Luigi


Do you have any timings? Did the guest run faster?
Re: [Qemu-devel] [Qemu-ppc] [PATCH v2 0/3] Enable MTTCG on PPC64
Posted by luigi burdo 7 years ago
Hi, on info is mttcg using an amouth of ram for cpu caching and translating operations like was did in past by emulators like virtualpc,realpc, bluelabel or softwindows?

in case of yes is possible increase it from the command line?

Thanks

Luigi
Re: [Qemu-devel] [Qemu-ppc] [PATCH v2 0/3] Enable MTTCG on PPC64
Posted by Alex Bennée 7 years ago
luigi burdo <intermediadc@hotmail.com> writes:

> Hi, on info is mttcg using an amouth of ram for cpu caching and
> translating operations like was did in past by emulators like
> virtualpc,realpc, bluelabel or softwindows?

It's a fixed buffer. You can see if it being flushed by running:

  info jit

On the QEMU monitor console.

>
> in case of yes is possible increase it from the command line?
>
> Thanks
>
> Luigi


--
Alex Bennée

Re: [Qemu-devel] [PATCH v2 0/3] Enable MTTCG on PPC64
Posted by David Gibson 7 years ago
On Fri, Apr 07, 2017 at 11:37:49AM +0530, Nikunj A Dadhania wrote:
> The series enables Multi-Threaded TCG on PPC64
> 
> Patch 01: Use atomic_cmpxchg in store conditional
>       02: Handle first write to page during atomic operation
>       03: Generate memory barriers for sync/isync and load/store conditional
> 
> Patches are based on ppc-for-2.10

Applied to ppc-for-2.10.  Anyone object to that for 2/3, which isn't
within ppc code?

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
Re: [Qemu-devel] [Qemu-ppc] [PATCH v2 0/3] Enable MTTCG on PPC64
Posted by luigi burdo 7 years ago
Hi David and Nikuji,

can i suggest to remove the message:


Guest not yet converted to MTTCG - you may get unexpected results
where the mttcg is enabled?

another thing im finding  is this message
Guest expects a stronger memory ordering than the host provides
This may cause strange/hard to debug errors


I have 8 gb on my machine and this message come if i gave 512mb on the guest too.

Is possible know where the mttcg is already enabled?

i see on x86,i386,arm too if i set thread=multy the qemu start using the other host cores is on this guest system enabled?

if yes i have the same messages of ppc64 too :

Guest not yet converted to MTTCG - you may get unexpected results

and

Guest expects a stronger memory ordering than the host provides
This may cause strange/hard to debug errors


Ciao

Luigi


Applied to ppc-for-2.10.  Anyone object to that for 2/3, which isn't
within ppc code?

--
David Gibson
<http://www.ozlabs.org/~dgibson>
Re: [Qemu-devel] [Qemu-ppc] [PATCH v2 0/3] Enable MTTCG on PPC64
Posted by Alex Bennée 7 years ago
luigi burdo <intermediadc@hotmail.com> writes:

> Hi David and Nikuji,
>
> can i suggest to remove the message:
>
>
> Guest not yet converted to MTTCG - you may get unexpected results
> where the mttcg is enabled?

Have you declared the memory ordering for the guest?

>
> another thing im finding  is this message
> Guest expects a stronger memory ordering than the host provides
> This may cause strange/hard to debug errors

See ca759f9e387db87e1719911f019bc60c74be9ed8 for an example.

>
>
> I have 8 gb on my machine and this message come if i gave 512mb on the guest too.
>
> Is possible know where the mttcg is already enabled?
>
> i see on x86,i386,arm too if i set thread=multy the qemu start using the other host cores is on this guest system enabled?
>
> if yes i have the same messages of ppc64 too :
>
> Guest not yet converted to MTTCG - you may get unexpected results
>
> and
>
> Guest expects a stronger memory ordering than the host provides
> This may cause strange/hard to debug errors
>
>
> Ciao
>
> Luigi
>
>
> Applied to ppc-for-2.10.  Anyone object to that for 2/3, which isn't
> within ppc code?


--
Alex Bennée

Re: [Qemu-devel] [Qemu-ppc] [PATCH v2 0/3] Enable MTTCG on PPC64
Posted by luigi burdo 7 years ago
Hi Alex,

>Have you declared the memory ordering for the guest?

Nope didnt know was necessary i just add the standard -m 2047


>See ca759f9e387db87e1719911f019bc60c74be9ed8 for an example.

watching it about

Thanks
Luigi
Re: [Qemu-devel] [Qemu-ppc] [PATCH v2 0/3] Enable MTTCG on PPC64
Posted by Nikunj A Dadhania 7 years ago
Alex Bennée <alex.bennee@linaro.org> writes:

> luigi burdo <intermediadc@hotmail.com> writes:
>
>> Hi David and Nikuji,
>>
>> can i suggest to remove the message:
>>
>>
>> Guest not yet converted to MTTCG - you may get unexpected results
>> where the mttcg is enabled?
>
> Have you declared the memory ordering for the guest?

No, I havent done that yet, will send a patch.

>> another thing im finding  is this message
>> Guest expects a stronger memory ordering than the host provides
>> This may cause strange/hard to debug errors
>
> See ca759f9e387db87e1719911f019bc60c74be9ed8 for an example.

Regards
Nikunj


Re: [Qemu-devel] [Qemu-ppc] [PATCH v2 0/3] Enable MTTCG on PPC64
Posted by Alex Bennée 7 years ago
Nikunj A Dadhania <nikunj@linux.vnet.ibm.com> writes:

> Alex Bennée <alex.bennee@linaro.org> writes:
>
>> luigi burdo <intermediadc@hotmail.com> writes:
>>
>>> Hi David and Nikuji,
>>>
>>> can i suggest to remove the message:
>>>
>>>
>>> Guest not yet converted to MTTCG - you may get unexpected results
>>> where the mttcg is enabled?
>>
>> Have you declared the memory ordering for the guest?
>
> No, I havent done that yet, will send a patch.

You also need to update configure so mttcg="yes" (resulting in
TARGET_SUPPORTS_MTTCG being set for the build).
>
>>> another thing im finding  is this message
>>> Guest expects a stronger memory ordering than the host provides
>>> This may cause strange/hard to debug errors
>>
>> See ca759f9e387db87e1719911f019bc60c74be9ed8 for an example.
>
> Regards
> Nikunj


--
Alex Bennée

Re: [Qemu-devel] [Qemu-ppc] [PATCH v2 0/3] Enable MTTCG on PPC64
Posted by Nikunj A Dadhania 7 years ago
Alex Bennée <alex.bennee@linaro.org> writes:

> Nikunj A Dadhania <nikunj@linux.vnet.ibm.com> writes:
>
>> Alex Bennée <alex.bennee@linaro.org> writes:
>>
>>> luigi burdo <intermediadc@hotmail.com> writes:
>>>
>>>> Hi David and Nikuji,
>>>>
>>>> can i suggest to remove the message:
>>>>
>>>>
>>>> Guest not yet converted to MTTCG - you may get unexpected results
>>>> where the mttcg is enabled?
>>>
>>> Have you declared the memory ordering for the guest?
>>
>> No, I havent done that yet, will send a patch.
>
> You also need to update configure so mttcg="yes" (resulting in
> TARGET_SUPPORTS_MTTCG being set for the build).

Yes, I have that patch for ppc64, will send it to the list.

Regards
Nikunj


Re: [Qemu-devel] [PATCH v2 0/3] Enable MTTCG on PPC64
Posted by Richard Henderson 7 years ago
On 04/07/2017 11:51 PM, David Gibson wrote:
> On Fri, Apr 07, 2017 at 11:37:49AM +0530, Nikunj A Dadhania wrote:
>> The series enables Multi-Threaded TCG on PPC64
>>
>> Patch 01: Use atomic_cmpxchg in store conditional
>>       02: Handle first write to page during atomic operation
>>       03: Generate memory barriers for sync/isync and load/store conditional
>>
>> Patches are based on ppc-for-2.10
>
> Applied to ppc-for-2.10.  Anyone object to that for 2/3, which isn't
> within ppc code?

Please go ahead.  If there was another queue it might have gone in, it would 
probably be tcg-next, and I don't have anything else pending at the moment.


r~