public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Andre Przywara <andre.przywara@arm.com>
To: Andrew Jones <drjones@redhat.com>
Cc: kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org
Subject: Re: [kvm-unit-tests PATCH 7/7] arm/arm64: Use argv_find() for test names
Date: Thu, 24 Jan 2019 13:43:34 +0000	[thread overview]
Message-ID: <20190124134334.271ba99f@donnerap.cambridge.arm.com> (raw)
In-Reply-To: <20190124130732.cjht5dc77m72s2kj@kamzik.brq.redhat.com>

On Thu, 24 Jan 2019 14:07:32 +0100
Andrew Jones <drjones@redhat.com> wrote:

> On Thu, Jan 24, 2019 at 11:16:34AM +0000, Alexandru Elisei wrote:
> > Instead of aborting the test when an unexpected parameter is found,
> > use argv_find() to search for the desired parameter. On arm and
> > arm64, this allows kvm-unit-tests to be used with virtual machine
> > monitors like kvmtool which automatically adds parameters to the
> > kernel command line.
> > 
> > For example, to run the gicv3-ipi test the following command was
> > used:
> > 
> > lkvm run -k gic.flat -c 8 -m 410 -p "ipi" --irqchip=gicv3
> > 
> > The resulting kernel command line that was passed to kvm-unit-tests
> > was:
> > 
> > "console=ttyS0 rw
> > rootflags=trans=virtio,version=9p2000.L,cache=loose rootfstype=9p
> > init=/virt/init  ip=dhcp ipi"  
> 
> Why not write a patch for kvmtool that provides a new command line
> parameter which says to not add any kernel parameters other than what
> is provided with '-p'? Giving the user full control over the kernel
> command line seems like a feature kvmtool would want anyway.

Thanks, that was the reply I was hoping for ;-)
Gives me some leverage to justify the corresponding kvmtool patch.

Actually we are about to gain the --firmware switch for ARM in kvmtool,
and I am looking at piggy-backing on that.

Cheers,
Andre.

