From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8B087C19F29 for ; Fri, 29 Jul 2022 11:09:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235032AbiG2LJ1 (ORCPT ); Fri, 29 Jul 2022 07:09:27 -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-Google-Smtp-Source: AGRyM1v+xj5pQJMfZ4lmaVj4tdX9ZjkVQL/6zKCe6bRcDdJznwYtm5d2uSEFrnBGcvR62TftvBoSZQ== 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 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