[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [XEN PATCH v2] Create a Kconfig option to set preferred reboot method


  • To: Per Bilse <per.bilse@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 6 Feb 2023 14:31:33 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Sygd243Vo/GwduwCHmg7HSqON/WDDmGlIEApJrSrGEo=; b=iEi1RspWB+Q8fo7sT+N++1t8JO01/nmYaVlnPdqn4hgdQkubdu/HH+tp9rVvuRagM1HJ/ABhjtm5jElovqjkVFPH65F3H9k0xvQJ31O2VGi1I7PQZcI31VDo78rtucpqOkSwHX0xjVkqssIYzV612mXmHsrVtwzLexPwPxQWequZif4ZMCMaSZ8JyTX53G9uCDb3yXWVAGTGl1LSW18rOBElUg3XCh6fOVt24bbM42gBar6BY24MabUDoDA0v5wp5FABFYErCGg2Xilc0duhB1i0Xw872KbS5Uz96jJ08sE5hLJ/jUcb9Fh5BOHWZ03j7nWLv78+YpnAmOAOmks59Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=I/K5a/+dRl+ocyhI78rPqhOJEZ5+Ruz4ZWEoY0t9JctM0MSIBZiHkC2bA+xhjlFOMNUGWnOPJAby5IpMj5iSCMucdg0QOMLO2zIikIGMH7J8SbuQHjhKDi7SQhX6u9kJbOFloUcJodNqpQIaEfX8usmx7K5BSPusm/XW6hgGFN7DwDst/rti/kgWFoNZMZz6FB6IJBZYMZaNFHcThhWJPEQoNJo9ccrSOy/JPYk4yJIE46WMeS/WCb3tOGPWbPgUOX8+SYs00B96KtKWJC4YaaX/uJuN/p95m9IEOy9egnQlOXHy3Cu+8KJ0tg5qRU4c/bZRBgy5KcET8oKVSL2Y3g==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Mon, 06 Feb 2023 13:31:57 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 25.01.2023 19:27, Per Bilse wrote:
> --- a/xen/arch/x86/Kconfig
> +++ b/xen/arch/x86/Kconfig
> @@ -306,6 +306,90 @@ config MEM_SHARING
>       bool "Xen memory sharing support (UNSUPPORTED)" if UNSUPPORTED
>       depends on HVM
>  
> +config REBOOT_SYSTEM_DEFAULT
> +     bool "Xen-defined reboot method"
> +     default y
> +     help
> +       Xen will choose the most appropriate reboot method,
> +       which will be a Xen SCHEDOP hypercall if running as
> +       a Xen guest, otherwise EFI, ACPI, or by way of the
> +       keyboard controller, depending on system features.
> +       Disabling this will allow you to specify how the
> +       system will be rebooted.
> +
> +choice
> +     bool "Reboot method"
> +     depends on !REBOOT_SYSTEM_DEFAULT
> +     default REBOOT_METHOD_ACPI
> +     help
> +       This is a compiled-in alternative to specifying the
> +       reboot method on the Xen command line.  Specifying a
> +       method on the command line will override both this
> +       configuration and the warm boot option below.

The way it's constructed right now, I don't think this is true. E.g.
"reboot=warm" on the command line isn't going to override "PCI"
selected here. It wouldn't even override REBOOT_WARM=n if I'm not
mistaken, as the new call to set_reboot_type() would replace what was
parsed from the command line.

> +       none    Suppress automatic reboot after panics or crashes
> +       triple  Force a triple fault (init)
> +       kbd     Use the keyboard controller
> +       acpi    Use the RESET_REG in the FADT
> +       pci     Use the so-called "PCI reset register", CF9
> +       power   Like 'pci' but for a full power-cyle reset
> +       efi     Use the EFI reboot (if running under EFI)
> +       xen     Use Xen SCHEDOP hypercall (if running under Xen as a guest)
> +
> +     config REBOOT_METHOD_NONE
> +     bool "none"

To be honest I don't consider this a reboot "method". The parsing
really should be treating this as a boolean (i.e. also permit "0",
"false", or "off"). See also "noreboot" as a further (redundant) way
of expressing that intention.

What is important here is that this control doesn't affect the normal
reboot process; it merely suppresses rebooting in case of a crash.
While I wouldn't outright nack it, I think this aspect of behavior
shouldn't be Kconfig-controlled. The more that it can only be
overridden by "no-noreboot" (or similarly off equivalents like
"noreboot=off") on the command line, which I guess you agree would be
an awkward option to use. (Personally I think we should phase out
"noreboot", as "reboot=no" has been around for long enough.)

> +     config REBOOT_METHOD_TRIPLE
> +     bool "triple"
> +
> +     config REBOOT_METHOD_KBD
> +     bool "kbd"
> +
> +     config REBOOT_METHOD_ACPI
> +     bool "acpi"
> +
> +     config REBOOT_METHOD_PCI
> +     bool "pci"
> +
> +     config REBOOT_METHOD_POWER
> +     bool "power"
> +
> +     config REBOOT_METHOD_EFI
> +     bool "efi"

For these prompts: They want to be meaningful to people seeing them.
Imo acronyms want to be upper-case (when they're in common use) or
be avoided (e.g. "kbd" -> "keyboard controller" or some such). My eye
was particularly caught by "power", where I was wondering: What does
that mean?

> +     config REBOOT_METHOD_XEN
> +     bool "xen"
> +     depends on !XEN_GUEST

Why the "!" here?

> +endchoice
> +
> +config REBOOT_METHOD
> +     string
> +     default "none"   if REBOOT_METHOD_NONE
> +     default "triple" if REBOOT_METHOD_TRIPLE
> +     default "kbd"    if REBOOT_METHOD_KBD
> +     default "acpi"   if REBOOT_METHOD_ACPI
> +     default "pci"    if REBOOT_METHOD_PCI
> +     default "Power"  if REBOOT_METHOD_POWER
> +     default "efi"    if REBOOT_METHOD_EFI
> +     default "xen"    if REBOOT_METHOD_XEN
> +
> +config REBOOT_WARM
> +     bool "Warm reboot"
> +     default n
> +     help
> +       By default the system will perform a cold reboot.
> +       Enable this to carry out a warm reboot.  This
> +       configuration will have no effect if a "reboot="
> +       string is supplied on the Xen command line; in this
> +       case the reboot string must include "warm" if a warm
> +       reboot is desired.
> +
> +config REBOOT_TEMPERATURE
> +     string
> +     default "warm" if REBOOT_WARM
> +     default "cold" if !REBOOT_WARM && !REBOOT_SYSTEM_DEFAULT

Instead of the dependency here, I think REBOOT_WARM should have a
"depends on !REBOOT_SYSTEM_DEFAULT". But I view this second control
as unnecessary anyway. All you need to do is ...

> --- a/xen/arch/x86/shutdown.c
> +++ b/xen/arch/x86/shutdown.c
> @@ -28,6 +28,19 @@
>  #include <asm/apic.h>
>  #include <asm/guest.h>
>  
> +/*
> + * We don't define a compiled-in reboot string if both method and
> + * temperature are defaults, in which case we can compile better code.
> + */
> +#ifdef CONFIG_REBOOT_METHOD
> +#define REBOOT_STR CONFIG_REBOOT_METHOD "," CONFIG_REBOOT_TEMPERATURE
> +#else
> +#ifdef CONFIG_REBOOT_TEMPERATURE
> +#define REBOOT_STR CONFIG_REBOOT_TEMPERATURE
> +#endif
> +#endif

... construct this accordingly based on REBOOT_WARM.

> @@ -42,10 +55,13 @@ enum reboot_type {
>  static int reboot_mode;
>  
>  /*
> - * reboot=t[riple] | k[bd] | a[cpi] | p[ci] | n[o] | [e]fi [, [w]arm | 
> [c]old]
> + * These constants are duplicated in full in arch/x86/Kconfig, keep in synch.
> + *
> + * reboot=t[riple] | k[bd] | a[cpi] | p[ci] | P[ower] | n[one] | [e]fi
> + *                                                     [, [w]arm | [c]old]
>   * warm   Don't set the cold reboot flag
>   * cold   Set the cold reboot flag
> - * no     Suppress automatic reboot after panics or crashes
> + * none   Suppress automatic reboot after panics or crashes

Why the change from "no" to "none"?

Jan



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.