Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp3839724rwj; Tue, 20 Dec 2022 02:38:26 -0800 (PST) X-Google-Smtp-Source: AMrXdXvenT4iYYGY6thZVvHq+HXSBlQ7+k8CxqKzZJDtkhSwEcrfGas0/vy7OUF3gRfvLIy+Y5oY X-Received: by 2002:a17:902:db04:b0:190:e234:d92e with SMTP id m4-20020a170902db0400b00190e234d92emr35802609plx.58.1671532706081; Tue, 20 Dec 2022 02:38:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671532706; cv=none; d=google.com; s=arc-20160816; b=dfDy8gvzyayA++vDpXwLilBe9jDZ/OX0WtBZ635mr3VQQWemJFvyP9dffgfkwhfqKP FSZCO5RZH+SmHif5xygnzjcPDegsPdwRCuNUkoDib8ZwkJMd+I49sg6AZ8YRgoMXmBZt XBWlDoTiREENWY689rvXnZnFwiwqkcpxysfnoEY7VNI+pE5EeHhiFQ8M1fKG0lZv47Ao qEzDfMpZLmAjxDbfUKK+/OCe67rMAkJcH0aW4SYKLB0SMATH+H8Bwxt/T7wY5EjHdlny RpwGloArorIviMtCcaQwHgDAUk5w58HFfK9gfKdFSlTcOtzzPXukRnwVINhhR56txdN+ xgPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=HmgiYw3Ezgtgc0Fnyw2i+o//lXCiSoYu98n5jTUuNLE=; b=aDPSLOhBsvdMcmkRPVMXP7uJdxgAfDyXex3SGEGurv5VBk3MuSo4t1f/BNlq6mdbKR lrO9FnhK7QHkK1JnHHGXTZ+4+nUEDHkV8ZSEL0Rewj9Fx/VZFQldT2MR3OfNzxwt/t0B h+U0xR0yT1Q/V291sZ8aXM9bF9l70TX6cEZc1loZOnKb4cfAyxmBPhHUqag6a4rDjbTI pya5myRRi3DHea7RCkxSSpp2CXi7qOAl04dsJh5wXP6UMfv26Xxh+dELDr+XiniUWXJS WxUs0Lu4lLHRktuwbuhclQ/aTmjXo9zJr9UjZpQAwRnVgCRSvxVgv/w7UthcH4QPvTYJ HAVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=ff6ZUWPe; 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=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m11-20020a170902d18b00b001892706d7fasi12419273plb.175.2022.12.20.02.38.16; Tue, 20 Dec 2022 02:38:26 -0800 (PST) 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=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=ff6ZUWPe; 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=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233158AbiLTKEM (ORCPT + 70 others); Tue, 20 Dec 2022 05:04:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233751AbiLTKDt (ORCPT ); Tue, 20 Dec 2022 05:03:49 -0500 Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4ABD19C39 for ; Tue, 20 Dec 2022 02:02:04 -0800 (PST) Received: by mail-ej1-x631.google.com with SMTP id jo4so19040733ejb.7 for ; Tue, 20 Dec 2022 02:02:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=HmgiYw3Ezgtgc0Fnyw2i+o//lXCiSoYu98n5jTUuNLE=; b=ff6ZUWPexkB+ZmN7C9VxDIABpsR1CyjvgW0lZWexnLXL9Sz+XmpiaazjvhYOfttvbH xruTUbkLNvlqXNu97Wqg0p+qzCG04/wT4ZVkQQqOijOKLqsizQtVre7s8fXRyB+ptoHM f9v8Tw+G6snSZK53PVN+BOKfGqB/VhEzv2UJcse7EUE17W3ETQWtlV0OS1DHM0y1xXig RZMz71/6l5DWx4xPM16iU2yae7MK0nd6xyvlpBL5gHuYYKMeHd1cg8zVe76Y/740oR4n TPRELZ2+JdOeveuMobwNFOi1BUqk8eHsRIjF35/NCNgZpsywPGMsnBxU/LhWghxu8ddm 7Ogw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=HmgiYw3Ezgtgc0Fnyw2i+o//lXCiSoYu98n5jTUuNLE=; b=Z4swqEYLLZko/8DGFtudX6fX0yOZcHdl+6P6Okt7LSR1rBKTdOAinU/BLvzLaJ6f/I 8XWE97n/SpwZOsPMdIAUgbjiTXa8RSDqPi+RmXB8V2OwJkCnIRXlnskFH5O2fjvzZQUr Tf/B25Kbmst7tWE8k83PJEW70N5JK44z3QcxpJTVzOZWVGo3L6GVl5+ztO2n01PxwjrM IF1/tpCvHCDzm2et6nzlVK02g3Dh9Q9WCk/W2I9qnhr4OKapueBbdagNoz2WqYkwuII4 lfrddYNiAyRksxCYrBLjAGdzCUjWM/0geW7Gs01LmC74uDz9epMuZ556deKsN3dUznYG LEUg== X-Gm-Message-State: AFqh2krIVq0a4iot0wqaQnuStNoch+AoEMRiu1X65terTpaGFG6OW6AP OdxDY9EQqUMyorcuWCf4RX+YioIbo/+Xk5ukauqf X-Received: by 2002:a17:906:c041:b0:834:5c4a:26cb with SMTP id bm1-20020a170906c04100b008345c4a26cbmr399789ejb.653.1671530523429; Tue, 20 Dec 2022 02:02:03 -0800 (PST) MIME-Version: 1.0 References: <20221205084127.535-1-xieyongji@bytedance.com> <20221205084127.535-6-xieyongji@bytedance.com> In-Reply-To: From: Yongji Xie Date: Tue, 20 Dec 2022 18:01:51 +0800 Message-ID: Subject: Re: [PATCH v2 05/11] vduse: Introduce bound workqueue for irq injection To: Jason Wang Cc: "Michael S. Tsirkin" , Thomas Gleixner , Christoph Hellwig , virtualization , linux-kernel Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,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, Dec 20, 2022 at 2:28 PM Jason Wang wrote: > > On Mon, Dec 19, 2022 at 1:04 PM Yongji Xie wrote: > > > > On Fri, Dec 16, 2022 at 12:02 PM Jason Wang wrote: > > > > > > On Mon, Dec 5, 2022 at 4:44 PM Xie Yongji wrote: > > > > > > > > This introduces a bound workqueue to support running > > > > irq callback in a specified cpu. > > > > > > > > Signed-off-by: Xie Yongji > > > > --- > > > > drivers/vdpa/vdpa_user/vduse_dev.c | 29 ++++++++++++++++++++++------- > > > > 1 file changed, 22 insertions(+), 7 deletions(-) > > > > > > > > diff --git a/drivers/vdpa/vdpa_user/vduse_dev.c b/drivers/vdpa/vdpa_user/vduse_dev.c > > > > index 37809bfcb7ef..d126f3e32a20 100644 > > > > --- a/drivers/vdpa/vdpa_user/vduse_dev.c > > > > +++ b/drivers/vdpa/vdpa_user/vduse_dev.c > > > > @@ -57,6 +57,7 @@ struct vduse_virtqueue { > > > > struct vdpa_callback cb; > > > > struct work_struct inject; > > > > struct work_struct kick; > > > > + int irq_effective_cpu; > > > > > > I wonder why it's a cpu number instead of a cpumask. The latter seems > > > more flexible, e.g when using NUMA. > > > > > > > This variable represents the CPU that runs the interrupt callback > > rather than CPU affinity. > > Ok, but for some reason it only gets updated when a new affinity is set? > Yes, since we don't use round-robin now. And if affinity is not set, we rollback to the default behavior (use un-bounded workqueue to run irq callback). > (Btw, I don't see how the code deals with cpu hotplug, do we need > cpuhot notifier?) > Currently the queue_work_on() can handle the cpu hotplug case, so I think we can simply check whether the CPU is online each time queuing the kwork, then update the affinity if needed. Thanks, Yongji