Received: by 2002:a05:7412:b101:b0:e2:908c:2ebd with SMTP id az1csp2851995rdb; Wed, 15 Nov 2023 12:26:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IGstuAN3gaNLQxmtsFfuyg4CDmubHaHedbgF+KBFcfljVQaso6XpvFZKi9JL/mQXgTa2TVu X-Received: by 2002:a05:6a20:8406:b0:181:6b3d:ca1c with SMTP id c6-20020a056a20840600b001816b3dca1cmr10045702pzd.3.1700079999676; Wed, 15 Nov 2023 12:26:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700079999; cv=none; d=google.com; s=arc-20160816; b=ZbMMlyCrxdVR4SrzLGVlOMyQZpICeLpkVQGqvgI8zKpl9UDeW3eeR97FTmlOxFv/8H m2VivTp1B8SLGQlt106f3jbnCT/2sbkk1JziRdbluzldM8wmf1oJm0zzuFLaQT4FxAuR b56i77z/gqQ73CxCS3PHVKeY3/f7GYk9YYg3xwXi7rpb6neS20soNyDRjS/H8RLTlXzm QsH8MNxzMBa1TX+nXAoccyth5RqTSiB1JwLA9eg3GIjZ3OM4Dpsa9DJlL4EbN2wpK7rf SDiyTGSKfFYEKi3+Wdwjls3QzggLuEOegthONulBjdTtFU1bfcRzjyTKrrlHJtVBTsk9 oI1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=sd2dsJt8707J4YuJefExGERUpgOFM0GyvziSEl19TJg=; fh=+Avl9ZqMSexEEooQicpf6NMDmXbrGBFIJuDFOMrgGck=; b=f9VMhdjznjwOEevPqYdL9jrKss+MODCDzzP0XMB6sdvANj1WHObouwN4lzetenfsX7 T6E0/4tUh0nZaDdkKWgl+20RQAFKTjA+xk06WlV0ZAPt5/ue0W4DzFSq7RgMssiFdxwf tHGwR0r/EhPiYQDrlLijOKMRh5s1v5W5ZF8iDAk9esDxrb6Brp1Joim23iDMjJItcWeG cD4dB5hVGVT4WIkYwAOhHo7XprTqkii7wGgSPvrPI12GWlb+kF5ByoGuLHAX9JxuqGt0 uuTHp/0amwyIfGB/Sfk9m9pEmLLGT4SFO0yhmu5Xs1BSUGaCjhPJgEJfqqyHR8Yxfl0j tyVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=Haa2w7Xj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id e7-20020a635447000000b0056b024a4dd0si10084055pgm.614.2023.11.15.12.26.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Nov 2023 12:26:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=Haa2w7Xj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 4F1E4805F9CD; Wed, 15 Nov 2023 12:25:52 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230440AbjKOUZr (ORCPT + 99 others); Wed, 15 Nov 2023 15:25:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344441AbjKOUZp (ORCPT ); Wed, 15 Nov 2023 15:25:45 -0500 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09940E6; Wed, 15 Nov 2023 12:25:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=sd2dsJt8707J4YuJefExGERUpgOFM0GyvziSEl19TJg=; b=Haa2w7XjcLw6Al7rcSZJ+RvpXT ib1et/H5dRlxPwZnLlh+YAQHvLMvvZQsiBOOB575wPOWOORecGB1FrxYMhVjcfwhKRdGmiLAYIm0V lgbAgJCGoy4YDUjTwfNMKxvFN17xSYaXpAeYYNnxu1cntGRt9LIKqpi6XM6T7ZMKC0lYztTe3wsIP iWtUXejxr2dcIYrlFRbzuSi8aP0hH3Rj1XnO+nItMUqcKhne2xpUB1lwIcOK7g6F/xLNqVVqwmj7Y QVzDQ7mVQlKi4nVOBXyKXajfKNr3sd6IzJ7vfARY6C/HkokTZmmvI5W9FoTRrIVttYHlXL5dQYJwv CSdrScIQ==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1r3MRf-004HxS-0z; Wed, 15 Nov 2023 20:25:07 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id F130E300427; Wed, 15 Nov 2023 21:25:06 +0100 (CET) Date: Wed, 15 Nov 2023 21:25:06 +0100 From: Peter Zijlstra To: Jacob Pan Cc: LKML , X86 Kernel , iommu@lists.linux.dev, Thomas Gleixner , Lu Baolu , kvm@vger.kernel.org, Dave Hansen , Joerg Roedel , "H. Peter Anvin" , Borislav Petkov , Ingo Molnar , Raj Ashok , "Tian, Kevin" , maz@kernel.org, seanjc@google.com, Robin Murphy Subject: Re: [PATCH RFC 09/13] x86/irq: Install posted MSI notification handler Message-ID: <20231115202506.GB19552@noisy.programming.kicks-ass.net> References: <20231112041643.2868316-1-jacob.jun.pan@linux.intel.com> <20231112041643.2868316-10-jacob.jun.pan@linux.intel.com> <20231115125624.GF3818@noisy.programming.kicks-ass.net> <20231115120401.3e02d977@jacob-builder> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231115120401.3e02d977@jacob-builder> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 15 Nov 2023 12:25:52 -0800 (PST) On Wed, Nov 15, 2023 at 12:04:01PM -0800, Jacob Pan wrote: > we are interleaving cacheline read and xchg. So made it to Hmm, I wasn't expecting that to be a problem, but sure. > for (i = 0; i < 4; i++) { > pir_copy[i] = pid->pir_l[i]; > } > > for (i = 0; i < 4; i++) { > if (pir_copy[i]) { > pir_copy[i] = arch_xchg(&pid->pir_l[i], 0); > handled = true; > } > } > > With DSA MEMFILL test just one queue one MSI, we are saving 3 xchg per loop. > Here is the performance comparison in IRQ rate: > > Original RFC 9.29 m/sec, > Optimized in your email 8.82m/sec, > Tweaked above: 9.54m/s > > I need to test with more MSI vectors spreading out to all 4 u64. I suspect > the benefit will decrease since we need to do both read and xchg for > non-zero entries. Ah, but performance was not the reason I suggested this. Code compactness and clarity was. Possibly using less xchg is just a bonus :-)