Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp312575imm; Fri, 25 May 2018 23:33:18 -0700 (PDT) X-Google-Smtp-Source: AB8JxZokYd1pOCJbb62E2FC8N1znRxrGSkXz+FTY+FrT5ZCzsfrceGGNWqtL7E2FJiUdMXiCkAyf X-Received: by 2002:a17:902:8f82:: with SMTP id z2-v6mr5483909plo.350.1527316398135; Fri, 25 May 2018 23:33:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527316398; cv=none; d=google.com; s=arc-20160816; b=auE/s13GrWdcpw/HpbVp3kM9C4uj0+Ohk6903lC4b+AEw1LNE9sz4QXSvbhZKrRUEi Mz4YN5RPgVYy9mZfs8dQ5h6lscZ6BjeMNo6wH0vXSw7mBeRXMcYLIKZYpTOF04sCGEcE wwXWnEepkskeog+Xm5gNGaHCwq1vcTO9dZWui/DPOQ/1D7v0iX0UwD77brh9gWXoEqeH iOhRwTH9eRKPdPRDejPinubtu//niUYI+Rm8p0kkMelzE2+VWoiE+Gg4mOArAx+HjZOC EYNF9IhcJIsNJZhr61zuSUpPuBNL03q9RNNwKDuesx6uXKtJZANTb01VGXbpsDx5lh/F ENyA== 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=V84G9sBAjUiWoLfh79Qb+dSR4PEaMOsUrIoNxI1ltv8=; b=eVr2goVxCbJZZEWtoh2j6wy3m8mKXVRjgMIqFtRjMqyscF6dTvCUs0xy5Mh3hZ20G0 7mYVuKP1OHV9noCS9EW4GQTZ48P2FF15FDyD5UBpaCVNVGcvAvUtc/44O5fvBhVdCEYk +2GFKBe+ApBJ2K74hlziNJuiBTTHX7sL4J8SAU+Y0KpDogc/g2UiMX7rv8rnWhrHPnVg 8ys/CkI9cSxJvHpOlnr6faPI4gAzBPpbvvXQbfOIxmE99AE1rTqmDLas2UfTKgiVk7Ik kRAzvRjONqvcH6Vdon+q6QqMUh0xj/D2mCy7MVPiNacpvZAex1JQfjEVT17Cvxq9u1pg 7YRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LTTqilJB; 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 t200-v6si554738pgb.553.2018.05.25.23.32.49; Fri, 25 May 2018 23:33:18 -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=LTTqilJB; 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 S1031171AbeEZGcj (ORCPT + 99 others); Sat, 26 May 2018 02:32:39 -0400 Received: from mail-it0-f66.google.com ([209.85.214.66]:38917 "EHLO mail-it0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1031131AbeEZGci (ORCPT ); Sat, 26 May 2018 02:32:38 -0400 Received: by mail-it0-f66.google.com with SMTP id c3-v6so9374063itj.4 for ; Fri, 25 May 2018 23:32:38 -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=V84G9sBAjUiWoLfh79Qb+dSR4PEaMOsUrIoNxI1ltv8=; b=LTTqilJBNKCIDGPjr2kZMAWsyh7foqNY1DRLi3+Vucq4gUz6A9ptcy4raK5dBxkImu E8dOQ9wXYbIcMe6dZGM4CG7rN0JsylVcfBSr1wY0GQvpKUd1IPNGROaEMEmnIy1Ewr0b v6AZnRyGVewksFvxG/kwMeXijdsm/WhRiIx3Q= 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=V84G9sBAjUiWoLfh79Qb+dSR4PEaMOsUrIoNxI1ltv8=; b=TKPRhciylsAPxGBQipq/R9aqyiC/mMhwxeQSS9UWSmdii/sRve7WtBym8NAJ6o0mCf mEWXY6BPmgK1oZ5gvSQhPjQzey/H5k/BRunjLj/dyjTW1iMXCfDkFEt0r5qjdnSlXF0b H5Vxms8ZcKFDRFXhbzLTwV5oHywDa7GZU82YTdhu5cjurTmGICGbkpSBqqqlWZ4lm1Lq 2TaNEsQpkPDEnUxEQLs8EPPoAMI/0oE1A5NZX0ZD4NUELEcjG+62BPMRzOBwIQ9yvXgM SoCjOVZz525zdgw1NU20abwyhH+wJiCA6LBWhsJ58lAm1U7ZA41IL4QY4fzJRW3c8NwW Uppg== X-Gm-Message-State: ALKqPwdOgaPAEcmKQrNKdWlPp8jtMEAE66DDDkzI8MIQD0nJNaUGdNon 8wwMSByi4sttDF3CmQJXukolMtReO0e85rQYibe1gQ== X-Received: by 2002:a24:5390:: with SMTP id n138-v6mr4534798itb.42.1527316357812; Fri, 25 May 2018 23:32:37 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a6b:bb86:0:0:0:0:0 with HTTP; Fri, 25 May 2018 23:32:37 -0700 (PDT) In-Reply-To: References: <1527285903-31799-1-git-send-email-sai.praneeth.prakhya@intel.com> From: Ard Biesheuvel Date: Sat, 26 May 2018 08:32:37 +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 26 May 2018 at 01:08, Prakhya, Sai Praneeth wrote: >> > Changes from V3 to V4: >> > ---------------------- >> > 1. As suggested by Peter, use completions instead of flush_work() as the >> > former is cheaper >> > 2. Call efi_delete_dummy_variable() from efisubsys_init(). Sorry! Ard, >> > wasn't able to find a better alternative to keep this change local to >> > arch/x86. >> > >> >> Two questions: >> - Should the non-blocking variants of the query and set_variable_store use the >> work queue? Doesn't that make them blocking? > > That's a good question . I think you are right, calling non-blocking variants of efi_rts > using work queues makes them blocking. But, I have a follow on question. > > 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. */ > With efi_rts_wq, I think, I have increased the window of getting blocked. With efi_rts_wq, > kernel should explicitly call schedule() to run firmware and the chances of getting blocked > are much more. > > Expect this increased window, I think firmware should be executed as before. > > So, can you please explain me the difference between blocking and non-blocking variants > from kernel perspective? > (the way we get locks are different down_interruptible() vs down_trylock()) > >> - If the non-blocking set_variable() does not use the work queue, can we just call >> it from efi_delete_dummy_variable(), and keep the calls where they are? > > Yes, I think we can do that (if we don't use efi_rts_wq for non-blocking variants). > OK, then please implement that change. Thanks, Ard.