From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.6 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6CBE1C433DF for ; Tue, 4 Aug 2020 20:18:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 49735207FC for ; Tue, 4 Aug 2020 20:18:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="Yeb/dQlV" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727053AbgHDUSd (ORCPT ); Tue, 4 Aug 2020 16:18:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725981AbgHDUSb (ORCPT ); Tue, 4 Aug 2020 16:18:31 -0400 Received: from mail-pj1-x1041.google.com (mail-pj1-x1041.google.com [IPv6:2607:f8b0:4864:20::1041]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1294C06174A for ; Tue, 4 Aug 2020 13:18:30 -0700 (PDT) Received: by mail-pj1-x1041.google.com with SMTP id ha11so2992452pjb.1 for ; Tue, 04 Aug 2020 13:18:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=hzRXIsj1+SAs1tNlnSNXJanvh8FrwUG7dToFo76pgso=; b=Yeb/dQlVJPeL8Vx7ag5c0XCGsmI6B14mO/wfB4je5mHzE84Aurte2l0bCK6rN6ftOQ qiWBFA1NwEV85DMi2taxsi8Cf2xBN87c6islpm8jofcLJzirOXvI2tQaJAy8cqUpO/1g Qulj+Oto1t5n+WRVK4IQZIbwf6L1HIEdEsZv6SlQrBJvxGoc0biA8tqDCu43SCCpAlud qsYcX4lJa/218bfLRWcJcBpvRmp2yd0tFlo6LZH4rCQ1cM06SsI5jnnPyirAd8egQ1R+ eVAd5M85sPA6sg0qtIuxiZcwx5qeeL9EdvdCbkdoA8bbdA8NbxhKZUPy20BrdS+dSyx9 rzVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=hzRXIsj1+SAs1tNlnSNXJanvh8FrwUG7dToFo76pgso=; b=F1IgzPQThQmwvgVF/sP4uP1BgJAQ51HJTp12tcWAlBmz499A3JLzezHdL6TcHMdjGl jeSF7eZo+Xal0VFKB4VO1BrJO04TMX3nAEQxn056WWa1tAib12xh9EGqlgveqF7Hp3cX Wlgv5uikqVvJJ7ZHRsmiRkNQj1MZLa2oCD/b9qxg0V2n2tciEDnFNiyGawqwwDIND53P rIEsr0q2EdpHKEOW4Q/E2J0RtY/pGW0YUr6RQEXR6xwulrDDG3TgZBG8J7a6vK3F/Ar2 JzGG/fqQLAQRUpwZblEpwkA45U2f7qDrNllRofx1sFvLWQmQLKOZikCjBp6YYN39msUr S8CA== X-Gm-Message-State: AOAM530y94PW4St3eJYZyfM9TkZC+7H4NYYkcoBeQvIZ//xJzBP9WCcr P8gOlmrUj2+/0ywfDlVfmPqjVs/uJYYb19X/gMs+AA== X-Google-Smtp-Source: ABdhPJxnSyniAwB6YYkeKPYxsQa+/C3NgF4fGYr1Y0yjfcIUeDxlK/6SOOMgIdqAj4vaOhHA3Dvuz8zhsjCp2po3Iwo= X-Received: by 2002:a17:902:161:: with SMTP id 88mr21097385plb.325.1596572306459; Tue, 04 Aug 2020 13:18:26 -0700 (PDT) MIME-Version: 1.0 References: <20200626210917.358969-1-brendanhiggins@google.com> <20200626210917.358969-11-brendanhiggins@google.com> <202006261436.DEF4906A5@keescook> In-Reply-To: <202006261436.DEF4906A5@keescook> From: Brendan Higgins Date: Tue, 4 Aug 2020 13:18:15 -0700 Message-ID: Subject: Re: [PATCH v5 10/12] kunit: Add 'kunit_shutdown' option To: Kees Cook Cc: Jeff Dike , Richard Weinberger , Anton Ivanov , Arnd Bergmann , Shuah Khan , Alan Maguire , Iurii Zaikin , David Gow , Andrew Morton , rppt@linux.ibm.com, Frank Rowand , catalin.marinas@arm.com, will@kernel.org, Michal Simek , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Chris Zankel , jcmvbkbc@gmail.com, Greg KH , Stephen Boyd , Logan Gunthorpe , Luis Chamberlain , linux-um , linux-arch@vger.kernel.org, "open list:KERNEL SELFTEST FRAMEWORK" , KUnit Development , Linux Kernel Mailing List , "open list:DOCUMENTATION" , Linux ARM , linuxppc-dev@lists.ozlabs.org, linux-xtensa@linux-xtensa.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 26, 2020 at 2:40 PM Kees Cook wrote: > > On Fri, Jun 26, 2020 at 02:09:15PM -0700, Brendan Higgins wrote: > > From: David Gow > > > > Add a new kernel command-line option, 'kunit_shutdown', which allows the > > user to specify that the kernel poweroff, halt, or reboot after > > completing all KUnit tests; this is very handy for running KUnit tests > > on UML or a VM so that the UML/VM process exits cleanly immediately > > after running all tests without needing a special initramfs. > > > > Signed-off-by: David Gow > > Signed-off-by: Brendan Higgins > > Reviewed-by: Stephen Boyd > > --- > > lib/kunit/executor.c | 20 ++++++++++++++++++++ > > tools/testing/kunit/kunit_kernel.py | 2 +- > > tools/testing/kunit/kunit_parser.py | 2 +- > > 3 files changed, 22 insertions(+), 2 deletions(-) > > > > diff --git a/lib/kunit/executor.c b/lib/kunit/executor.c > > index a95742a4ece73..38061d456afb2 100644 > > --- a/lib/kunit/executor.c > > +++ b/lib/kunit/executor.c > > @@ -1,5 +1,6 @@ > > // SPDX-License-Identifier: GPL-2.0 > > > > +#include > > #include > > > > /* > > @@ -11,6 +12,23 @@ extern struct kunit_suite * const * const __kunit_suites_end[]; > > > > #if IS_BUILTIN(CONFIG_KUNIT) > > > > +static char *kunit_shutdown; > > +core_param(kunit_shutdown, kunit_shutdown, charp, 0644); > > + > > +static void kunit_handle_shutdown(void) > > +{ > > + if (!kunit_shutdown) > > + return; > > + > > + if (!strcmp(kunit_shutdown, "poweroff")) > > + kernel_power_off(); > > + else if (!strcmp(kunit_shutdown, "halt")) > > + kernel_halt(); > > + else if (!strcmp(kunit_shutdown, "reboot")) > > + kernel_restart(NULL); > > + > > +} > > If you have patches that do something just before the initrd, and then > you add more patches to shut down immediately after an initrd, people > may ask you to just use an initrd instead of filling the kernel with > these changes... > > I mean, I get it, but it's not hard to make an initrd that poke a sysctl > to start the tests... > > In fact, you don't even need a initrd to poke sysctls these days. True, but it is nice to not have to maintain an initramfs for each architecture that you want to test. Still, I see your point. If we can find a convenient way to distribute the needed dependencies for running KUnit on each non-UML architecture then I think I can abandon this change. So how about this: I will drop this patch from this patchset and move it up to the follow up patchset that adds multiarchitecture support to kunit_tool. There we can address the problem of how to best track the necessary dependencies including possibly intitramfss.