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. From mboxrd@z Thu Jan 1 00:00:00 1970 From: Brendan Higgins Subject: Re: [PATCH v5 10/12] kunit: Add 'kunit_shutdown' option Date: Tue, 4 Aug 2020 13:18:15 -0700 Message-ID: References: <20200626210917.358969-1-brendanhiggins@google.com> <20200626210917.358969-11-brendanhiggins@google.com> <202006261436.DEF4906A5@keescook> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Return-path: Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726631AbgHDUSb (ORCPT ); Tue, 4 Aug 2020 16:18:31 -0400 Received: from mail-pl1-x642.google.com (mail-pl1-x642.google.com [IPv6:2607:f8b0:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D6823C061756 for ; Tue, 4 Aug 2020 13:18:30 -0700 (PDT) Received: by mail-pl1-x642.google.com with SMTP id g19so11349236plq.0 for ; Tue, 04 Aug 2020 13:18:30 -0700 (PDT) In-Reply-To: <202006261436.DEF4906A5@keescook> Sender: linux-arch-owner@vger.kernel.org List-ID: 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 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. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726631AbgHDUSb (ORCPT ); Tue, 4 Aug 2020 16:18:31 -0400 Received: from mail-pl1-x642.google.com (mail-pl1-x642.google.com [IPv6:2607:f8b0:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D6823C061756 for ; Tue, 4 Aug 2020 13:18:30 -0700 (PDT) Received: by mail-pl1-x642.google.com with SMTP id g19so11349236plq.0 for ; Tue, 04 Aug 2020 13:18:30 -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 Content-Type: text/plain; charset="UTF-8" Sender: linux-arch-owner@vger.kernel.org List-ID: 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 Message-ID: <20200804201815.gGQxYfVZH3j6JhT-Ah2Nriqdvt7nG4Nuj1Rc0LQsz0E@z> 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. 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=-9.8 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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 6F7A5C433DF for ; Tue, 4 Aug 2020 20:20:34 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EEBE721744 for ; Tue, 4 Aug 2020 20:20:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="Yeb/dQlV" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EEBE721744 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4BLmMz73HBzDqRt for ; Wed, 5 Aug 2020 06:20:31 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=google.com (client-ip=2607:f8b0:4864:20::644; helo=mail-pl1-x644.google.com; envelope-from=brendanhiggins@google.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20161025 header.b=Yeb/dQlV; dkim-atps=neutral Received: from mail-pl1-x644.google.com (mail-pl1-x644.google.com [IPv6:2607:f8b0:4864:20::644]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4BLmKf2YKtzDqSK for ; Wed, 5 Aug 2020 06:18:30 +1000 (AEST) Received: by mail-pl1-x644.google.com with SMTP id d1so23908783plr.8 for ; Tue, 04 Aug 2020 13:18:29 -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=LFy/qaLFlAezzqAE/MxUZGZrHXofU5W1uEoRoTBQL/XL+ugy0JMYg2D+or1gxZ+lqR lPAViYr/t7CCrA0JHlDzMXuSF1QOiEQplOrriNinJ35l7Wm+p0GtOHLoOoJShgLU5tGO 417J8c0SGveIamXwbs56GpO8Hkkw3sToYdG84V6/u6s5ks/pFJHtE/jM5/6+lz8tkywO uTAcCDcI9nwAgtuZIEpHH0pI5via1rk6UNUNljd5eDoFKUzrTlx+D0tJdI5rWPjRBWAj cZd4g5qFptS7OJWn0cwGVpKVLZTSnrFTQeOoJf2v2REG9ZJPOmyNYVC0MHjb61vWlZlF fVdQ== X-Gm-Message-State: AOAM533tCdFAKNHzMdTJDfxFsp9bbTykzFA/kSTJ01YGn9+ju4cr4ZXs 8V52i2hyvE/oulLje/YQbwlXXAxcPJ9fTz9IIl9RiA== 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 Content-Type: text/plain; charset="UTF-8" X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "open list:DOCUMENTATION" , catalin.marinas@arm.com, jcmvbkbc@gmail.com, will@kernel.org, Paul Mackerras , "open list:KERNEL SELFTEST FRAMEWORK" , Frank Rowand , Anton Ivanov , linux-arch@vger.kernel.org, Richard Weinberger , rppt@linux.ibm.com, Iurii Zaikin , linux-xtensa@linux-xtensa.org, Arnd Bergmann , Jeff Dike , linux-um , linuxppc-dev@lists.ozlabs.org, David Gow , Shuah Khan , Linux ARM , KUnit Development , Chris Zankel , Michal Simek , Stephen Boyd , Greg KH , Linux Kernel Mailing List , Luis Chamberlain , Alan Maguire , Andrew Morton , Logan Gunthorpe Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" 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. 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=-10.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 4A4ACC433DF for ; Tue, 4 Aug 2020 20:19:57 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 21211207FC for ; Tue, 4 Aug 2020 20:19:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="XNGit8SZ"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="Yeb/dQlV" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 21211207FC Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=jxpcvuRrgbSl6XFmXoMitB96D69yIehiGTAbTJTpiHc=; b=XNGit8SZuSUqJLpXxKai/8jCZ wvebCgLXLzutFn+74c5NjGCAv3NB+DdIL3qTJ18dnpP5vaeNsQFXyohuVbIQMTmoJ+bRotDKYoDY+ NaKTZf6kq8PsY2iCUAUkL61AvlX9NgJNpYVKF7xDvRVJRzDEZcSG3GVqgCGC7FmLf1ctXm/WjSW7B eKs7Q7t/AcmMczwu2t/xJJLr4zPdZRMe+3g/mL+T3zJuA8cmLfTgNjOaEnIiR1lA6IdMYzR7BQumz p0CP442S+A05XTz0vw0/Sb99s8gcmlRryRaAg6JwXJ5f1fuWvadbbevUV10GpQcfMo/0jqI3KRioe Rle+UlX9A==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k33OJ-0001bI-JJ; Tue, 04 Aug 2020 20:18:31 +0000 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k33OH-0001aU-5H for linux-arm-kernel@lists.infradead.org; Tue, 04 Aug 2020 20:18:30 +0000 Received: by mail-pl1-x644.google.com with SMTP id o1so23937359plk.1 for ; Tue, 04 Aug 2020 13:18:28 -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=d6muP7YqZK1mYiMZop1ieRJWOAJtI5m0rdbLntYqLz1D9TS/RmAVD4djVwYgjZAJwK rag7LiajikoGU6M6D0xuTp+0v+djpMfDN/Xe/UUGuBxlvHCc2WPjVTETEL9yciV4rudl s4atzrIonK/JcD74koW4MgJQQLUApOGJ7ZNlcjaZNu2aYN+owHdDdDYonbIPfYATn70D suytW/f9VQw4KHUzTfEipFcktDPPmUeD8yOqOFUq17trekk54UPIAgdcfzdhIc6QUSl6 S2yo8E+cQY5zzVTpITwQG0GZRjjI+WNUl/S+/xReoUbCIfPK7P/y2/X5jVoUnQXBLxH6 FS4g== X-Gm-Message-State: AOAM531I2kylzeM7WavRrTL7SNBNGn9211IReRweRZm0O1ztspsIvC4p pyvh1F/1YnvWkRUPoiR2CxHUBlpFIfr3Yb2zCkI8Rw== 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200804_161829_283177_69A02E47 X-CRM114-Status: GOOD ( 31.85 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "open list:DOCUMENTATION" , catalin.marinas@arm.com, jcmvbkbc@gmail.com, will@kernel.org, Paul Mackerras , "open list:KERNEL SELFTEST FRAMEWORK" , Frank Rowand , Anton Ivanov , linux-arch@vger.kernel.org, Richard Weinberger , rppt@linux.ibm.com, Benjamin Herrenschmidt , Iurii Zaikin , linux-xtensa@linux-xtensa.org, Arnd Bergmann , Jeff Dike , linux-um , linuxppc-dev@lists.ozlabs.org, David Gow , Shuah Khan , Linux ARM , KUnit Development , Chris Zankel , Michal Simek , Stephen Boyd , Greg KH , Linux Kernel Mailing List , Luis Chamberlain , Alan Maguire , Michael Ellerman , Andrew Morton , Logan Gunthorpe Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k33OH-0001aT-5I for linux-um@lists.infradead.org; Tue, 04 Aug 2020 20:18:30 +0000 Received: by mail-pl1-x641.google.com with SMTP id t10so18586295plz.10 for ; Tue, 04 Aug 2020 13:18:28 -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 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-um" Errors-To: linux-um-bounces+geert=linux-m68k.org@lists.infradead.org To: Kees Cook Cc: "open list:DOCUMENTATION" , catalin.marinas@arm.com, jcmvbkbc@gmail.com, will@kernel.org, Paul Mackerras , "open list:KERNEL SELFTEST FRAMEWORK" , Frank Rowand , Anton Ivanov , linux-arch@vger.kernel.org, Richard Weinberger , rppt@linux.ibm.com, Benjamin Herrenschmidt , Iurii Zaikin , linux-xtensa@linux-xtensa.org, Arnd Bergmann , Jeff Dike , linux-um , linuxppc-dev@lists.ozlabs.org, David Gow , Shuah Khan , Linux ARM , KUnit Development , Chris Zankel , Michal Simek , Stephen Boyd , Greg KH , Linux Kernel Mailing List , Luis Chamberlain , Alan Maguire , Michael Ellerman , Andrew Morton , Logan Gunthorpe 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. _______________________________________________ linux-um mailing list linux-um@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-um