From patchwork Thu Dec 8 01:40:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 31104 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp506406wrr; Wed, 7 Dec 2022 17:42:28 -0800 (PST) X-Google-Smtp-Source: AA0mqf4gZOoMUL4xGUC0JreQYBRf/bffXScXWcm6RKXDY1kCDWZVv1iKhpkHgOURFk3vs49rss4y X-Received: by 2002:a17:906:86ca:b0:7c0:fa2d:bc49 with SMTP id j10-20020a17090686ca00b007c0fa2dbc49mr11457625ejy.438.1670463748628; Wed, 07 Dec 2022 17:42:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670463748; cv=none; d=google.com; s=arc-20160816; b=oIE4sRHGBuEVbd5X778LmMJYE0fW+JDRZz25CAErcZkmenPStp1n4tA3GxtNAwvp+d SLthY5kxWHwZkluSZ7p2UtBz1zLefwpUArqs744zvUKfKuEb/0/m9b08hMO2S+zzjC9H aSkqjB0ZbjrNChlsABlKodK7IZPr6v7K62ZbNEyHL21tzDSOJAY+lTudvUNEH/6eUvFb NrWn0/i7XTq7dYrSIfKCc7gMHHTG/7pNKQ9CcM6wKE0thsnOyVt/kM0YKF1oy561nBj3 jWpmUoduY6tFYlcr4HyqaPlmrrPSmOus8v66PiQW3wqjwBaR0wRgGEvZT9EhJbGo37bn FI0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:subject:cc:to:from:date :user-agent:message-id; bh=2iLZzIzvloSZAJdtBc+c42vngCI96w1j5MvuLwXAris=; b=K6OED5mmWW+FLIAMozisChZMQMMUACF9LuHHIPy/upSLCFaGJw5k6soOJyUWa6DSoP bmQhdzDhgrisutrzFab9mqv3CEdYRekCfmYcFXqXYNnk71q0YspIgKF4JlSNkQ6fhkUI mzVIlOYiwdcPYXoAVVfB/UYaHCOQixg28Pa5sG1VH4mssQBd75/k97vTo7HKDNYVGEHo Np9YOfNhJmONOKHqDC/rzP5etcgn/1/V0uisd4kGw6/PTUzlPZgjRLosM7Kou/kGv2ao MN7L20hV3qDDNCLdmrJl45QwRikm9rr+yZfJ9uVi8N/uAdzQ730PaNq3fP2WO2KWidzx 5qmQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id xe8-20020a170907318800b00780a240cfd7si17094253ejb.493.2022.12.07.17.42.04; Wed, 07 Dec 2022 17:42:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229728AbiLHBlI (ORCPT + 99 others); Wed, 7 Dec 2022 20:41:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229462AbiLHBlG (ORCPT ); Wed, 7 Dec 2022 20:41:06 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D09E4E432; Wed, 7 Dec 2022 17:41:05 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 27D5D61D25; Thu, 8 Dec 2022 01:41:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8D55BC433D7; Thu, 8 Dec 2022 01:41:04 +0000 (UTC) Received: from rostedt by gandalf.local.home with local (Exim 4.96) (envelope-from ) id 1p35uJ-000FST-1e; Wed, 07 Dec 2022 20:41:03 -0500 Message-ID: <20221208014103.379785784@goodmis.org> User-Agent: quilt/0.66 Date: Wed, 07 Dec 2022 20:40:42 -0500 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: "John Warthog9 Hawley" , stable@vger.kernel.org, "John Warthog9 Hawley (VMware)" Subject: [for-next][PATCH 1/2] ktest.pl minconfig: Unset configs instead of just removing them References: <20221208014041.842742311@goodmis.org> MIME-Version: 1.0 X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751608195755102340?= X-GMAIL-MSGID: =?utf-8?q?1751608195755102340?= From: Steven Rostedt After a full run of a make_min_config test, I noticed there were a lot of CONFIGs still enabled that really should not be. Looking at them, I noticed they were all defined as "default y". The issue is that the test simple removes the config and re-runs make oldconfig, which enables it again because it is set to default 'y'. Instead, explicitly disable the config with writing "# CONFIG_FOO is not set" to the file to keep it from being set again. With this change, one of my box's minconfigs went from 768 configs set, down to 521 configs set. Link: https://lkml.kernel.org/r/20221202115936.016fce23@gandalf.local.home Cc: stable@vger.kernel.org Fixes: 0a05c769a9de5 ("ktest: Added config_bisect test type") Reviewed-by: John 'Warthog9' Hawley (VMware) Signed-off-by: Steven Rostedt (Google) --- tools/testing/ktest/ktest.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl index 09d1578f9d66..d391bf7abeee 100755 --- a/tools/testing/ktest/ktest.pl +++ b/tools/testing/ktest/ktest.pl @@ -3768,9 +3768,10 @@ sub test_this_config { # .config to make sure it is missing the config that # we had before my %configs = %min_configs; - delete $configs{$config}; + $configs{$config} = "# $config is not set"; make_new_config ((values %configs), (values %keep_configs)); make_oldconfig; + delete $configs{$config}; undef %configs; assign_configs \%configs, $output_config; From patchwork Thu Dec 8 01:40:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 31105 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp506433wrr; Wed, 7 Dec 2022 17:42:35 -0800 (PST) X-Google-Smtp-Source: AA0mqf5+GAUys7RtHz55H1jjV3rxWxC8VN0dGU5rzRhiEJfUI5+NdjbHYTpbxkAeFAq4/o8n8nQa X-Received: by 2002:a17:906:3488:b0:7c1:d49:d06d with SMTP id g8-20020a170906348800b007c10d49d06dmr7037563ejb.440.1670463754875; Wed, 07 Dec 2022 17:42:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670463754; cv=none; d=google.com; s=arc-20160816; b=pGvi0AL/0/jUjPB4rkpSDgfLsVSHIj8ErLN1UMckMJ799b3HtDsf7s8W60gBZblx/g lxXG0U5vgDcDbXbmFMU/3Wv6TXKzmRIdDCQFDPqV+11592kAxq/ysJmWa9jTyUkFUjqG spMCHfgE/JeNNlYO1ijmtqJS4FlbWxMUtLatge5ELV9FwYxHifTCaiGP707GqWHsHkHo omwK3lRCZCCMyaeUAfs89uCpOWLQwBRzdgfN8oF6OhKNz0cI6qCqqX8pRes6af79WFSa 058OfBxVsk0RMNPxhq91MeECmkmVHerkaFIePHuOF3wwQs2C/zBmbYnFUgst7EDwLZsm Inwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:subject:cc:to:from:date :user-agent:message-id; bh=VFe8eBMkj5dLw8oSrwRMUquvMkfA/AazTNEjS5RJEp4=; b=R05CBz4yZyctJBoY0XKkLtzmWk95Bgw9BsIxbG5u8rDxODkwCxAJ/6RY029LSXN3Bu RSHXC/Nmt4S7UKwweocl6L7cAhI4e+uVdzlZXLUvBQtC0nMqijLr5gFSfZATvVkhyJah tURItphGrQl7nABm1RAodNqTGMPikZ4fHawji0bfyUF9XCj9RviWMkX8oNdYkn4xEb4A XehWKnCV3vkeF0npTQarjgt9G9BRig98w+MVFX/uX3+dbpxlngi4eGWKBZUWtv6Q1cCz SbMXf/ofSVRHOJwl0/Wcl9HKk+ZLG8CbeNpTCYDDy26W8V1ZpYkW0FBojdy1uNAQehXa ZSIg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jg39-20020a170907972700b007c11805a849si4080959ejc.341.2022.12.07.17.42.12; Wed, 07 Dec 2022 17:42:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229462AbiLHBlK (ORCPT + 99 others); Wed, 7 Dec 2022 20:41:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229694AbiLHBlH (ORCPT ); Wed, 7 Dec 2022 20:41:07 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB3964E695; Wed, 7 Dec 2022 17:41:05 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 50F0761D23; Thu, 8 Dec 2022 01:41:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B8A16C4347C; Thu, 8 Dec 2022 01:41:04 +0000 (UTC) Received: from rostedt by gandalf.local.home with local (Exim 4.96) (envelope-from ) id 1p35uJ-000FSx-2H; Wed, 07 Dec 2022 20:41:03 -0500 Message-ID: <20221208014103.573704155@goodmis.org> User-Agent: quilt/0.66 Date: Wed, 07 Dec 2022 20:40:43 -0500 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: "John Warthog9 Hawley" , stable@vger.kernel.org, "John Warthog9 Hawley (VMware)" Subject: [for-next][PATCH 2/2] kest.pl: Fix grub2 menu handling for rebooting References: <20221208014041.842742311@goodmis.org> MIME-Version: 1.0 X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751608202285162263?= X-GMAIL-MSGID: =?utf-8?q?1751608202285162263?= From: Steven Rostedt grub2 has submenus where to use grub-reboot, it requires: grub-reboot X>Y where X is the main index and Y is the submenu. Thus if you have: menuentry 'Debian GNU/Linux' --class debian --class gnu-linux ... [...] } submenu 'Advanced options for Debian GNU/Linux' $menuentry_id_option ... menuentry 'Debian GNU/Linux, with Linux 6.0.0-4-amd64' --class debian --class gnu-linux ... [...] } menuentry 'Debian GNU/Linux, with Linux 6.0.0-4-amd64 (recovery mode)' --class debian --class gnu-linux ... [...] } menuentry 'Debian GNU/Linux, with Linux test' --class debian --class gnu-linux ... [...] } And wanted to boot to the "Linux test" kernel, you need to run: # grub-reboot 1>2 As 1 is the second top menu (the submenu) and 2 is the third of the sub menu entries. Have the grub.cfg parsing for grub2 handle such cases. Cc: stable@vger.kernel.org Fixes: a15ba91361d46 ("ktest: Add support for grub2") Reviewed-by: John 'Warthog9' Hawley (VMware) Signed-off-by: Steven Rostedt --- tools/testing/ktest/ktest.pl | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl index d391bf7abeee..1737c59e4ff6 100755 --- a/tools/testing/ktest/ktest.pl +++ b/tools/testing/ktest/ktest.pl @@ -1963,7 +1963,7 @@ sub run_scp_mod { sub _get_grub_index { - my ($command, $target, $skip) = @_; + my ($command, $target, $skip, $submenu) = @_; return if (defined($grub_number) && defined($last_grub_menu) && $last_grub_menu eq $grub_menu && defined($last_machine) && @@ -1980,11 +1980,16 @@ sub _get_grub_index { my $found = 0; + my $submenu_number = 0; + while () { if (/$target/) { $grub_number++; $found = 1; last; + } elsif (defined($submenu) && /$submenu/) { + $submenu_number++; + $grub_number = -1; } elsif (/$skip/) { $grub_number++; } @@ -1993,6 +1998,9 @@ sub _get_grub_index { dodie "Could not find '$grub_menu' through $command on $machine" if (!$found); + if ($submenu_number > 0) { + $grub_number = "$submenu_number>$grub_number"; + } doprint "$grub_number\n"; $last_grub_menu = $grub_menu; $last_machine = $machine; @@ -2003,6 +2011,7 @@ sub get_grub_index { my $command; my $target; my $skip; + my $submenu; my $grub_menu_qt; if ($reboot_type !~ /^grub/) { @@ -2017,8 +2026,9 @@ sub get_grub_index { $skip = '^\s*title\s'; } elsif ($reboot_type eq "grub2") { $command = "cat $grub_file"; - $target = '^menuentry.*' . $grub_menu_qt; - $skip = '^menuentry\s|^submenu\s'; + $target = '^\s*menuentry.*' . $grub_menu_qt; + $skip = '^\s*menuentry'; + $submenu = '^\s*submenu\s'; } elsif ($reboot_type eq "grub2bls") { $command = $grub_bls_get; $target = '^title=.*' . $grub_menu_qt; @@ -2027,7 +2037,7 @@ sub get_grub_index { return; } - _get_grub_index($command, $target, $skip); + _get_grub_index($command, $target, $skip, $submenu); } sub wait_for_input { @@ -2090,7 +2100,7 @@ sub reboot_to { if ($reboot_type eq "grub") { run_ssh "'(echo \"savedefault --default=$grub_number --once\" | grub --batch)'"; } elsif (($reboot_type eq "grub2") or ($reboot_type eq "grub2bls")) { - run_ssh "$grub_reboot $grub_number"; + run_ssh "$grub_reboot \"'$grub_number'\""; } elsif ($reboot_type eq "syslinux") { run_ssh "$syslinux --once \\\"$syslinux_label\\\" $syslinux_path"; } elsif (defined $reboot_script) {