Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp193198imn; Fri, 29 Jul 2022 04:18:02 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vp6ocRV090WWjN5n1Fj62OiY/kVHYjqVAc2vfYyKD1im006X5KQGdY//ZzQoMP7po74Bo9 X-Received: by 2002:aa7:c784:0:b0:43a:caa8:75b9 with SMTP id n4-20020aa7c784000000b0043acaa875b9mr2914782eds.311.1659093482202; Fri, 29 Jul 2022 04:18:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659093482; cv=none; d=google.com; s=arc-20160816; b=iLWQHRcrXB/suKegjhjEorBq1hYVddXn3cn9J6U+hfwISguebhFy9IwM3ZAMbBwHWI mIiVbOVpdZ5TXEkRdvrG9bBkd0brZz5MZL88jEsyl0loeLEsUw1+z1gsEozYn+zfElsQ jG0kIFqOZ+BEYrKXj2f3JgHRRb0u1P4N7lcINuwD2bwliRFrmhx6SqH95tfoJjAa2Ydw g4DbInC36stAKLxe5TM5Trbc9oz/3jNOeIcy+OayBgaFGVUVIRw4yEaJyhdlqsETb3fl UrANQRJ7FbygzcDVtrlUPhdTvEDPfOO+eTVz5lB6uxwlDUuSjvAhZSLpvLXQpFoxq1ee OmIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=I1jjF3teWXwIXWhjG2K4l3lswL2POP7iGvppKXLJfOo=; b=kqbTyfF9FnGU3KE+B00/kGIjWd3aGV/e2V2LOhBS19LsbuJgOTWSOR7GTiQ/5e18Uc rsZfnmCaWRPqz249966jrHztj/99laQf6zcBUoJtfOp97H+yKr5uhfWq3jdYOyVgnzeh NQyIJOED22gzG2MzrB39Zduspfz6JAbKCuyGomMxuuPZ9rpoKf/gQ+/xYoULewuHZfeH OTDxBe/Oyc5oOzLgXAv9I0SSgT+9nk1QFiMAD3F5prUkMlvkybqeuR1E/qtz3yf50zqd oiTfkonMbnd9x6RRZNsxfgofsjTuxfT0EUNDZoSIIgyA22lGYJ4vGIrqy1JKBhg40oXp YH0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@semihalf.com header.s=google header.b=uDtLGan9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=semihalf.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dr11-20020a170907720b00b0072f2bc8d833si934025ejc.54.2022.07.29.04.17.36; Fri, 29 Jul 2022 04:18:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@semihalf.com header.s=google header.b=uDtLGan9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=semihalf.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231428AbiG2LJ0 (ORCPT + 99 others); Fri, 29 Jul 2022 07:09:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235625AbiG2LJY (ORCPT ); Fri, 29 Jul 2022 07:09:24 -0400 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6573571718 for ; Fri, 29 Jul 2022 04:09:23 -0700 (PDT) Received: by mail-lf1-x131.google.com with SMTP id w15so6785049lft.11 for ; Fri, 29 Jul 2022 04:09:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf.com; s=google; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to:content-transfer-encoding; bh=I1jjF3teWXwIXWhjG2K4l3lswL2POP7iGvppKXLJfOo=; b=uDtLGan9oxoNLOE1+DLxNadposAOgT51BLm1P0nx3Jsza3mVlhuHXEJu7V3UN1rPAb 4f5tpfn5Plrm4DSv7/mBmN0BDpJy+7xTr/MixiBBm7VeK7rfi5pD0J6ySzWjMluXejMY YCfPIXmNtBh0hEHEEJTF1ZDUowEbiCdJ0PWK/QxOirZNflMOb0EuK1VHJ84aHsVcPlgm HVdKCBHB7oLeEjOvc6DrWgObHDkWEGJpa6BKV2ivUR1YMP/czGsYPWhIAArLGcRbEjhR UGWPhqe5F/8rv5dwUPS/+gGmNNBv9BxZ8CVc+m8qyMb2V3jVVlBacI4hKvHHYe+ET+EO iujg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=I1jjF3teWXwIXWhjG2K4l3lswL2POP7iGvppKXLJfOo=; b=iJlmBFEsbFG33Dm7fsjE7ZBpZS4pmPSC0I6EY0cxoJdr+ZpRKgRhP2z1aS1q7Cf9nb ucZCl1nmPzNk3F05mQ7RXby649Qf8vVhfuuOssUwIJmuPYpQkDbljOZ5Ic6SCP1C0qyW DJzxx5uQphXeaH5nhGAOnpcuT3USZxaEQnyCd84tHXrNPYMs+1pToOUuNzLktCqjzYNV NZmqp2lzyV9CCDoIdeQwj7OSUFRJ4lo9EI2WCxPTG++WzAmKc3fZiEQsl1AoEtc/2+L7 v/sFRL/3W6XB91GP5S9D1JsEAS8a5dy4Sa4BJENj2ImUiX7AoWGf8Jh7rb5oFFbmPq2h WxrQ== X-Gm-Message-State: AJIora8T/XnJ6SFFtC2jKn/1UMfXxNc5v90EQv9gZauyOaaaS8O5dn4f A42IHUGs50+il+zG3iQbw2xLcQ== X-Received: by 2002:a05:6512:1293:b0:48a:8759:db42 with SMTP id u19-20020a056512129300b0048a8759db42mr1155666lfs.558.1659092961692; Fri, 29 Jul 2022 04:09:21 -0700 (PDT) Received: from [10.43.1.253] ([83.142.187.84]) by smtp.gmail.com with ESMTPSA id t24-20020a056512209800b0048a9d43b978sm622785lfr.239.2022.07.29.04.09.20 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 29 Jul 2022 04:09:21 -0700 (PDT) Message-ID: <1cdff41c-c917-1344-02bc-ad5cf5c79ab1@semihalf.com> Date: Fri, 29 Jul 2022 13:09:19 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH 1/3] KVM: x86: Move kvm_(un)register_irq_mask_notifier() to generic KVM Content-Language: en-US To: Sean Christopherson Cc: Paolo Bonzini , kvm@vger.kernel.org, Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , linux-kernel@vger.kernel.org, Eric Auger , Alex Williamson , Rong L Liu , Zhenyu Wang , Tomasz Nowicki , Grzegorz Jaszczyk , Dmitry Torokhov References: <20220715155928.26362-1-dmy@semihalf.com> <20220715155928.26362-2-dmy@semihalf.com> From: Dmytro Maluka In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/28/22 20:46, Sean Christopherson wrote: > On Fri, Jul 15, 2022, Dmytro Maluka wrote: >> In preparation for implementing postponing resamplefd event until the >> interrupt is unmasked, move kvm_(un)register_irq_mask_notifier() from >> x86 to arch-independent code to make it usable by irqfd. > > This patch needs to move more than just the helpers, e.g. mask_notifier_list > needs to be in "struct kvm", not "stuct kvm_arch". > > arch/arm64/kvm/../../../virt/kvm/eventfd.c: In function ‘kvm_register_irq_mask_notifier’: > arch/arm64/kvm/../../../virt/kvm/eventfd.c:528:51: error: ‘struct kvm_arch’ has no member named ‘mask_notifier_list’ > 528 | hlist_add_head_rcu(&kimn->link, &kvm->arch.mask_notifier_list); > | ^ > make[3]: *** [scripts/Makefile.build:249: arch/arm64/kvm/../../../virt/kvm/eventfd.o] Error 1 > make[3]: *** Waiting for unfinished jobs.... > AR kernel/entry/built-in.a Oops, sorry. > And kvm_fire_mask_notifiers() should probably be moved as well, otherwise there's > no point in moving the registration to common code. Good point, we can move it right away, even though it is not called on other architectures for now. > The other option would be to make the generic functions wrappers around arch-specific > hooks. But IIRC won't this eventually be needed for other architectures? Right, I assume we will eventually need it for ARM at least. Not in the near future though, and at the moment I have no non-x86 hardware on hand to implement it for other architectures. Actually I feel a bit uncomfortable with generic irqfd relying on kvm_register_irq_mask_notifier() which silently has no effect on other architectures. Maybe it's better to keep kvm_(un)register_irq_mask_notifier() in the x86 code, and for the generic code add a weak version which e.g. just prints a warning like "irq mask notifiers not implemented on this arch". (Or maybe instead of weak functions introduce arch-specific hooks as you suggested, and print such a warning if no hook is provided.) What do you think? Thanks, Dmytro