From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Ross Lagerwall <ross.lagerwall@citrix.com>, xen-devel@lists.xen.org
Cc: Stefano Stabellini <stefano.stabellini@citrix.com>,
Keir Fraser <keir@xen.org>,
Ian Campbell <ian.campbell@citrix.com>,
Jan Beulich <jbeulich@suse.com>, Tim Deegan <tim@xen.org>
Subject: Re: [PATCH v3 2/2] efi: Avoid calling boot services after ExitBootServices()
Date: Mon, 1 Jun 2015 11:26:43 +0100 [thread overview]
Message-ID: <556C3363.3020404@citrix.com> (raw)
In-Reply-To: <1433153878-32199-2-git-send-email-ross.lagerwall@citrix.com>
On 01/06/15 11:17, Ross Lagerwall wrote:
> After the first call to ExitBootServices(), avoid calling any boot
> services by setting setting efi_bs to NULL and entering an infinite loop
> in blexit().
>
> Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
> ---
> xen/common/efi/boot.c | 16 +++++++++++++---
> 1 file changed, 13 insertions(+), 3 deletions(-)
>
> diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c
> index 60c1b8d..5c5c158 100644
> --- a/xen/common/efi/boot.c
> +++ b/xen/common/efi/boot.c
> @@ -216,6 +216,12 @@ static void __init noreturn blexit(const CHAR16 *str)
> PrintStr((CHAR16 *)str);
> PrintStr(newline);
>
> + if ( !efi_bs )
> + {
> + for ( ; ; )
> + ;
At the very least this should be halt() to avoid spinning in a busy
loop, and probably with a local_irq_disable() ahead of the for.
~Andrew
> + }
> +
> if ( cfg.addr )
> efi_bs->FreePages(cfg.addr, PFN_UP(cfg.size));
> if ( kernel.addr )
> @@ -1063,8 +1069,10 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
> for ( retry = 0; ; retry = 1 )
> {
> efi_memmap_size = map_alloc_size;
> - status = efi_bs->GetMemoryMap(&efi_memmap_size, efi_memmap, &map_key,
> - &efi_mdesc_size, &mdesc_ver);
> + status = SystemTable->BootServices->GetMemoryMap(&efi_memmap_size,
> + efi_memmap, &map_key,
> + &efi_mdesc_size,
> + &mdesc_ver);
> if ( EFI_ERROR(status) )
> PrintErrMesg(L"Cannot obtain memory map", status);
>
> @@ -1073,7 +1081,9 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
>
> efi_arch_pre_exit_boot();
>
> - status = efi_bs->ExitBootServices(ImageHandle, map_key);
> + status = SystemTable->BootServices->ExitBootServices(ImageHandle,
> + map_key);
> + efi_bs = NULL;
> if ( status != EFI_INVALID_PARAMETER || retry )
> break;
> }
next prev parent reply other threads:[~2015-06-01 10:26 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-01 10:17 [PATCH v3 1/2] efi: Fix allocation problems if ExitBootServices() fails Ross Lagerwall
2015-06-01 10:17 ` [PATCH v3 2/2] efi: Avoid calling boot services after ExitBootServices() Ross Lagerwall
2015-06-01 10:26 ` Andrew Cooper [this message]
2015-06-01 10:48 ` Jan Beulich
2015-06-01 11:10 ` [PATCH v3 1/2] efi: Fix allocation problems if ExitBootServices() fails Jan Beulich
2015-06-01 11:24 ` Ian Campbell
2015-06-01 21:20 ` Roy Franz
2015-06-02 8:30 ` Ian Campbell
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=556C3363.3020404@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=ian.campbell@citrix.com \
--cc=jbeulich@suse.com \
--cc=keir@xen.org \
--cc=ross.lagerwall@citrix.com \
--cc=stefano.stabellini@citrix.com \
--cc=tim@xen.org \
--cc=xen-devel@lists.xen.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.