All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Gow <davidgow@google.com>
To: Daniel Latypov <dlatypov@google.com>
Cc: Brendan Higgins <brendanhiggins@google.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	KUnit Development <kunit-dev@googlegroups.com>,
	"open list:KERNEL SELFTEST FRAMEWORK" 
	<linux-kselftest@vger.kernel.org>,
	Shuah Khan <skhan@linuxfoundation.org>
Subject: Re: [PATCH] kunit: tool: cosmetic: don't specify duplicate kunit_shutdown's
Date: Fri, 8 Apr 2022 11:16:57 +0800	[thread overview]
Message-ID: <CABVgOSm-sDx8G0iphFXEgnsF-c9eu++bxtXjhOM_WHx-mkRiTA@mail.gmail.com> (raw)
In-Reply-To: <20220407193902.1981605-1-dlatypov@google.com>

On Fri, Apr 8, 2022 at 3:39 AM Daniel Latypov <dlatypov@google.com> wrote:
>
> Context:
> When using a non-UML arch, kunit.py will boot the test kernel with these
> options by default:
> > mem=1G console=tty kunit_shutdown=halt console=ttyS0 kunit_shutdown=reboot
>
> For QEMU, we need to use 'reboot', and for UML we need to use 'halt'.
> If you switch them, kunit.py will hang until the --timeout expires.
>
> So the code currently unconditionally adds 'kunit_shutdown=halt' but
> then appends 'reboot' when using QEMU (which overwrites it).
>
> This patch:
> Having these duplicate options is a bit noisy.
> Switch so we only add 'halt' for UML.
>
> I.e. we now get
> UML: 'mem=1G console=tty console=ttyS0 kunit_shutdown=halt'
> QEMU: 'mem=1G console=tty console=ttyS0 kunit_shutdown=reboot'
>
> Side effect: you can't overwrite kunit_shutdown on UML w/ --kernel_arg.
> But you already couldn't for QEMU, and why would you want to?
>
> Signed-off-by: Daniel Latypov <dlatypov@google.com>
> ---

Thanks so much for fixing this: it had been quietly bugging me for a while.

This looks pretty good as is, but I have a few suggestions for
extending it which could be nice to have. I've put them inline below.

Either way,
Reviewed-by: David Gow <davidgow@google.com>

>  tools/testing/kunit/kunit_kernel.py | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/kunit/kunit_kernel.py b/tools/testing/kunit/kunit_kernel.py
> index 483f78e15ce9..9731ceb7ad92 100644
> --- a/tools/testing/kunit/kunit_kernel.py
> +++ b/tools/testing/kunit/kunit_kernel.py
> @@ -158,7 +158,7 @@ class LinuxSourceTreeOperationsUml(LinuxSourceTreeOperations):
>         def start(self, params: List[str], build_dir: str) -> subprocess.Popen:
>                 """Runs the Linux UML binary. Must be named 'linux'."""
>                 linux_bin = os.path.join(build_dir, 'linux')
> -               return subprocess.Popen([linux_bin] + params,
> +               return subprocess.Popen([linux_bin] + params + ['kunit_shutdown=halt'],

I'd slightly prefer it if we assigned these extra parameters to a
separate variable, rather than including them directly in the
subprocess.Popen call.

(One thing I'd like to do is to print out the command we're running,
which we do for Qemu, and having it in a variable that's passed in
would be convenient. I don't expect this patch to do that, but having
these parameters separate would make that future diff a little
smaller.)

>                                            stdin=subprocess.PIPE,
>                                            stdout=subprocess.PIPE,
>                                            stderr=subprocess.STDOUT,
> @@ -332,7 +332,7 @@ class LinuxSourceTree(object):
>         def run_kernel(self, args=None, build_dir='', filter_glob='', timeout=None) -> Iterator[str]:
>                 if not args:
>                         args = []
> -               args.extend(['mem=1G', 'console=tty', 'kunit_shutdown=halt'])
> +               args.extend(['mem=1G', 'console=tty'])

Does it make sense to also make these options UML only.

Under Qemu, the amount of memory is already passed separately to qemu,
so adding another limit here seems counterproductive. If an
architecture particularly needs it, we can add it to the
per-architecture config.

And console=tty is overridden by console=ttyS0 on x86_64 anyway, so
that also seems like it should be taken out. I tried commenting this
line out entirely, and at least x86_64 still worked.



>                 if filter_glob:
>                         args.append('kunit.filter_glob='+filter_glob)
>
>
> base-commit: b04d1a8dc7e7ff7ca91a20bef053bcc04265d83a
> --
> 2.35.1.1178.g4f1659d476-goog
>

  reply	other threads:[~2022-04-08  3:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-07 19:39 [PATCH] kunit: tool: cosmetic: don't specify duplicate kunit_shutdown's Daniel Latypov
2022-04-08  3:16 ` David Gow [this message]
2022-04-08 17:38   ` Daniel Latypov

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=CABVgOSm-sDx8G0iphFXEgnsF-c9eu++bxtXjhOM_WHx-mkRiTA@mail.gmail.com \
    --to=davidgow@google.com \
    --cc=brendanhiggins@google.com \
    --cc=dlatypov@google.com \
    --cc=kunit-dev@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=skhan@linuxfoundation.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.