Received: by 10.223.185.116 with SMTP id b49csp6008317wrg; Wed, 7 Mar 2018 23:45:03 -0800 (PST) X-Google-Smtp-Source: AG47ELvUBirHElWC3YeAWzWiga9awRTs5gHjIrs5i+3hEYrCJFJPIcYsdu7pHFTvWus0Z7keFY7d X-Received: by 2002:a17:902:70c5:: with SMTP id l5-v6mr3164484plt.13.1520495103558; Wed, 07 Mar 2018 23:45:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520495103; cv=none; d=google.com; s=arc-20160816; b=CDKJ0aheC+/TBlzO8vnnBCj7hb3jC2yZQqh6P3UfxatC27RuSzaS8RusVaPoB0t+a7 66MRpBmckNyA4Nn7BW7r1WhqrPqKdwAg6IbhIGYinN2P++hmi3QI08XISIWOEFWXbmHw i9xO1Z8VaccROv9HV5kYZT0U1gymrCZMmjBqNgIlwW4JwQD+xIrUlCkBadSYPNd+pOaj 7i8ZInGD71DCazztcb88f48KC0ykq+ijFn36UkOhi4VayhUh//HJTYtkEGpqD5HHGCHv bXJgWuBoWhOB8PVCCtshFa9oI1/MjHKIZBXRZcgjUeLi+7K6FxntFUMS3TL9fe6U3B8x ZjSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=NKSXE7ISep5SzALVt6+B95gYfcsvB0TN6kpptV/FyXY=; b=xEpPdRcPESrB3IaoWQfPP8CgauN90+AVI3neMePagQXGatr98Qe8nxi+n6kbY7XkvQ H7utdf+PVFr33sC6YXyHHI10Sl4qn5DMltkRMrrAzNqGBvMQ43wb4gXXka0KYDETlSTv AD9Z8YtDioUdhPhkqIG/nMfnMUaS0s3jOD3BnPA7+bveQPzvgakMS1nzcoyLUApx5YKC LBaPNVN97yLOAbfkIEhULKyIsmqRGPlimuuHHlLGPg+7i+ZF7VU+qSpniflGLG7lMMd3 5BdvXRUhu5htOhzxDrG1p5bYYTDHn2EBCwKAuEhLqmrYyCHI26qemH9sdp8sgOdBmxAF edFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=C1xn+DLS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j186si12448028pge.747.2018.03.07.23.44.49; Wed, 07 Mar 2018 23:45:03 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=C1xn+DLS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935313AbeCHHna (ORCPT + 99 others); Thu, 8 Mar 2018 02:43:30 -0500 Received: from mail-it0-f67.google.com ([209.85.214.67]:40742 "EHLO mail-it0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935202AbeCHHnZ (ORCPT ); Thu, 8 Mar 2018 02:43:25 -0500 Received: by mail-it0-f67.google.com with SMTP id e64so6776639ita.5 for ; Wed, 07 Mar 2018 23:43:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=NKSXE7ISep5SzALVt6+B95gYfcsvB0TN6kpptV/FyXY=; b=C1xn+DLS08XkTo0xj94Fy4hxEHveJSBKOH+xG+AF/vBK3MZkUSQJSkAq46aOJ6V5TL 8v9IkhBvkmkdutrdi1eKJLAZTzTYJ+rmzfUBhgtPJKTlOeBKbLER7LSR8wkBhsFUSl1Q 64WhwxPhRJ1mLwS4L3E5eR2iUOGpjaDHrJagc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=NKSXE7ISep5SzALVt6+B95gYfcsvB0TN6kpptV/FyXY=; b=Yr/u9Mj9A8wrG+SyqjdRFTd2Lu4pQiJQQHU9trzbT10JOu6NvT6hnuP+jJHeIQm2Jd LQK2/gEwP7EBCrT4rPdnDzs29LaKKFfKvP+g6+cNlVU8cK0BZ6D4VdPAAGHtgu6rSDRP 4TkoLiFmB2X0Go0ePyVCIGlbLNkEnUp68wuns/YCk/dwlQraMmM0B9CW/RC+iS6lC1so MrPhXciwipEJG15v5JmMFK9fYtmOS5zGo87Lp3T3Cjj8sGVXhspp2khWvQoAEzXopaq/ h9zFHDiwy36BD9445aPJfWcURMBihZ5gZiGnJq+yEyKMyGq+21JVaIieH6tq3jiph4rt C/JQ== X-Gm-Message-State: AElRT7FMYTc9NwCcoUnby1+eM3IH7SLYLTrRMz0NHr9PJMooRcRGWnjZ xIoBLxPkMlEh40JVI4mLKQZQ8D2lD13YO7RT7XBTsg== X-Received: by 10.36.217.22 with SMTP id p22mr26757539itg.106.1520495004284; Wed, 07 Mar 2018 23:43:24 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.138.209 with HTTP; Wed, 7 Mar 2018 23:43:23 -0800 (PST) In-Reply-To: <1520292190-5027-2-git-send-email-sai.praneeth.prakhya@intel.com> References: <1520292190-5027-1-git-send-email-sai.praneeth.prakhya@intel.com> <1520292190-5027-2-git-send-email-sai.praneeth.prakhya@intel.com> From: Ard Biesheuvel Date: Thu, 8 Mar 2018 07:43:23 +0000 Message-ID: Subject: Re: [PATCH V2 1/3] x86/efi: Call efi_delete_dummy_variable() during efi subsystem initialization To: Sai Praneeth Prakhya Cc: linux-efi@vger.kernel.org, Linux Kernel Mailing List , Chun-Yi , Borislav Petkov , Tony Luck , Will Deacon , Dave Hansen , Mark Rutland , Bhupesh Sharma , Ricardo Neri , Ravi Shankar , Matt Fleming , Peter Zijlstra , Dan Williams Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello Sai, On 5 March 2018 at 23:23, Sai Praneeth Prakhya wrote: > From: Sai Praneeth > > 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 > Suggested-by: Andy Lutomirski > Cc: Lee, Chun-Yi > Cc: Borislav Petkov > Cc: Tony Luck > Cc: Will Deacon > Cc: Dave Hansen > Cc: Mark Rutland > Cc: Bhupesh Sharma > Cc: Ricardo Neri > Cc: Ravi Shankar > Cc: Matt Fleming > Cc: Peter Zijlstra > Cc: Ard Biesheuvel > Cc: Dan Williams > --- > 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 >