Received: by 10.223.185.116 with SMTP id b49csp6081168wrg; Thu, 8 Mar 2018 01:15:13 -0800 (PST) X-Google-Smtp-Source: AG47ELsn5GySs0GH2qPU/J/lIogzauO7Wbyxa+D/BfPJk4VUEAZaMVe+Su4zaZm/tWz3uZK3UeEB X-Received: by 2002:a17:902:b582:: with SMTP id a2-v6mr22963356pls.353.1520500513335; Thu, 08 Mar 2018 01:15:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520500513; cv=none; d=google.com; s=arc-20160816; b=qqbC+4g1hOdZ+qCMH2Ak1anEpBPAVjg7TF4Aomazmr73Zmu5TMwjerrGSFbW6uhfYY oJGUppa9AWE70BbkjlN35HtWmkUUfrL7cmnManRgcsF7mAzRd53So6zQHIZ4VveeWkXK 22Xkbeojdeld4sCjUi3PRs7zUj3jEThJFq5tG2vk/ONjEotFOmmA5+EWISuDP031MACq kNR0tkJ+6RJeeAc9pAVNJShh2KArV6cdHwMijRMklsRfj+4rH3Cp9d2oA2oIhY+9mXS3 T9CkSecQnGy89b0NZSifOiJS77d14rQ+VASZZaYm7SI8zQc5qF6CHCziTRk/d6v6zEAE 9bvg== 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=wXqoGqH84w09wTFTqIRdvl8BeNlDgqekv9ffUJiOgDI=; b=xRnCjhAtJy7+zrjxlHFumAFxQ7v+WPSyAGzxiEsVtftGA6N8IKg1W7ALkDoGBhpk13 k5eHxHEdxpRpdYMdv1NGjq61KB6HQYkgVNVXPFAhhliL4sBOW28Wb+h6eboBv7682KIj zN5OwagcKjG7akK29p4ianyFQL1dzlnuTUz0PO3i2a4wLqQmzK0FVIamsW2m5pRsOTRD WVpf5uG2fc1UQ037ViEVSaonxE/ljFDkXyGWpaahpIXvknZAv62rCyS4B292+cxv1p4R QJtzArcrxC9MOQ3Yk3dI28HjViy+w7juAIqR2Jl59iRGmctKnO2BaHuImyT1kdECTr8B ZiRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=YE+a+Czm; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k67si15426545pfj.298.2018.03.08.01.14.58; Thu, 08 Mar 2018 01:15:13 -0800 (PST) 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=@gmail.com header.s=20161025 header.b=YE+a+Czm; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935177AbeCHJMw (ORCPT + 99 others); Thu, 8 Mar 2018 04:12:52 -0500 Received: from mail-qk0-f172.google.com ([209.85.220.172]:41038 "EHLO mail-qk0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751355AbeCHJMt (ORCPT ); Thu, 8 Mar 2018 04:12:49 -0500 Received: by mail-qk0-f172.google.com with SMTP id w142so5989772qkb.8; Thu, 08 Mar 2018 01:12:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=wXqoGqH84w09wTFTqIRdvl8BeNlDgqekv9ffUJiOgDI=; b=YE+a+Czm/xBA/4bbUHZwjf10/uR5WnL6GW+vWwt1oUK2xsriXZA+FTspKcZFVs8WsZ loaJ4BRAqbi7eBJrca9fnknwil0T5LFcilRNUj9voDy7nyLAaV1ci8A9PJmIz8VKJmZk nZ5gmPKugfhEVKkljV8nMYDYx59Q8dCGj2s4QT7E8mf7OxQWFN3m8HfjqvqNlTP6eOma auiWkwqMJVfadRZyrv7akU3hMp2H/d9FA0yxyNxQ7/BpAmW41YQ7O2IsZ/DT4xO9yavo qW1kCZ6eyNLALcGIA9BC2BeGpIHwe2iQXdFs75NJ94237gl3EAhw8abIjVjShepK5qTS ygpQ== 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=wXqoGqH84w09wTFTqIRdvl8BeNlDgqekv9ffUJiOgDI=; b=btEGIUHg1LA1C3Y0eMo6YemFuW4c0V1GM54J+HwDzyRnwYpmQ2bzk+2XZu1bxAtL5b 9CX/Wc4Ivdv11Gkz7Vt19DaivbyVDP/W3fQsFkzh6KVFaiDG6SjzoZv0WeBWkU4/WfEZ uku+8FzEt7Injr2TUM+xmrLKmdjHX7va4xies2Eiq+Ak0I96/SKrzcPqWu6cyBA9fwQd f336NaeEYAcwZ10QNztu+pmH53PJsz2YCeGCH1RE+aMdPAcMOlRQyyi8ZGFahI91Qqg0 C+yyjyB4wz9XIzCuME4yfB7LznlsDYcaCPKcwkNRJTF7Bv4xne5kMpDB06VlWo3HGgTA wprQ== X-Gm-Message-State: AElRT7F8ORfQzolmieIelizHfUQLQchyVAU0QpgCs78QgyXFtGgCC8Sm b6qA7gfBS6qRaRl3rSCHT6I1h+7yVs2OKoe6l1s= X-Received: by 10.233.237.2 with SMTP id c2mr35607545qkg.54.1520500368282; Thu, 08 Mar 2018 01:12:48 -0800 (PST) MIME-Version: 1.0 Received: by 10.200.52.247 with HTTP; Thu, 8 Mar 2018 01:12:27 -0800 (PST) In-Reply-To: References: <1520292190-5027-1-git-send-email-sai.praneeth.prakhya@intel.com> <1520292190-5027-3-git-send-email-sai.praneeth.prakhya@intel.com> From: Miguel Ojeda Date: Thu, 8 Mar 2018 10:12:27 +0100 Message-ID: Subject: Re: [PATCH V2 2/3] efi: Introduce efi_rts_workqueue and some infrastructure to invoke all efi_runtime_services() To: "Prakhya, Sai Praneeth" Cc: "linux-efi@vger.kernel.org" , linux-kernel , "Lee@vger.kernel.org" , Chun-Yi , Borislav Petkov , "Luck, Tony" , Will Deacon , "Hansen, Dave" , Mark Rutland , Bhupesh Sharma , "Neri, Ricardo" , "Shankar, Ravi V" , Matt Fleming , "Zijlstra, Peter" , Ard Biesheuvel , "Williams, Dan J" 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 Thu, Mar 8, 2018 at 5:22 AM, Prakhya, Sai Praneeth wrote: >> > +struct workqueue_struct *efi_rts_wq; >> > + >> > static bool disable_runtime; >> > static int __init setup_noefi(char *arg) { @@ -329,6 +331,19 @@ >> > static int __init efisubsys_init(void) >> > return 0; >> > >> > /* >> > + * Since we process only one efi_runtime_service() at a time, an >> > + * ordered workqueue (which creates only one execution context) >> > + * should suffice all our needs. >> > + */ >> > + efi_rts_wq = alloc_ordered_workqueue("efi_rts_workqueue", 0); >> >> efi_rts_wq or efi_rts_workqueue? >> >> > + if (!efi_rts_wq) { >> > + pr_err("Failed to create efi_rts_workqueue, EFI runtime services " >> >> Same here. > > Sure! I will make it consistent with "efi_rts_wq". Just tried to be more verbose > with names :) > It is not a big deal, but using the exact same name is better for the purposes of grepping and things like that :-) By the way, check the commit title/message, there are some others there too. > [...] > >> > +#define efi_queue_work(_rts, _arg1, _arg2, _arg3, _arg4, _arg5) \ >> > +({ \ >> > + struct efi_runtime_work efi_rts_work; \ >> > + \ >> > + INIT_WORK_ONSTACK(&efi_rts_work.work, efi_call_rts); \ >> > + efi_rts_work.func = _rts; \ >> > + efi_rts_work.arg1 = _arg1; \ >> > + efi_rts_work.arg2 = _arg2; \ >> > + efi_rts_work.arg3 = _arg3; \ >> > + efi_rts_work.arg4 = _arg4; \ >> > + efi_rts_work.arg5 = _arg5; \ >> > + /* \ >> > + * queue_work() returns 0 if work was already on queue, \ >> > + * _ideally_ this should never happen. \ >> > + */ \ >> > + if (queue_work(efi_rts_wq, &efi_rts_work.work)) \ >> > + flush_work(&efi_rts_work.work); \ >> > + else \ >> > + BUG(); \ >> >> Thanks for the change! One remark, I would just do: > > Sorry! but I am planning to remove BUG(). Looks like it could defeat the purpose > of patch. Please see Boris comments on the other thread. No problem. Let's see how it looks in v3 :-) > > [...] > >> > +/* >> > + * efi_runtime_work: Details of EFI Runtime Service work >> > + * @func: EFI Runtime Service function identifier >> > + * @arg<1-5>: EFI Runtime Service function arguments >> > + * @status: Status of executing EFI Runtime Service >> > + */ >> > +struct efi_runtime_work { >> > + u8 func; >> > + void *arg1; >> > + void *arg2; >> > + void *arg3; >> > + void *arg4; >> > + void *arg5; >> > + efi_status_t status; >> > + struct work_struct work; >> > +}; >> >> Why is efi_runtime_work in the .h at all? >> > > Thanks for the catch. I will move it to runtime-wrappers.c file and will make it > static too. It isn't being used in any other place. > >> Please CC me for the next version! :-) > > Sure! Sorry for that. I should have done in V2. Thanks! Cheers, Miguel > > Regards, > Sai