From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: Sai Praneeth Prakhya <sai.praneeth.prakhya@intel.com>
Cc: linux-efi@vger.kernel.org,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Chun-Yi <jlee@suse.com>, Borislav Petkov <bp@alien8.de>,
Tony Luck <tony.luck@intel.com>,
Will Deacon <will.deacon@arm.com>,
Dave Hansen <dave.hansen@intel.com>,
Mark Rutland <mark.rutland@arm.com>,
Bhupesh Sharma <bhsharma@redhat.com>,
Ricardo Neri <ricardo.neri@intel.com>,
Ravi Shankar <ravi.v.shankar@intel.com>,
Matt Fleming <matt@codeblueprint.co.uk>,
Peter Zijlstra <peter.zijlstra@intel.com>,
Dan Williams <dan.j.williams@intel.com>
Subject: Re: [PATCH V2 1/3] x86/efi: Call efi_delete_dummy_variable() during efi subsystem initialization
Date: Thu, 8 Mar 2018 07:43:23 +0000 [thread overview]
Message-ID: <CAKv+Gu_ZYGwgORet4ruL8=GUy75LMAuLeYD987FA3UVYuw8GMg@mail.gmail.com> (raw)
In-Reply-To: <1520292190-5027-2-git-send-email-sai.praneeth.prakhya@intel.com>
Hello Sai,
On 5 March 2018 at 23:23, Sai Praneeth Prakhya
<sai.praneeth.prakhya@intel.com> wrote:
> From: Sai Praneeth <sai.praneeth.prakhya@intel.com>
>
> Invoking efi_runtime_services() through efi_workqueue means all accesses
> to efi_runtime_services() should be done after efi_rts_wq has been
> created. efi_delete_dummy_variable() calls set_variable(), hence
> efi_delete_dummy_variable() should be called after efi_rts_wq has been
> created.
>
> efi_delete_dummy_variable() is called from efi_enter_virtual_mode()
> which is early in the boot phase (efi_rts_wq isn't created yet), so call
> efi_delete_dummy_variable() later in the boot phase i.e. while
> initializing efi subsystem. In the next patch, this is the place where
> we create efi_rts_wq and all the efi_runtime_services() will be called
> using efi_rts_wq.
>
> Signed-off-by: Sai Praneeth Prakhya <sai.praneeth.prakhya@intel.com>
> Suggested-by: Andy Lutomirski <luto@kernel.org>
> Cc: Lee, Chun-Yi <jlee@suse.com>
> Cc: Borislav Petkov <bp@alien8.de>
> Cc: Tony Luck <tony.luck@intel.com>
> Cc: Will Deacon <will.deacon@arm.com>
> Cc: Dave Hansen <dave.hansen@intel.com>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Cc: Bhupesh Sharma <bhsharma@redhat.com>
> Cc: Ricardo Neri <ricardo.neri@intel.com>
> Cc: Ravi Shankar <ravi.v.shankar@intel.com>
> Cc: Matt Fleming <matt@codeblueprint.co.uk>
> Cc: Peter Zijlstra <peter.zijlstra@intel.com>
> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Cc: Dan Williams <dan.j.williams@intel.com>
> ---
> arch/x86/include/asm/efi.h | 1 -
> arch/x86/platform/efi/efi.c | 6 ------
> drivers/firmware/efi/efi.c | 6 ++++++
> include/linux/efi.h | 3 +++
> 4 files changed, 9 insertions(+), 7 deletions(-)
>
> diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h
> index a399c1ebf6f0..43009e3f821b 100644
> --- a/arch/x86/include/asm/efi.h
> +++ b/arch/x86/include/asm/efi.h
> @@ -143,7 +143,6 @@ extern void __init efi_runtime_update_mappings(void);
> extern void __init efi_dump_pagetable(void);
> extern void __init efi_apply_memmap_quirks(void);
> extern int __init efi_reuse_config(u64 tables, int nr_tables);
> -extern void efi_delete_dummy_variable(void);
>
> struct efi_setup_data {
> u64 fw_vendor;
> diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
> index 9061babfbc83..a3169d14583f 100644
> --- a/arch/x86/platform/efi/efi.c
> +++ b/arch/x86/platform/efi/efi.c
> @@ -893,9 +893,6 @@ static void __init kexec_enter_virtual_mode(void)
>
> if (efi_enabled(EFI_OLD_MEMMAP) && (__supported_pte_mask & _PAGE_NX))
> runtime_code_page_mkexec();
> -
> - /* clean DUMMY object */
> - efi_delete_dummy_variable();
> #endif
> }
>
> @@ -1015,9 +1012,6 @@ static void __init __efi_enter_virtual_mode(void)
> * necessary relocation fixups for the new virtual addresses.
> */
> efi_runtime_update_mappings();
> -
> - /* clean DUMMY object */
> - efi_delete_dummy_variable();
> }
>
> void __init efi_enter_virtual_mode(void)
> diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
> index cd42f66a7c85..838b8efe639c 100644
> --- a/drivers/firmware/efi/efi.c
> +++ b/drivers/firmware/efi/efi.c
> @@ -328,6 +328,12 @@ static int __init efisubsys_init(void)
> if (!efi_enabled(EFI_BOOT))
> return 0;
>
> + /*
> + * Clean DUMMY object calls EFI Runtime Service, set_variable(), so
> + * it should be invoked only after efi_rts_workqueue is ready.
> + */
> + efi_delete_dummy_variable();
> +
Is there any way to keep this local to arch/x86?
> /* We register the efi directory at /sys/firmware/efi */
> efi_kobj = kobject_create_and_add("efi", firmware_kobj);
> if (!efi_kobj) {
> diff --git a/include/linux/efi.h b/include/linux/efi.h
> index f5083aa72eae..c4efb3ef0dfa 100644
> --- a/include/linux/efi.h
> +++ b/include/linux/efi.h
> @@ -992,6 +992,7 @@ extern efi_status_t efi_query_variable_store(u32 attributes,
> unsigned long size,
> bool nonblocking);
> extern void efi_find_mirror(void);
> +extern void efi_delete_dummy_variable(void);
> #else
> static inline void efi_late_init(void) {}
> static inline void efi_free_boot_services(void) {}
> @@ -1002,6 +1003,8 @@ static inline efi_status_t efi_query_variable_store(u32 attributes,
> {
> return EFI_SUCCESS;
> }
> +
> +static inline void efi_delete_dummy_variable(void) {}
> #endif
> extern void __iomem *efi_lookup_mapped_addr(u64 phys_addr);
>
> --
> 2.7.4
>
next prev parent reply other threads:[~2018-03-08 7:43 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-05 23:23 [PATCH V2 0/3] Use efi_rts_workqueue to invoke EFI Runtime Services Sai Praneeth Prakhya
2018-03-05 23:23 ` [PATCH V2 1/3] x86/efi: Call efi_delete_dummy_variable() during efi subsystem initialization Sai Praneeth Prakhya
2018-03-08 7:43 ` Ard Biesheuvel [this message]
2018-03-08 18:06 ` Prakhya, Sai Praneeth
2018-03-05 23:23 ` [PATCH V2 2/3] efi: Introduce efi_rts_workqueue and some infrastructure to invoke all efi_runtime_services() Sai Praneeth Prakhya
2018-03-06 11:13 ` Mark Rutland
2018-03-08 4:00 ` Prakhya, Sai Praneeth
2018-03-07 11:55 ` Miguel Ojeda
2018-03-08 4:22 ` Prakhya, Sai Praneeth
2018-03-08 9:12 ` Miguel Ojeda
2018-03-08 18:09 ` Prakhya, Sai Praneeth
2018-03-07 12:11 ` Borislav Petkov
2018-03-08 5:31 ` Prakhya, Sai Praneeth
2018-03-08 14:08 ` Borislav Petkov
2018-03-08 17:05 ` Luck, Tony
2018-03-09 10:57 ` Borislav Petkov
2018-03-09 2:37 ` Prakhya, Sai Praneeth
2018-03-09 11:11 ` Borislav Petkov
2018-03-10 0:33 ` Prakhya, Sai Praneeth
2018-03-14 17:40 ` Borislav Petkov
2018-03-08 5:38 ` Prakhya, Sai Praneeth
2018-03-05 23:23 ` [PATCH V2 3/3] efi: Use efi_rts_workqueue to invoke EFI Runtime Services Sai Praneeth Prakhya
2018-03-06 0:05 ` Dan Williams
2018-03-06 0:56 ` Prakhya, Sai Praneeth
2018-03-06 11:26 ` Mark Rutland
2018-03-08 4:11 ` Prakhya, Sai Praneeth
2018-03-08 4:33 ` Dan Williams
2018-03-08 5:06 ` Prakhya, Sai Praneeth
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAKv+Gu_ZYGwgORet4ruL8=GUy75LMAuLeYD987FA3UVYuw8GMg@mail.gmail.com' \
--to=ard.biesheuvel@linaro.org \
--cc=bhsharma@redhat.com \
--cc=bp@alien8.de \
--cc=dan.j.williams@intel.com \
--cc=dave.hansen@intel.com \
--cc=jlee@suse.com \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=matt@codeblueprint.co.uk \
--cc=peter.zijlstra@intel.com \
--cc=ravi.v.shankar@intel.com \
--cc=ricardo.neri@intel.com \
--cc=sai.praneeth.prakhya@intel.com \
--cc=tony.luck@intel.com \
--cc=will.deacon@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).