Re: [RFC][Patch]efi_pstore:Introduce an efi_pstore_overwrite parameter to avoid missing messages in NVRAM

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

 



On Wed, Jun 13, 2012 at 6:42 AM, Seiji Aguchi <seiji.aguchi@xxxxxxx> wrote:
>
>    Currently, efi_pstore driver simply overwrites existing panic messages in NVRAM.
>    So, in the following scenario, we will lose 1st panic messages.
>
>    1. kernel panics.
>    2. efi_pstore is kicked and writes panic messages to NVRAM.
>    3. system shutdowns and boots up.
>    4. kernel panics again before a user checks the 1st panic messages in NVRAM.
>
>
>    To avoid missing 1st panic messages, this patch adds a new parameter ,efi_pstore_overwrite,
>    to efi_pstore so that we can specify whether efi_pstore overwrites existing entries in NVRAM or not.
>
>
>  Signed-off-by: Seiji Aguchi <seiji.aguchi@xxxxxxx>


Acked-by: Mike Waychison <mikew@xxxxxxxxxx>

>
> ---
>  Documentation/kernel-parameters.txt |    6 ++++
>  drivers/firmware/efivars.c          |   55 +++++++++++++++++++---------------
>  2 files changed, 37 insertions(+), 24 deletions(-)
>
> diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
> index a92c5eb..990befa 100644
> --- a/Documentation/kernel-parameters.txt
> +++ b/Documentation/kernel-parameters.txt
> @@ -786,6 +786,12 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
>        edd=            [EDD]
>                        Format: {"off" | "on" | "skip[mbr]"}
>
> +       efivars.efi_pstore_overwrite=
> +                       Specify whether efi_pstore overwrites existing entries
> +                       in NVRAM
> +                       Format: <bool>  (1/Y/y=yes, 0/N/n=no)
> +                       default: yes
> +
>        eisa_irq_edge=  [PARISC,HW]
>                        See header of drivers/parisc/eisa.c.
>
> diff --git a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c index 47408e8..94fbd1d 100644
> --- a/drivers/firmware/efivars.c
> +++ b/drivers/firmware/efivars.c
> @@ -685,6 +685,10 @@ static ssize_t efi_pstore_read(u64 *id, enum pstore_type_id *type,
>        return 0;
>  }
>
> +static bool efi_pstore_overwrite = 1;
> +module_param_named(efi_pstore_overwrite, efi_pstore_overwrite,
> +                  bool, S_IRUGO | S_IWUSR);
> +
>  static int efi_pstore_write(enum pstore_type_id type,
>                enum kmsg_dump_reason reason, u64 *id,
>                unsigned int part, size_t size, struct pstore_info *psi) @@ -705,33 +709,36 @@ static int efi_pstore_write(enum pstore_type_id type,
>        for (i = 0; i < DUMP_NAME_LEN; i++)
>                efi_name[i] = stub_name[i];
>
> -       /*
> -        * Clean up any entries with the same name
> -        */
> +       if (efi_pstore_overwrite) {
> +               /*
> +                * Clean up any entries with the same name
> +                */
> +
> +               list_for_each_entry(entry, &efivars->list, list) {
> +                       get_var_data_locked(efivars, &entry->var);
> +
> +                       if (efi_guidcmp(entry->var.VendorGuid, vendor))
> +                               continue;
> +                       if (utf16_strncmp(entry->var.VariableName, efi_name,
> +                                         utf16_strlen(efi_name)))
> +                               continue;
> +                       /* Needs to be a prefix */
> +                       if (entry->var.VariableName[utf16_strlen(efi_name)]
> +                           == 0)
> +                               continue;
> +
> +                       /* found */
> +                       found = entry;
> +                       efivars->ops->set_variable(entry->var.VariableName,
> +                                                  &entry->var.VendorGuid,
> +                                                  PSTORE_EFI_ATTRIBUTES,
> +                                                  0, NULL);
> +               }
>
> -       list_for_each_entry(entry, &efivars->list, list) {
> -               get_var_data_locked(efivars, &entry->var);
> -
> -               if (efi_guidcmp(entry->var.VendorGuid, vendor))
> -                       continue;
> -               if (utf16_strncmp(entry->var.VariableName, efi_name,
> -                                 utf16_strlen(efi_name)))
> -                       continue;
> -               /* Needs to be a prefix */
> -               if (entry->var.VariableName[utf16_strlen(efi_name)] == 0)
> -                       continue;
> -
> -               /* found */
> -               found = entry;
> -               efivars->ops->set_variable(entry->var.VariableName,
> -                                          &entry->var.VendorGuid,
> -                                          PSTORE_EFI_ATTRIBUTES,
> -                                          0, NULL);
> +               if (found)
> +                       list_del(&found->list);
>        }
>
> -       if (found)
> -               list_del(&found->list);
> -
>        for (i = 0; i < DUMP_NAME_LEN; i++)
>                efi_name[i] = name[i];
>
> --
> 1.7.1
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux