Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1325102

Re: [PATCH 07/14] efi: runtime-wrappers: Run UEFI Runtime Services with interrupts enabled

Path csiph.com!news.mixmin.net!feeds.phibee-telecom.net!news.panservice.it!bofh.it!news.nic.it!robomod
From Ingo Molnar <mingo@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH 07/14] efi: runtime-wrappers: Run UEFI Runtime Services with interrupts enabled
Date Wed, 03 Feb 2016 10:50:03 +0100
Message-ID <qY2ev-ew-33@gated-at.bofh.it> (permalink)
References <qXuPx-WW-3@gated-at.bofh.it> <qXuPx-WW-11@gated-at.bofh.it>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=oOi+dYxDN5Kd+FOT39T2jv2SlmoYmTnCALixckoLBRY=; b=wHIiVcA/hCKMpEkWqcrMD0y7lENFufkCC5YlXSm2RBFoIf4JFr5zyJvwIsni5/B7Ja hy2IJKC6zHpNzX1CR2wUYn8lq1Jfuyjhma5SE8+wEWxTHS8lMw4lbE7r3ST1d7/Tur9C rjMCorHgr5hqbNakooxkKtw0Q38+9z/nhiZfEu2sa3Fk99MEM5JZ3NZA7pYx7ZvUtx9x /bFQ5z5sTURphNeobyGcMp0AybNc7Mnxm5RBZYpybAMm+SCQ7JLPCDkh/2e0CYUi+a/S Wv+NprF1PhMZT7fqAch3b2zvFvaBp3HZcvQZFUQlIoOh0s/496lAK3udjuNdT6xX+znC P8nQ==
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-type:content-disposition :in-reply-to:user-agent; bh=oOi+dYxDN5Kd+FOT39T2jv2SlmoYmTnCALixckoLBRY=; b=QWBp6JBKWQX3oP5QiIP2+tnzXn2LjWhTLr9c1jP05UyTCOA0ipuueFQz2m0hbCv2AP /TMvGV+hO+JRoPSbuUceh7x21ZImCNZNoryuPRZXe8Iible7uCFsh2Dm4GqrqEEoSKEm sgKZh084vCd234CIxxYi4d/uF4K3bKJZMUdfBNDJvSMeYcUSY2QeXmoBiA9g0ixLTyHR iBpp5DRj1TIYkAbY2nRYEzF1Ub7cFWhiy0SlOr2T+ztGNYXnaOgGpdzbwBGdqJzDjJMh FYOn7kqCoGlU4lVRAX24WSgy7wbtcaeoNnKErnh8uiUByOUVS8Y8RVkG7TJDntnQ99EH npfg==
X-Gm-Message-State AG10YOR6oSMww7oqnVgazUwpmy7alfMHjMWvyunVpfTV+5AsPBWk1l1S5ASx6QAlelBLMw==
X-Received by 10.28.0.132 with SMTP id 126mr2858804wma.67.1454492624481; Wed, 03 Feb 2016 01:43:44 -0800 (PST)
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Disposition inline
User-Agent Mutt/1.5.23 (2014-03-12)
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 57
Organization linux.* mail to news gateway
X-Original-Cc "H . Peter Anvin" <hpa@zytor.com>, Thomas Gleixner <tglx@linutronix.de>, linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org, Ard Biesheuvel <ard.biesheuvel@linaro.org>, Linus Torvalds <torvalds@linux-foundation.org>, Andy Lutomirski <luto@kernel.org>, Peter Zijlstra <a.p.zijlstra@chello.nl>
X-Original-Date Wed, 3 Feb 2016 10:43:41 +0100
X-Original-Message-ID <20160203094340.GA15890@gmail.com>
X-Original-References <1454364428-494-1-git-send-email-matt@codeblueprint.co.uk> <1454364428-494-8-git-send-email-matt@codeblueprint.co.uk>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1325102

Show key headers only | View raw


* Matt Fleming <matt@codeblueprint.co.uk> wrote:

> From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> 
> The UEFI spec allows Runtime Services to be invoked with interrupts
> enabled. The only reason we were disabling interrupts was to prevent
> recursive calls into the services on the same CPU, which will lead to
> deadlock. However, the only context where such invocations may occur
> legally is from efi-pstore via efivars, and that code has been updated
> to call a non-blocking alternative when invoked from a non-interruptible
> context.
> 
> So instead, update the ordinary, blocking UEFI Runtime Services wrappers
> to execute with interrupts enabled. This aims to prevent excessive interrupt
> latencies on uniprocessor platforms with slow variable stores.

Well, those excessive latencies would affect SMP platforms as well, just that 
there are (usually) other CPUs free to do execution, right?

More fundamentally, this makes me nervous:

 > The UEFI spec allows Runtime Services to be invoked with interrupts enabled. 
 > [...]

So what really matters is not what the spec says, but how Windows executes UEFI 
firmware code in practice.

If major versions of Windows calls UEFI firmware with interrupts disabled, then 
frankly I don't think we should interrupt them under Linux either, regardless of 
what the spec says ...

Random firmware code getting interrupted by the OS changes timings and might have 
other side effects the firmware code might not expect - so the question is, does 
Windows already de facto allow the IRQ preemption of firmware calls?

Also, this:

> -	unsigned long flags;
>  	efi_status_t status;
>  
> -	spin_lock_irqsave(&efi_runtime_lock, flags);
> +	BUG_ON(in_irq());
> +
> +	spin_lock(&efi_runtime_lock);

... how does crashing the kernel help debuggability?

Please use WARN_ON_ONCE() - or in fact, this assert is probably not needed at all, 
as lockdep will warn about IRQ unsafe lock usage.

I'd add comments to the efi_runtime_lock definition site explaining that this is 
never taken from IRQ contexts.

Thanks,

	Ingo

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 07/14] efi: runtime-wrappers: Run UEFI Runtime Services with interrupts enabled Matt Fleming <matt@codeblueprint.co.uk> - 2016-02-01 23:10 +0100
  Re: [PATCH 07/14] efi: runtime-wrappers: Run UEFI Runtime Services  with interrupts enabled Ingo Molnar <mingo@kernel.org> - 2016-02-03 10:50 +0100
    Re: [PATCH 07/14] efi: runtime-wrappers: Run UEFI Runtime Services  with interrupts enabled Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-02-03 11:00 +0100
      Re: [PATCH 07/14] efi: runtime-wrappers: Run UEFI Runtime Services  with interrupts enabled Ingo Molnar <mingo@kernel.org> - 2016-02-03 12:00 +0100
        Re: [PATCH 07/14] efi: runtime-wrappers: Run UEFI Runtime Services  with interrupts enabled Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-02-03 12:40 +0100
          Re: [PATCH 07/14] efi: runtime-wrappers: Run UEFI Runtime Services  with interrupts enabled Matt Fleming <matt@codeblueprint.co.uk> - 2016-02-03 13:10 +0100
        [PATCH] efi: runtime-wrappers: run UEFI Runtime Services with interrupts enabled Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-02-04 15:00 +0100
          Re: [PATCH] efi: runtime-wrappers: run UEFI Runtime Services with  interrupts enabled Matt Fleming <matt@codeblueprint.co.uk> - 2016-02-08 16:20 +0100
          Re: [PATCH] efi: runtime-wrappers: run UEFI Runtime Services with  interrupts enabled Andy Lutomirski <luto@amacapital.net> - 2016-02-08 20:40 +0100

csiph-web