public inbox for linux-efi@vger.kernel.org
 help / color / mirror / Atom feed
From: Lingzhu Xiang <lxiang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: Matthew Garrett
	<matthew.garrett-05XSO3Yj/JvQT0dZR+AlfA@public.gmane.org>
Cc: rja-sJ/iWh9BUns@public.gmane.org,
	mingo-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	torvalds-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org,
	bp-Gina5bIWoIWzQB+pC5nmwQ@public.gmane.org,
	jkosina-AlSwsSmVLrQ@public.gmane.org,
	jlee-IBi9RG/b67k@public.gmane.org,
	matt.fleming-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
	linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org,
	hpa-VuQAYsv1563Yd54FQh9/CA@public.gmane.org,
	akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org
Subject: Re: [PATCH] Modify UEFI anti-bricking code
Date: Tue, 04 Jun 2013 13:29:41 +0800	[thread overview]
Message-ID: <51AD7B45.1040603@redhat.com> (raw)
In-Reply-To: <1370117180-1712-1-git-send-email-matthew.garrett-05XSO3Yj/JvQT0dZR+AlfA@public.gmane.org>

On 06/02/2013 04:06 AM, Matthew Garrett wrote:
> This patch reworks the UEFI anti-bricking code, including an effective
> reversion of cc5a080c and 31ff2f20. It turns out that calling
> QueryVariableInfo() from boot services results in some firmware
> implementations jumping to physical addresses even after entering virtual
> mode, so until we have 1:1 mappings for UEFI runtime space this isn't
> going to work so well.
>
> Reverting these gets us back to the situation where we'd refuse to create
> variables on some systems because they classify deleted variables as "used"
> until the firmware triggers a garbage collection run, which they won't do
> until they reach a lower threshold. This results in it being impossible to
> install a bootloader, which is unhelpful.
>
> Feedback from Samsung indicates that the firmware doesn't need more than
> 5KB of storage space for its own purposes, so that seems like a reasonable
> threshold. However, there's still no guarantee that a platform will attempt
> garbage collection merely because it drops below this threshold. It seems
> that this is often only triggered if an attempt to write generates a
> genuine EFI_OUT_OF_RESOURCES error. We can force that by attempting to
> create a variable larger than the remaining space. This should fail, but if
> it somehow succeeds we can then immediately delete it.
>
> I've tested this on the UEFI machines I have available, but I don't have
> a Samsung and so can't verify that it avoids the bricking problem.

This patch works well on my Dell Windows 8 logo machine.

This Dell machine will use up ~2K nvram space on each reboot and do 
garbage collection at boot time when full. With the new 5K threshold, it 
is only a few reboots away from boot time garbage collection anyway.

Run time garbage collection also works. But the write takes 5 seconds.


Lingzhu Xiang

      parent reply	other threads:[~2013-06-04  5:29 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-01 20:06 [PATCH] Modify UEFI anti-bricking code Matthew Garrett
2013-06-03 12:17 ` Matt Fleming
2013-06-03 14:58   ` Matthew Garrett
2013-06-03 16:13 ` joeyli
2013-06-03 16:31   ` Matthew Garrett
     [not found]     ` <1370277079.6315.14.camel-+5W/JHIUVxg@public.gmane.org>
2013-06-04  3:35       ` joeyli
2013-06-05 14:49         ` Fleming, Matt
     [not found]           ` <CAL01qptzxe5L6Vq+nBZLq+bQNxbe_i_2OdKMNJGZQDfMihaHOw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-06-05 14:53             ` Matthew Garrett
     [not found]               ` <1370444007.6315.32.camel-+5W/JHIUVxg@public.gmane.org>
2013-06-05 15:59                 ` Matt Fleming
     [not found]                   ` <20130605155904.GC30420-HNK1S37rvNbeXh+fF434Mdi2O/JbrIOy@public.gmane.org>
2013-06-05 16:08                     ` Matthew Garrett
     [not found]                       ` <1370448519.6315.36.camel-+5W/JHIUVxg@public.gmane.org>
2013-06-05 19:59                         ` Matt Fleming
2013-06-06  2:24                       ` joeyli
2013-06-05 20:19                     ` H. Peter Anvin
2013-06-06  5:05                     ` joeyli
2013-06-06  5:41                       ` joeyli
2013-06-06  5:42                       ` Matthew Garrett
     [not found]                         ` <1370497321.6315.44.camel-+5W/JHIUVxg@public.gmane.org>
2013-06-06  7:40                           ` joeyli
     [not found]                             ` <1370504426.6523.49.camel-ONCj+Eqt86TasUa73XJKwA@public.gmane.org>
2013-06-06  9:25                               ` Matt Fleming
     [not found]                                 ` <20130606092542.GE30420-HNK1S37rvNbeXh+fF434Mdi2O/JbrIOy@public.gmane.org>
2013-06-06 14:48                                   ` Russ Anderson
     [not found]                                     ` <20130606144846.GA10393-sJ/iWh9BUns@public.gmane.org>
2013-06-06 15:00                                       ` Matt Fleming
     [not found]                                         ` <20130606150039.GL30420-HNK1S37rvNbeXh+fF434Mdi2O/JbrIOy@public.gmane.org>
2013-06-06 15:28                                           ` Russ Anderson
2013-06-10 18:54                                   ` Russ Anderson
     [not found] ` <1370117180-1712-1-git-send-email-matthew.garrett-05XSO3Yj/JvQT0dZR+AlfA@public.gmane.org>
2013-06-02 15:48   ` Russ Anderson
2013-06-04  5:29   ` Lingzhu Xiang [this message]

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=51AD7B45.1040603@redhat.com \
    --to=lxiang-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
    --cc=akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org \
    --cc=bp-Gina5bIWoIWzQB+pC5nmwQ@public.gmane.org \
    --cc=hpa-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
    --cc=jkosina-AlSwsSmVLrQ@public.gmane.org \
    --cc=jlee-IBi9RG/b67k@public.gmane.org \
    --cc=linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=matt.fleming-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=matthew.garrett-05XSO3Yj/JvQT0dZR+AlfA@public.gmane.org \
    --cc=mingo-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=rja-sJ/iWh9BUns@public.gmane.org \
    --cc=tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org \
    --cc=torvalds-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org \
    --cc=x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.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