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 2A5F9C19F2B for ; Tue, 2 Aug 2022 21:43:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234894AbiHBVng (ORCPT ); Tue, 2 Aug 2022 17:43:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231759AbiHBVnd (ORCPT ); Tue, 2 Aug 2022 17:43:33 -0400 Received: from mail-pf1-x432.google.com (mail-pf1-x432.google.com [IPv6:2607:f8b0:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 13CB4192B3 for ; Tue, 2 Aug 2022 14:43:32 -0700 (PDT) Received: by mail-pf1-x432.google.com with SMTP id g12so14761088pfb.3 for ; Tue, 02 Aug 2022 14:43:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc; bh=glIoMvy+V8piFljmDBSx1DXBvemkA6EbTrCh0bvpQQM=; b=bXtC5cvRALUa/1WE0ly/zfA9Ixmtzw5XKDDqJ7xA/MZ2JEiS0E84uQe9/5YDrlj1j1 bPiKiu1wZ5qOKDN9EkX5fFU1UgNTVLbTTuGJNjJDmLCSdzSNfL3IFteLCTlz1lCwvgdJ 7l/KGtCLKdTW+9LqNbdBak5iOfLoU8BzAyb4p4MRp62KCRXTcK6aEv+iuElX9guDUtF9 A9dlpmOgwwMBQOSSCcAvoaHZLyxMFgFL+ccMmbyx7gdDjnIyRr1uqbTp0VCd0PXpZJbt C0s+liN2XOmtcDLOR5jgbx/uMe7kL1/foBA5s7E8Pi+GDq7JLbzmPxvQcQ8JFgeawTOH LZ2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc; bh=glIoMvy+V8piFljmDBSx1DXBvemkA6EbTrCh0bvpQQM=; b=V2PwWBdiGCmFbtCDz2/0uE01pp9/I5Z3lBx/b7npxKMyRKoVafeTduDPFFj6uwC9yn YSQqYTJvAOCR4MfxwyjGvFa7CtjQLjJ3DUKGplO3Ur0vm/n5a+z+oadw+F1mnkmNRfPA svkdwqAjGbpcbOPaOU1m06j/6zhlkhke5GjGcqUyUH5rzQSfqaQv3Yo32wSx0qTEOzSm nhphhAfteXb950vYu51bG7Lw5ghE9i4i+jdlX93jGaHqlEfaePkSNaEYyWerl3LhA4R7 s2N6NfN2vna9TGIKFPZ0LXGr8uwxVvGoPDURFSS9oWKbwzHJS+Ezlkyx5BfOZam1Wf4J hlow== X-Gm-Message-State: AJIora9ceykbfPZ3QlV1/GY8OoDyrITVMxfdYwaaNaiDcIvSQkSJsorz 4fuH5CghTMdQ4BdeC5MaOGZMRA== X-Google-Smtp-Source: AGRyM1t8NwHkIq41xaU0E/q8nllWxF+IG4nAKsFzU5BfqUvk9QC8EJW8Bvrd7zkDShHaMjlywqZsRw== X-Received: by 2002:a05:6a00:16ca:b0:52b:cc59:9488 with SMTP id l10-20020a056a0016ca00b0052bcc599488mr22807097pfc.0.1659476611335; Tue, 02 Aug 2022 14:43:31 -0700 (PDT) Received: from google.com (7.104.168.34.bc.googleusercontent.com. [34.168.104.7]) by smtp.gmail.com with ESMTPSA id a9-20020a170902ecc900b0016c28fbd7e5sm149763plh.268.2022.08.02.14.43.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Aug 2022 14:43:30 -0700 (PDT) Date: Tue, 2 Aug 2022 21:43:26 +0000 From: Sean Christopherson To: Dmytro Maluka 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 Subject: Re: [PATCH 1/3] KVM: x86: Move kvm_(un)register_irq_mask_notifier() to generic KVM Message-ID: References: <20220715155928.26362-1-dmy@semihalf.com> <20220715155928.26362-2-dmy@semihalf.com> <1cdff41c-c917-1344-02bc-ad5cf5c79ab1@semihalf.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1cdff41c-c917-1344-02bc-ad5cf5c79ab1@semihalf.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 29, 2022, Dmytro Maluka wrote: > 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? If the entire concept of having mask notifiers is x86 specific, then moving it to generic code obviously doesn't make sense. But if the concept applies to other archictectures, then IMO the list belongs in "struct kvm" with generic, common helpers, even if no other arch calls kvm_fire_mask_notifiers() at this time. Paolo and/or non-x86 folks, any thoughts?