mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ben Hutchings <ben@decadent.org.uk>
To: Matthew Garrett <matthew.garrett@nebula.com>
Cc: matt.fleming@intel.com, jwboyer@redhat.com,
	linux-efi@vger.kernel.org, seth.forshee@canonical.com,
	linux-kernel@vger.kernel.org, x86@kernel.org
Subject: Re: [PATCH 1/2] efi: Determine how much space is used by boot services-only variables
Date: Mon, 01 Apr 2013 16:42:47 +0100	[thread overview]
Message-ID: <1364830967.3557.90.camel@deadeye.wl.decadent.org.uk> (raw)
In-Reply-To: <1364829240-26475-1-git-send-email-matthew.garrett@nebula.com>

[-- Attachment #1: Type: text/plain, Size: 1704 bytes --]

On Mon, 2013-04-01 at 11:13 -0400, Matthew Garrett wrote:
> EFI variables can be flagged as being accessible only within boot services.
> This makes it awkward for us to figure out how much space they use at
> runtime. In theory we could figure this out by simply comparing the results
> from QueryVariableInfo() to the space used by all of our variables, but
> that fails if the platform doesn't garbage collect on every boot. Thankfully,
> calling QueryVariableInfo() while still inside boot services gives a more
> reliable answer. This patch passes that information from the EFI boot stub
> up to the efivars code, letting us calculate a reasonably accurate value.

Good thinking.

> Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
> ---
[...]
> --- a/arch/x86/platform/efi/efi.c
> +++ b/arch/x86/platform/efi/efi.c
> @@ -71,6 +71,10 @@ static efi_system_table_t efi_systab __initdata;
>  
>  unsigned long x86_efi_facility;
>  
> +u64 efi_var_store_size;
> +u64 efi_var_remaining_size;
> +u64 efi_var_max_var_size;
[...]
> --- a/drivers/firmware/efivars.c
> +++ b/drivers/firmware/efivars.c
[...]
> @@ -2133,6 +2158,10 @@ efivars_init(void)
>  	ops.get_next_variable = efi.get_next_variable;
>  	ops.query_variable_info = efi.query_variable_info;
>  
> +#ifdef CONFIG_X86
> +	boot_used_size = efi_var_store_size - efi_var_remaining_size;
> +#endif

efivars can be built as a module, but these aren't exported.

Ben.

>  	error = register_efivars(&__efivars, &ops, efi_kobj);
>  	if (error)
>  		goto err_put;

-- 
Ben Hutchings
DNRC Motto:  I can please only one person per day.
Today is not your day.  Tomorrow isn't looking good either.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

  parent reply	other threads:[~2013-04-01 15:43 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <515150EC.7040203@redhat.com>
2013-04-01 15:13 ` Matthew Garrett
2013-04-01 15:14   ` [PATCH 2/2] efi: Distinguish between "remaining space" and actually used space Matthew Garrett
2013-04-01 15:50     ` Ben Hutchings
2013-04-03 13:11     ` Matt Fleming
2013-04-03 13:48       ` Matthew Garrett
2013-04-03 17:12         ` Matt Fleming
2013-04-03 17:20           ` Matthew Garrett
2013-04-01 15:42   ` Ben Hutchings [this message]
2013-04-03 13:09   ` [PATCH 1/2] efi: Determine how much space is used by boot services-only variables Matt Fleming
2013-04-03 13:42     ` Matthew Garrett

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=1364830967.3557.90.camel@deadeye.wl.decadent.org.uk \
    --to=ben@decadent.org.uk \
    --cc=jwboyer@redhat.com \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matt.fleming@intel.com \
    --cc=matthew.garrett@nebula.com \
    --cc=seth.forshee@canonical.com \
    --cc=x86@kernel.org \
    /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

all inboxes | Powered by JetHome®