Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1225345imm; Sun, 27 May 2018 01:20:56 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqgUTuGXsr5mmdqTjWwybkSHZGlpL5bPQ1grQmuW4FKUUz79A+8wbD35yQjrAOMnzbqbBAm X-Received: by 2002:a17:902:a718:: with SMTP id w24-v6mr9354416plq.45.1527409256134; Sun, 27 May 2018 01:20:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527409256; cv=none; d=google.com; s=arc-20160816; b=eaGCwIbq4G0mDtNF9DfUXNRBObChrZxJ1JCbNt5VYjxmQhoXKFlS1yXEtg44NhHsCs C+GDABxWjouMlI8l/SL54fBFAi1iPsMH5aldAjktDpPpLyZ0/siNibFrtCsGzaufX+2x d8S7ooelmXyvz56RFlYLpQ740+ue+p9Uj8Os5QS5BUi8V7SB6yd8NLpbjU6sSowRprAm 4AoEpZO9o3W7blKqWtm/xYAp/iAMA0RmW23uCnvcsMjYDf+GlLvxCSuh1bH5OH4FR9m7 vFlKiwdHtHEkH8iMjNiTUGUwJQeamGSEQQ8PlYcO7qpjc24obXTRjZNe1yVLWWVuP6Ap YDLA== 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=UiW/SmQZm0eQuY6NPFML3ixcygWvY8eOw13RVi+h/hA=; b=mlMlhMFW4HeMdOGn3f5lTV0Y3pF/7OszjkHiT4gVZyJ1+BrMOS2Cn6VsZ+ElH2mTs/ 1LK1A//5eqDuU9NxddrGCmAB9TbG83MQFrU5E7y7x5evdOV5wZRFxfA+9lsUrdn46sUN UhkM4gOdkF3vQ+5hPD7AGCIMwjcgLGhR1uuWNxFyO5Seny7eOcQkBIPBzkEXk1we07Ts Gp9hZELMnL239nNpIbD0QmRtFzv0w8UnUz++44P8qXEuAEMRxe5kLnHWdcDEbhKQdl5s FalzX/wrSvyeeiyCAMwdJbd4mcIgVQ0nwIDQeoslw48fGStrab1M7veLOkFsTpM6hwfD 04uw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JohRsq2c; 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 g3-v6si26926076pld.309.2018.05.27.01.20.04; Sun, 27 May 2018 01:20:56 -0700 (PDT) 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=JohRsq2c; 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 S934557AbeE0ITv (ORCPT + 99 others); Sun, 27 May 2018 04:19:51 -0400 Received: from mail-it0-f68.google.com ([209.85.214.68]:35708 "EHLO mail-it0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933904AbeE0ITr (ORCPT ); Sun, 27 May 2018 04:19:47 -0400 Received: by mail-it0-f68.google.com with SMTP id q72-v6so11580550itc.0 for ; Sun, 27 May 2018 01:19:47 -0700 (PDT) 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=UiW/SmQZm0eQuY6NPFML3ixcygWvY8eOw13RVi+h/hA=; b=JohRsq2cxEoMaTuOsGdyX/ZOFxpIT7PWF/IUUzgFjv4KCP9IJIZt0fsX33G43vyNdg wBWl0r3AjrkTMwGlqaB/TrufCb90XpwAPlWMMm0Ka+6IsUrzVjgKhOxKhYlm9wkcFfD2 QlpXgE5XOt/5hnzIsy+2hd6ENdL1ro/38eKk0= 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=UiW/SmQZm0eQuY6NPFML3ixcygWvY8eOw13RVi+h/hA=; b=nC+k7/NmIH8dAPmitDGKXVxEp5C/snN4KBk922RLKTJh3R4jvtQQF8L0esHZWztuy6 KGiKMvJWZTKCtEPH2JfnmZIeJJgySfloxn3QoH3LDpwDE7bdNfoKbW4suF+98uoEFg3E v+3Bf4M8DzPVYoEAKTRiwrBTbdTxwGbaUkV3hUpkT1YWJWJDUcf3YamrxBfc3NE0NuBQ rLl67LTQ7DjsMJvkSCDFL+YL0vkUMcHX1GodOgPzmMgoPQZfOmTV2AbcAGVWD6xHR40E ZYCDuX94GilSQJR3SVY4WOQzK/1sE2WOBOCkUXo29HY7fQLILom3fI4cW94JNwRN0k4+ IZEA== X-Gm-Message-State: ALKqPwc1kDQqM09yV2Mq5y0VDRHFuZGarCtBWHixjJxNgZocHkcuLrqL 3eat8egXeHRlZlaEOXs0ZdD/QopUzli4xdBb/nIGYQ== X-Received: by 2002:a24:af45:: with SMTP id l5-v6mr7457774iti.106.1527409186946; Sun, 27 May 2018 01:19:46 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a6b:bb86:0:0:0:0:0 with HTTP; Sun, 27 May 2018 01:19:46 -0700 (PDT) In-Reply-To: References: <1527285903-31799-1-git-send-email-sai.praneeth.prakhya@intel.com> From: Ard Biesheuvel Date: Sun, 27 May 2018 10:19:46 +0200 Message-ID: Subject: Re: [PATCH V4 0/3] Use efi_rts_wq to invoke EFI Runtime Services To: "Prakhya, Sai Praneeth" Cc: "linux-efi@vger.kernel.org" , Linux Kernel Mailing List , Lee Chun-Yi , Borislav Petkov , "Luck, Tony" , Will Deacon , "Hansen, Dave" , Mark Rutland , Bhupesh Sharma , Naresh Bhat , "Neri, Ricardo" , Peter Zijlstra , "Shankar, Ravi V" , Matt Fleming , "Williams, Dan J" , Miguel Ojeda 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 On 27 May 2018 at 07:32, Prakhya, Sai Praneeth wrote: >> > Assume some user requested to execute some non-blocking variant of >> > efi_rts and the kernel hasn't called efi_call_virt() yet, but was >> > scheduled out. IOW, even though user requests for non-blocking efi call, we >> might still block. Am I right? >> > >> >> No, that is the whole point. These functions may be called from atomic context, >> which is why they trylock() and give up rather than block on the semaphore if a rt >> services call is already in progress. E.g., >> >> /* >> * efivar_entry_set_nonblocking - call set_variable_nonblocking() >> * >> * This function is guaranteed to not block and is suitable for calling >> * from crash/panic handlers. >> * >> * Crucially, this function will not block if it cannot acquire >> * efivars_lock. Instead, it returns -EBUSY. >> */ >> > > One more question again, if we are sure that non-blocking variants will > _always_ be called in atomic context, then, we got it covered. Because, in > set_variable() and query_variable_info() (both blocking and non-blocking) we check > for in_atomic() and if so, we don't use efi_rts_wq (please refer to patch 3). > > If you think, there might be a probability of calling non-blocking efi_rts out of atomic > context, then, sure! Let's make them never use efi_rts_wq. > This is not about what happens to be the current situation. It is about the API. The non-blocking functions should never block, period. They either fail gracefully or perform their duties without sleeping. In this particular case, I think it is useful to have a guaranteed non-blocking version, not only to delete the dummy EFI variable, but potentially in other future cases as well, given that they can be called much earlier in the boot (when the perf/%cr3 issue is not a concern to begin with)