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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9139AC25B06 for ; Sun, 14 Aug 2022 15:53:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242084AbiHNPxt (ORCPT ); Sun, 14 Aug 2022 11:53:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241909AbiHNPui (ORCPT ); Sun, 14 Aug 2022 11:50:38 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8ED416594; Sun, 14 Aug 2022 08:35:57 -0700 (PDT) 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 50F0060DBC; Sun, 14 Aug 2022 15:35:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C02C5C433D6; Sun, 14 Aug 2022 15:35:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1660491356; bh=CGpqeaQ+Kv576NDKhkFcAltFTpaVpI9mO0acYBIYJCk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vOh/cR01gCHvFHP6KPLCTL7aolwwCvSSDqph1ChfE8M1c0uEbESz5JkuPnuNI5DBp IJlQurDPW4MqsF6RzF85N7QYYPtLywPWOlwzZE6su7YcFMJxxEcNhsTfZLvVgJsxjV Daw0YTM6/gVJjuMvIJ5vwaivbdwknrpx0MAhnBNYXgpOo+az/3ECzmRtJ7y1YxRaO7 7Umiz7IxU+6gyB6Zs+ekNbAxmQF9msDFPZPi9scbQIJoXYStKF1f8fUhhCXZL/FDf1 MQY4fUh6RuCohzBXqndiul2cZp04NJNPu749E5UQ5Ztr42TUA5BLyrPIIJbtO0HtAJ kHJH7DwxHbh/w== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: "Jason A. Donenfeld" , Richard Weinberger , Sasha Levin , anton.ivanov@cambridgegreys.com, johannes@sipsolutions.net, linux@roeck-us.net, linux-um@lists.infradead.org Subject: [PATCH AUTOSEL 5.4 14/21] um: add "noreboot" command line option for PANIC_TIMEOUT=-1 setups Date: Sun, 14 Aug 2022 11:35:24 -0400 Message-Id: <20220814153531.2379705-14-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220814153531.2379705-1-sashal@kernel.org> References: <20220814153531.2379705-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "Jason A. Donenfeld" [ Upstream commit dda520d07b95072a0b63f6c52a8eb566d08ea897 ] QEMU has a -no-reboot option, which halts instead of reboots when the guest asks to reboot. This is invaluable when used with CONFIG_PANIC_TIMEOUT=-1 (and panic_on_warn), because it allows panics and warnings to be caught immediately in CI. Implement this in UML too, by way of a basic setup param. Signed-off-by: Jason A. Donenfeld Signed-off-by: Richard Weinberger Signed-off-by: Sasha Levin --- arch/um/os-Linux/skas/process.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c index 4fb877b99dde..0571cc0a30fc 100644 --- a/arch/um/os-Linux/skas/process.c +++ b/arch/um/os-Linux/skas/process.c @@ -5,6 +5,7 @@ */ #include +#include #include #include #include @@ -641,10 +642,24 @@ void halt_skas(void) UML_LONGJMP(&initial_jmpbuf, INIT_JMP_HALT); } +static bool noreboot; + +static int __init noreboot_cmd_param(char *str, int *add) +{ + noreboot = true; + return 0; +} + +__uml_setup("noreboot", noreboot_cmd_param, +"noreboot\n" +" Rather than rebooting, exit always, akin to QEMU's -no-reboot option.\n" +" This is useful if you're using CONFIG_PANIC_TIMEOUT in order to catch\n" +" crashes in CI\n"); + void reboot_skas(void) { block_signals_trace(); - UML_LONGJMP(&initial_jmpbuf, INIT_JMP_REBOOT); + UML_LONGJMP(&initial_jmpbuf, noreboot ? INIT_JMP_HALT : INIT_JMP_REBOOT); } void __switch_mm(struct mm_id *mm_idp) -- 2.35.1