Re: [kvm-unit-tests PATCH v3] runtime: Allow to specify properties for accelerator

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jun 23, 2023 at 02:22:42PM +1000, Gavin Shan wrote:
> Hi Drew,
> 
> On 6/20/23 19:06, Andrew Jones wrote:
> > On Tue, Jun 20, 2023 at 02:13:22PM +1000, Gavin Shan wrote:
> > > On 6/19/23 18:45, Andrew Jones wrote:
> > > > On Thu, Jun 15, 2023 at 04:21:48PM +1000, Gavin Shan wrote:
> > > > > There are extra properties for accelerators to enable the specific
> > > > > features. For example, the dirty ring for KVM accelerator can be
> > > > > enabled by "-accel kvm,dirty-ring-size=65536". Unfortuntely, the
> > > > > extra properties for the accelerators aren't supported. It makes
> > > > > it's impossible to test the combination of KVM and dirty ring
> > > > > as the following error message indicates.
> > > > > 
> > > > >     # cd /home/gavin/sandbox/kvm-unit-tests/tests
> > > > >     # QEMU=/home/gavin/sandbox/qemu.main/build/qemu-system-aarch64 \
> > > > >       ACCEL=kvm,dirty-ring-size=65536 ./its-migration
> > > > >        :
> > > > >     BUILD_HEAD=2fffb37e
> > > > >     timeout -k 1s --foreground 90s /home/gavin/sandbox/qemu.main/build/qemu-system-aarch64 \
> > > > >     -nodefaults -machine virt -accel kvm,dirty-ring-size=65536 -cpu cortex-a57             \
> > > > >     -device virtio-serial-device -device virtconsole,chardev=ctd -chardev testdev,id=ctd   \
> > > > >     -device pci-testdev -display none -serial stdio -kernel _NO_FILE_4Uhere_ -smp 160      \
> > > > >     -machine gic-version=3 -append its-pending-migration # -initrd /tmp/tmp.gfDLa1EtWk
> > > > >     qemu-system-aarch64: kvm_init_vcpu: kvm_arch_init_vcpu failed (0): Invalid argument
> > > > > 
> > > > > Allow to specify extra properties for accelerators. With this, the
> > > > > "its-migration" can be tested for the combination of KVM and dirty
> > > > > ring.
> > > > > 
> > > > > Signed-off-by: Gavin Shan <gshan@xxxxxxxxxx>
> > > > > ---
> > > > > v3: Split $ACCEL to $ACCEL and $ACCEL_PROPS in get_qemu_accelerator()
> > > > >       and don't print them as output, suggested by Drew.
> > > > > ---
> > > > >    arm/run               | 12 ++++--------
> > > > >    powerpc/run           |  5 ++---
> > > > >    s390x/run             |  5 ++---
> > > > >    scripts/arch-run.bash | 21 +++++++++++++--------
> > > > >    x86/run               |  5 ++---
> > > > >    5 files changed, 23 insertions(+), 25 deletions(-)
> > > > > 
> > > > > diff --git a/arm/run b/arm/run
> > > > > index c6f25b8..d9ebe59 100755
> > > > > --- a/arm/run
> > > > > +++ b/arm/run
> > > > > @@ -10,10 +10,8 @@ if [ -z "$KUT_STANDALONE" ]; then
> > > > >    fi
> > > > >    processor="$PROCESSOR"
> > > > > -accel=$(get_qemu_accelerator) ||
> > > > > -	exit $?
> > > > > -
> > > > > -if [ "$accel" = "kvm" ]; then
> > > > > +get_qemu_accelerator || exit $?
> > > > > +if [ "$ACCEL" = "kvm" ]; then
> > > > >    	QEMU_ARCH=$HOST
> > > > >    fi
> > > > > @@ -23,11 +21,9 @@ qemu=$(search_qemu_binary) ||
> > > > >    if [ "$QEMU" ] && [ -z "$ACCEL" ] &&
> > > > >       [ "$HOST" = "aarch64" ] && [ "$ARCH" = "arm" ] &&
> > > > >       [ "$(basename $QEMU)" = "qemu-system-arm" ]; then
> > > > > -	accel=tcg
> > > > > +	ACCEL="tcg"
> > > > >    fi
> > > > 
> > > > As I pointed out in the v2 review we can't just s/accel/ACCEL/ without
> > > > other changes. Now ACCEL will also be set when the above condition
> > > > is checked, making it useless. Please ensure the test case that commit
> > > > c7d6c7f00e7c ("arm/run: Use TCG with qemu-system-arm on arm64 systems")
> > > > fixed still works with your patch.
> > > > 
> > > 
> > > Sorry that I missed your comments for v2. In order to make the test case
> > > in c7d6c7f00e7c working, we just need to call set_qemu_accelerator() after
> > > the chunk of code, like below. When $ACCEL is set to "tcg" by the conditional
> > > code, it won't be changed in the following set_qemu_accelerator().
> > > 
> > > Could you Please confirm if it looks good to you so that I can integrate
> > > the changes to v4 and post it.
> > > 
> > > arm/run
> > > --------
> > > 
> > > processor="$PROCESSOR"
> > > 
> > > if [ "$QEMU" ] && [ -z "$ACCEL" ] &&
> > >     [ "$HOST" = "aarch64" ] && [ "$ARCH" = "arm" ] &&
> > >     [ "$(basename $QEMU)" = "qemu-system-arm" ]; then
> > >          ACCEL="tcg"
> > > fi
> > > 
> > > set_qemu_accelerator || exit $?
> > > if [ "$ACCEL" = "kvm" ]; then
> > >          QEMU_ARCH=$HOST
> > > fi
> > > 
> > 
> > Looks fine, but please give it a test run.
> > 
> 
> Thanks, Drew. v4 has been posted for further review. Since I don't have a 'arm'
> host around, I adjust $ARCH to "arm64" for a simulation and the test case included
> in commit c7d6c7f00e7c should be working fine: We eventually have "tcg" instead of
> "kvm" accelerator for the combination, which is expected by commit c7d6c7f00e7c

You don't need an arm host. Indeed $HOST should be aarch64 for this case.
You just need to compile the tests for arm instead of aarch64. That's easy
to do with a cross compiler

 ./configure --arch=arm --cross-prefix=arm-linux-gnu-

But hacking the condition is fine too for this simple case.

Thanks,
drew

> 
> v4: https://lore.kernel.org/kvmarm/20230623035750.312679-1-gshan@xxxxxxxxxx/T/#u
> 
> Thanks,
> Gavin
> 



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Kernel Development]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Info]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Linux Media]     [Device Mapper]

  Powered by Linux