Received: by 2002:a05:7412:1492:b0:e2:908c:2ebd with SMTP id s18csp563429rdh; Tue, 22 Aug 2023 04:33:47 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHI2QQfa1FTfQHIgkPDjwqKOtNA9loPu7ArHQyTu4rMTocLw+D9DF/uEJah8kui0YG/ILiS X-Received: by 2002:a05:6a21:99a8:b0:12f:eb74:72b6 with SMTP id ve40-20020a056a2199a800b0012feb7472b6mr8434376pzb.60.1692704026595; Tue, 22 Aug 2023 04:33:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692704026; cv=none; d=google.com; s=arc-20160816; b=QOuCLjiSkLW9l1CJn4TL4uCbNAwcGleg6xpgvVaVBJKj+TpLuEb4FNgxMmCvIU5AV1 HviHZfjoTT4LLxgQ6EL1pv+peHgG7Yv7lFqF89QGHDbeJiuUplaaIqxT5wSTFamSfaWr 2XV3gXOIerJwyJL/n3rLfQeZQsUoo+i7Booe3Qw4QGzSN8oZffTInY8DAckrQCDSxKah dLzl0HWK2w2UVK+5S7QKshCYpEtOCsfiNzeyMx0YcbvtZmbqAXktoB4B5mZVcai7uH0V 38nu4mbLhPNzRcJS4uiwOyQXOOlMo78C2zCYLNwhBQeTFQ/2ojnehJWAh6RKh1SQipkT 2i+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date:dkim-signature; bh=GTvlZgyGDL4I9UTGGD9i8D9YsxARDmgklKEmVpyeS1Q=; fh=OXwc0xaXvdQDDB0wOZ8oX+rOMsRPcp5/BJkuAODNvLg=; b=WaGB+25PT7cYunhxGIMxF/MdqUSZ7woOKdX//MXd9/ZbCpMipHamWudHxEMtsdszIb nVqrmKs38z2vQXql77U/VZgKJvM4dUbk9JuTGdw/sOK8WN6lvvsqSJYq9SrA1Hbis+95 HOlTeuHKjgfJqsf3/eCA+9DuIU3C7UUsmfQtLE9ik4KpEnqTjbMASqIwmYoSuOdp4KLZ mZF7gG+5CPDogbbyNR1gsEtyZvQt0v7HgCgJhyQGflYTelZnC5DkUSkgB+1ugQU64RDf xWqusD3JBYetmmUVn5TChZW3aM4J+CCt8j49i3+6LWjUmYWaj7WHvHjPMIvJm52bl4DC fegg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=cBiqOPSc; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x12-20020a62860c000000b0068a2c6ec2besi5891353pfd.221.2023.08.22.04.33.33; Tue, 22 Aug 2023 04:33:46 -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=@kernel.org header.s=k20201202 header.b=cBiqOPSc; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233823AbjHVI2s (ORCPT + 99 others); Tue, 22 Aug 2023 04:28:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231754AbjHVI2q (ORCPT ); Tue, 22 Aug 2023 04:28:46 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 49E801AD; Tue, 22 Aug 2023 01:28:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CD54561EBD; Tue, 22 Aug 2023 08:28:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 07E40C433C9; Tue, 22 Aug 2023 08:28:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1692692924; bh=7nk22NxlDXVnokJCemNbUMUy0LuKuJ9IPJQjaV1pArQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=cBiqOPScRD8EW5z/a14Usyd4J3GEN7eCXw9q4hjcOTml7W/UQpS5ZIGF/tAGhodp+ s23nv7RIpfmICx8M15KE1oRpHPW3NAQcc57JvkhguMCsvGVJipWhazPGA+5YpqI1CA UhBl2vLvTVAt6PZV4y7Fnx9GMEXDfGdOB1Q4FgSNGjGnKVfcVUCklNy2V4GtzLvJFT aA+qyJ5N0UGk91eMlMZI7mhv4lDnA+FctbvrEyNLkxOj1YQg04DxV7SoHSy4cbNr9f SkbyG4soYbiR8keXS/6zMrsJiPOKSzDGSOKCzJfTDiNihuAAmIvHKeTm+5gHq0kYdN KwZeoyzK0GPeg== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1qYMki-006xkD-Dd; Tue, 22 Aug 2023 09:28:41 +0100 Date: Tue, 22 Aug 2023 09:28:40 +0100 Message-ID: <86jztnfpl3.wl-maz@kernel.org> From: Marc Zyngier To: zhaoxu Cc: pbonzini@redhat.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, zhouyibo@bytedance.com, zhouliang.001@bytedance.com, Oliver Upton , kvmarm@lists.linux.dev, Mark Rutland Subject: Re: [RFC] KVM: arm/arm64: optimize vSGI injection performance In-Reply-To: References: <20230818104704.7651-1-zhaoxu.35@bytedance.com> <86msykg0ox.wl-maz@kernel.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/28.2 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: zhaoxu.35@bytedance.com, pbonzini@redhat.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, zhouyibo@bytedance.com, zhouliang.001@bytedance.com, oliver.upton@linux.dev, kvmarm@lists.linux.dev, mark.rutland@arm.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham 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 Tue, 22 Aug 2023 04:51:30 +0100, zhaoxu wrote: > > hi marc, thanks for reviewing. > > On 2023/8/21 18:16, Marc Zyngier wrote: > >>> This work is based on v5.4, and here is test data: > > > > This is a 4 year old kernel. I'm afraid you'll have to provide > > something that is relevant to a current (e.i. v6.5) kernel. > > > In fact, the core vCPU search algorithm remains the same in the latest > kernel: iterate all vCPUs, if mpidr matches, inject. next version will > based on latest kernel. My point is that performance numbers on such an ancient kernel hardly make any sense, as a large portion of the code will be different. We aim to live in the future, not in the past. > > >>> Based on the test results, the performance of vm with less than 16 cores remains almost the same, > >>> while significant improvement can be observed with more than 16 > >>> cores. > > > > This triggers multiple questions: > > > > - what is the test being used? on what hardware? how can I reproduce > > this data? > > > 1. I utilized the ipi_benchmark > (https://patchwork.kernel.org/project/linux-arm-kernel/patch/20171211141600.24401-1-ynorov@caviumnetworks.com/) > with a modification to the Normal IPI target in the following manner: > smp_call_function_single(31, handle_ipi, &time, 1). > 2. On kunpeng 920 platform. > 3. Using ipi_benchmark but change the target cpu in Normal IPI case, > and use bcc or bpftrace to measuret the execution time of > vgic_v3_dispatch_sgi. So this is not a self contained benchmark, that on top of it requires some vague additional changes. Great. > > - which current guest OS *currently* make use of broadcast or 1:N > > SGIs? Linux doesn't and overall SGI multicasting is pretty useless > > to an OS. > > > > [...] > Yes, arm64 linux almost never send broadcast ipi. I will use another > test data to prove performence improvement Exactly. I also contend that *no* operating system uses broadcast (or even multicast) signalling, because this is a very pointless operation. So what are you optimising for? > > > >>> /* > >>> - * Compare a given affinity (level 1-3 and a level 0 mask, from the SGI > >>> - * generation register ICC_SGI1R_EL1) with a given VCPU. > >>> - * If the VCPU's MPIDR matches, return the level0 affinity, otherwise > >>> - * return -1. > >>> + * Get affinity routing index from ICC_SGI_* register > >>> + * format: > >>> + * aff3 aff2 aff1 aff0 > >>> + * |- 8 bits -|- 8 bits -|- 8 bits -|- 4 bits or 8bits -| > > > > OK, so you are implementing RSS support: > > > > - Why isn't that mentioned anywhere in the commit log? > > > > - Given that KVM actively limits the MPIDR to 4 bits at Aff0, how does > > it even work the first place? > > > > - How is that advertised to the guest? > > > > - How can the guest enable RSS support? > > > thanks to mention that, I also checked the relevant code, guest can't > enable RSS, it was my oversight. This part has removed in next > version. Then what's the point of your patch? You don't explain anything, which makes it very hard to guess what you're aiming for. M. -- Without deviation from the norm, progress is not possible.