Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp1613480rda; Mon, 23 Oct 2023 19:44:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGrJpZp9IV1lahDYn83pnojFoGLBOrNqKpJKXOSX2FY+lRDxA0Jkq1htZzdDdAJlFhaeDHr X-Received: by 2002:a17:902:d506:b0:1ca:87e5:9d72 with SMTP id b6-20020a170902d50600b001ca87e59d72mr11516428plg.56.1698115472587; Mon, 23 Oct 2023 19:44:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698115472; cv=none; d=google.com; s=arc-20160816; b=Zqx5IpXg6t4Ap39K0XHgGD7Op6r9yhQj6pGhQKTulzu2P6dCOJdS3PfMD9bcQrju75 +RI9df+sTCdlTgMlvh3iDzqgNNXhSuSlrBxiVVoVde8CNHdd8MqjyU4nSFExxotDGz2x NEH6N6jgl4yuUYa2ZU4e8YJ6SbTAVdJD7jTnrNK5aasupyf0bDAyUnduDEyZdyDR0VJX kvONHT5+Vp8k4rM2zQIUSpHIXFi0McC2fbop0EI42FNLUcz0JvHUt9t3Ya7smwD28uhp ewMIZWcoCPoKDeoEizv5NOPi8aeI1Ltsozzgouw2VgZndyXqSjeMA5UAOBeMsy/QGUMT HSug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:references:cc:to:from:date:subject :message-id; bh=Snius23moQwBi76yjXWEDdoO79yv/6AXrj/L9QGNpes=; fh=BXMGSVlN6OlngdBx06lETCkN0bY0XpuphERSe8Z8350=; b=il5+pjShP/kyxECA46OoAxjvdK2IUyWDWvNhf+VbfZwDfHLs1/i0tj/K/y3Ux7e+e/ 4bCiKFs+OSE32WCzNwTr55sI0u/xamuwI8+tp2843LVnlhfk0AccrquXtydbRnaA6oXp Uw+jV0BAOL0PXOT4uEuoAH9EfaF+sVkPhvHbihwdYjwXPWvG/+GIL0dAyLgswzw3roXe tS7DeNBk/vuoMfJ1xqFIy8bKyIOAazvTzTD6111zPwwLdSjHSYKFdMdTaHgA8Kve7F88 lQ/5cgxl+G6/ee2xv7dbDB32qLGBQtGEzWXI5vEfy6tpmIUb59g6dlnLDu1kF8p04Rj0 ElwQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id b19-20020a170902ed1300b001c9d9050b37si7194618pld.260.2023.10.23.19.44.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 19:44:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 6CC68804ADB5; Mon, 23 Oct 2023 19:44:26 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232359AbjJXCoQ (ORCPT + 99 others); Mon, 23 Oct 2023 22:44:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231913AbjJXCoP (ORCPT ); Mon, 23 Oct 2023 22:44:15 -0400 Received: from out30-101.freemail.mail.aliyun.com (out30-101.freemail.mail.aliyun.com [115.124.30.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8071B10D4 for ; Mon, 23 Oct 2023 19:44:08 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R901e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046051;MF=xuanzhuo@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0VuoXqpk_1698115445; Received: from localhost(mailfrom:xuanzhuo@linux.alibaba.com fp:SMTPD_---0VuoXqpk_1698115445) by smtp.aliyun-inc.com; Tue, 24 Oct 2023 10:44:05 +0800 Message-ID: <1698114697.434748-1-xuanzhuo@linux.alibaba.com> Subject: Re: [PATCH 1/2] virtio_pci: Don't make an extra copy of cpu affinity mask Date: Tue, 24 Oct 2023 10:31:37 +0800 From: Xuan Zhuo To: Jakub Sitnicki Cc: "Michael S. Tsirkin" , Jason Wang , linux-kernel@vger.kernel.org, kernel-team@cloudflare.com, Caleb Raitto , virtualization@lists.linux-foundation.org References: <20231019101625.412936-1-jakub@cloudflare.com> <1697720122.49851-2-xuanzhuo@linux.alibaba.com> <87il6x2rj6.fsf@cloudflare.com> In-Reply-To: <87il6x2rj6.fsf@cloudflare.com> X-Spam-Status: No, score=-0.7 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email 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 (pete.vger.email [0.0.0.0]); Mon, 23 Oct 2023 19:44:26 -0700 (PDT) On Mon, 23 Oct 2023 18:52:45 +0200, Jakub Sitnicki wrote: > On Thu, Oct 19, 2023 at 08:55 PM +08, Xuan Zhuo wrote: > > On Thu, 19 Oct 2023 12:16:24 +0200, Jakub Sitnicki wrote: > >> Since commit 19e226e8cc5d ("virtio: Make vp_set_vq_affinity() take a > >> mask.") it is actually not needed to have a local copy of the cpu mask. > > > > > > Could you give more info to prove this? Actually, my question is that can we pass a val on the stack(or temp value) to the irq_set_affinity_hint()? Such as the virtio-net uses zalloc_cpumask_var to alloc a cpu_mask, and that will be released. int __irq_apply_affinity_hint(unsigned int irq, const struct cpumask *m, bool setaffinity) { unsigned long flags; struct irq_desc *desc = irq_get_desc_lock(irq, &flags, IRQ_GET_DESC_CHECK_GLOBAL); if (!desc) return -EINVAL; -> desc->affinity_hint = m; irq_put_desc_unlock(desc, flags); if (m && setaffinity) __irq_set_affinity(irq, m, false); return 0; } EXPORT_SYMBOL_GPL(__irq_apply_affinity_hint); The above code directly refers the mask pointer. If the mask is a temp value, I think that is a bug. And I notice that many places directly pass the temp value to this API. And I am a little confused. ^_^ Or I missed something. Thanks. > > > > If you are right, I think you should delete all code about msix_affinity_masks? > > Sorry for the late reply. I've been away. > > It looks that msix_affinity_masks became unused - intentionally - in > 2015, after commit 210d150e1f5d ("virtio_pci: Clear stale cpumask when > setting irq affinity") [1]. > > Originally introduced in 2012 in commit 75a0a52be3c2 ("virtio: introduce > an API to set affinity for a virtqueue") [2]. As I understand, it was > meant to make it possible to set VQ affinity to more than once CPU. > > Now that we can pass a CPU mask, listing all CPUs, to set_vq_affinity, > msix_affinity_masks seems to no longer have a purpose. > > So, IMO, you're right. We can remove it. > > Happy to do that in a follow up series. > > That is - if you're okay with these two patches in the current form. > > Thanks for reviewing. > > [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=210d150e1f5da506875e376422ba31ead2d49621 > [2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=75a0a52be3c27b58654fbed2c8f2ff401482b9a4