> > 
> > Without the patch, the following error occurs:
> > "ABORT: gicv3: Unknown subtest 'console=ttyS0'"
> > 
> > With the patch, the test is able to run.
> > 
> > Signed-off-by: Alexandru Elisei <alexandru.elisei@arm.com>
> > ---
> >  arm/gic.c      |  7 ++++---
> >  arm/selftest.c | 19 ++++++++++++-------
> >  2 files changed, 16 insertions(+), 10 deletions(-)
> > 
> > diff --git a/arm/gic.c b/arm/gic.c
> > index ed5642e74f70..f3746de4bfd8 100644
> > --- a/arm/gic.c
> > +++ b/arm/gic.c
> > @@ -12,6 +12,7 @@
> >   * This work is licensed under the terms of the GNU LGPL, version
> > 2. */
> >  #include <libcflat.h>
> > +#include <argv.h>
> >  #include <asm/setup.h>
> >  #include <asm/processor.h>
> >  #include <asm/delay.h>
> > @@ -533,13 +534,13 @@ int main(int argc, char **argv)
> >  	if (argc < 2)
> >  		report_abort("no test specified");
> >  
> > -	if (strcmp(argv[1], "ipi") == 0) {
> > +	if (argv_find("ipi", argc, argv) != -1) {
> >  		report_prefix_push(argv[1]);
> >  		nr_cpu_check(2);
> >  		on_cpus(ipi_test, NULL);
> > -	} else if (strcmp(argv[1], "active") == 0) {
> > +	} else if (argv_find("active", argc, argv) != -1) {
> >  		run_active_clear_test();
> > -	} else if (strcmp(argv[1], "mmio") == 0) {
> > +	} else if (argv_find("mmio", argc, argv) != -1) {
> >  		report_prefix_push(argv[1]);
> >  		gic_test_mmio();
> >  		report_prefix_pop();
> > diff --git a/arm/selftest.c b/arm/selftest.c
> > index ea5101ef7217..44b2f23ca115 100644
> > --- a/arm/selftest.c
> > +++ b/arm/selftest.c
> > @@ -8,6 +8,7 @@
> >  #include <libcflat.h>
> >  #include <util.h>
> >  #include <devicetree.h>
> > +#include <argv.h>
> >  #include <asm/setup.h>
> >  #include <asm/ptrace.h>
> >  #include <asm/asm-offsets.h>
> > @@ -319,28 +320,32 @@ static void cpu_report(void *data __unused)
> >  
> >  int main(int argc, char **argv)
> >  {
> > +	int pos;
> > +
> >  	report_prefix_push("selftest");
> >  
> >  	if (argc < 2)
> >  		report_abort("no test specified");
> >  
> > -	report_prefix_push(argv[1]);
> > -
> > -	if (strcmp(argv[1], "setup") == 0) {
> > +	if ((pos = argv_find("setup", argc, argv)) != -1) {
> >  
> > -		check_setup(argc-2, &argv[2]);
> > +		report_prefix_push("setup");
> > +		check_setup(argc-(pos+1), &argv[pos+1]);
> >  
> > -	} else if (strcmp(argv[1], "vectors-kernel") == 0) {
> > +	} else if (argv_find("vectors-kernel", argc, argv) != -1) {
> >  
> > +		report_prefix_push("vectors-kernel");
> >  		check_vectors(NULL);
> >  
> > -	} else if (strcmp(argv[1], "vectors-user") == 0) {
> > +	} else if (argv_find("vectors-user", argc, argv) != -1) {
> >  
> > +		report_prefix_push("vectors-user");
> >  		start_usr(check_vectors, NULL,
> >  				(unsigned
> > long)thread_stack_alloc()); 
> > -	} else if (strcmp(argv[1], "smp") == 0) {
> > +	} else if (argv_find("smp", argc, argv) != -1) {
> >  
> > +		report_prefix_push("smp");
> >  		report("PSCI version", psci_check());
> >  		on_cpus(cpu_report, NULL);
> >  
> > -- 
> > 2.17.0
> >   

  reply	other threads:[~2019-01-24 13:43 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-24 11:16 [kvm-unit-tests PATCH 0/7] arm/arm64: Add support for running under kvmtool Alexandru Elisei
2019-01-24 11:16 ` [kvm-unit-tests PATCH 1/7] lib: arm: Discover ns16550a UART Alexandru Elisei
2019-01-24 11:54   ` Andre Przywara
2019-01-24 13:11   ` Andrew Jones
2019-01-25 14:07     ` Alexandru Elisei
2019-01-24 11:16 ` [kvm-unit-tests PATCH 2/7] lib: arm: Remove warning about uart0_base mismatch Alexandru Elisei
2019-01-24 11:59   ` Andre Przywara
2019-01-24 12:37     ` Andrew Jones
2019-01-25 16:36       ` Alexandru Elisei
2019-01-25 16:47         ` Andrew Jones
2019-01-28 14:24           ` Alexandru Elisei
2019-01-28 16:31             ` Andrew Jones
2019-01-28 17:58               ` Andre Przywara
2019-01-29 10:32                 ` Andrew Jones
2019-01-29 11:16               ` Alexandru Elisei
2019-01-29 12:23                 ` Andrew Jones
2019-01-29 13:40                   ` Alexandru Elisei
2019-01-24 11:16 ` [kvm-unit-tests PATCH 3/7] lib: chr-testdev: Make chr_testdev_init() return status Alexandru Elisei
2019-01-24 12:56   ` Andrew Jones
2019-01-24 11:16 ` [kvm-unit-tests PATCH 4/7] lib: arm: Implement PSCI SYSTEM_OFF in psci_system_off() Alexandru Elisei
2019-01-24 13:01   ` Andrew Jones
2019-01-25 14:08     ` Alexandru Elisei
2019-01-25 14:25       ` Andrew Jones
2019-01-24 11:16 ` [kvm-unit-tests PATCH 5/7] lib: arm: Fallback to psci_system_off() in exit() Alexandru Elisei
2019-01-24 13:00   ` Andrew Jones
2019-01-24 13:35     ` Andrew Jones
2019-01-25 14:56       ` Alexandru Elisei
2019-01-25 15:31         ` Andrew Jones
2019-01-25 15:51           ` Alexandru Elisei
2019-01-25 16:05           ` Andrew Jones
2019-01-25 16:14             ` Andre Przywara
2019-01-25 16:44               ` Alexandru Elisei
2019-01-25 16:50                 ` Andrew Jones
2019-01-25 14:18     ` Alexandru Elisei
2019-01-24 11:16 ` [kvm-unit-tests PATCH 6/7] lib: argv: Implement argv_find() for test parameters Alexandru Elisei
2019-01-24 11:16 ` [kvm-unit-tests PATCH 7/7] arm/arm64: Use argv_find() for test names Alexandru Elisei
2019-01-24 13:07   ` Andrew Jones
2019-01-24 13:43     ` Andre Przywara [this message]
2019-01-28 12:16     ` Alexandru Elisei

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190124134334.271ba99f@donnerap.cambridge.arm.com \
    --to=andre.przywara@arm.com \
    --cc=drjones@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox