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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 4BBDAC4361B for ; Wed, 16 Dec 2020 04:47:07 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id DFCF423159 for ; Wed, 16 Dec 2020 04:47:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DFCF423159 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 71C358D001D; Tue, 15 Dec 2020 23:47:06 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 67CBE8D0015; Tue, 15 Dec 2020 23:47:06 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4F9768D001D; Tue, 15 Dec 2020 23:47:06 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0079.hostedemail.com [216.40.44.79]) by kanga.kvack.org (Postfix) with ESMTP id 2DC928D0015 for ; Tue, 15 Dec 2020 23:47:06 -0500 (EST) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id F3A10362D for ; Wed, 16 Dec 2020 04:47:05 +0000 (UTC) X-FDA: 77597910810.25.spot90_180b16b27429 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin25.hostedemail.com (Postfix) with ESMTP id CE8CB1804E3A0 for ; Wed, 16 Dec 2020 04:47:05 +0000 (UTC) X-HE-Tag: spot90_180b16b27429 X-Filterd-Recvd-Size: 3204 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf40.hostedemail.com (Postfix) with ESMTP for ; Wed, 16 Dec 2020 04:47:05 +0000 (UTC) Date: Tue, 15 Dec 2020 20:47:04 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1608094024; bh=5kN3OZnU4pcthwYVmgnzQX1BKNbruHBO9k1h3LNYzgI=; h=From:To:Subject:In-Reply-To:From; b=M9wCZyqjrgICArEMLMR8bo67pzUNejgVrFqGO1Di/9+lPcfb3c6DkGMePZ7P0GfyS Dz9n4DDFrtqKvd5dXNDHk5W5jTQe4tebt0ju9w6cMzvsdmGzRXBh42fEIHzpYJCLaT mPYGb6H+b1+wkbfDQjRRucqoNOksBV4NaV7gm01s= From: Andrew Morton To: akpm@linux-foundation.org, linux-mm@kvack.org, mcroce@microsoft.com, mm-commits@vger.kernel.org, pmladek@suse.com, torvalds@linux-foundation.org Subject: [patch 86/95] reboot: allow to override reboot type if quirks are found Message-ID: <20201216044704.nKpPeHcLz%akpm@linux-foundation.org> In-Reply-To: <20201215204156.f05ec694b907845bcfab5c44@linux-foundation.org> User-Agent: s-nail v14.8.16 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: Matteo Croce Subject: reboot: allow to override reboot type if quirks are found Patch series "reboot: sysfs improvements". Some improvements to the sysfs reboot interface: hide not working settings and support machines with known reboot quirks. This patch (of 2): On some machines a quirk can force a specific reboot type. Quirks are found during a DMI scan, the list of machines which need special reboot handling is defined in reboot_dmi_table. The kernel command line reboot= option overrides this via a global variable `reboot_default`, so that the reboot type requested in the command line is really performed. This was not true when setting the reboot type via the new sysfs interface. Fix this by setting reboot_default upon the first change, like reboot_setup() does for the command line. Link: https://lkml.kernel.org/r/20201130173717.198952-1-mcroce@linux.microsoft.com Link: https://lkml.kernel.org/r/20201130173717.198952-2-mcroce@linux.microsoft.com Signed-off-by: Matteo Croce Reviewed-by: Petr Mladek Signed-off-by: Andrew Morton --- kernel/reboot.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/kernel/reboot.c~reboot-allow-to-override-reboot-type-if-quirks-are-found +++ a/kernel/reboot.c @@ -662,6 +662,8 @@ static ssize_t mode_store(struct kobject else return -EINVAL; + reboot_default = 0; + return count; } static struct kobj_attribute reboot_mode_attr = __ATTR_RW(mode); @@ -716,6 +718,8 @@ static ssize_t type_store(struct kobject else return -EINVAL; + reboot_default = 0; + return count; } static struct kobj_attribute reboot_type_attr = __ATTR_RW(type); @@ -741,6 +745,7 @@ static ssize_t cpu_store(struct kobject if (cpunum >= num_possible_cpus()) return -ERANGE; + reboot_default = 0; reboot_cpu = cpunum; return count; @@ -762,6 +767,7 @@ static ssize_t force_store(struct kobjec if (kstrtobool(buf, &res)) return -EINVAL; + reboot_default = 0; reboot_force = res; return count; _