Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp5052378rwj; Tue, 20 Dec 2022 19:45:11 -0800 (PST) X-Google-Smtp-Source: AMrXdXsBEjypY5fD3QhDho3x8Tp4p6DLIJRPjjmtfZsmcylsI6YbufWI//Rr41IDbTge9ov8+8A8 X-Received: by 2002:a05:6a20:d38c:b0:af:a276:2f94 with SMTP id iq12-20020a056a20d38c00b000afa2762f94mr902307pzb.35.1671594310867; Tue, 20 Dec 2022 19:45:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671594310; cv=none; d=google.com; s=arc-20160816; b=pZBRb0dFlOgB4pc8AjM07ldsYHvc/QY26pwVHzCptIg/ya4Xs/PO1CYvJQDP0FUiHT Gskw1M6NpZSutZFeB/mRfnWGu/MDrf3TbJfMMnwaSyz6Ush8cYzrIe9sUXX5wbwQiKoK OdYgq0ji6TwRqLfopvoXJbf/ZiXeu5GA2ZtUEX/1VhMoFEWDgp4r8dxLsGMjg7vOrG+6 bxFTJJfFYZwMw/cBEUQ4amSinwjsWnNBb7m/89L4yp0+Z0JzryRPLa9w5JqbL2vYWM7i 0Hk0Y5SBi/GsLTezIly2jsD7m4/v8OKG9XhC1FhT+9QadYYEo8YpSJRJ85lfdpcGX1xR xr0A== 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=5PhGqrRUN76i46hBbm+WOniSm6R7Qnx8r/lonz443aM=; b=AwGzvZmf2IJmGzoY5cXkba4qw2zZkXQ3qJ2waoft3esiRgE3lpxZkFP3FMVwbTVzTi ITVrve7mxsXgwO8RC6139mXJlCCzluEUY9YLO06TjG4S1XWbgTqk3aCiLjVN2LkB+Wg4 IktqScUn4Fsp43o6IzBu5u0MtcvciMeTaFnGoc1hn8ZzXRnJl1qUcMPAmi073++yA6KA zY0sLZA5PaKIZ1ONrupWGSbv9GV/nVjkvQM8u7XIwGUJY89cO6gWUzZ3COe1PnwfPfqi PgSAqB+Zsl+S/5dqCqXkCYk2wFbzJgV7mU4e7D36K3x9UWRznWZMU6dyhZMM7lYLvxI7 yYAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=NO0s15sf; 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=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r9-20020a63fc49000000b00475abba079bsi14902768pgk.405.2022.12.20.19.45.01; Tue, 20 Dec 2022 19:45:10 -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=@redhat.com header.s=mimecast20190719 header.b=NO0s15sf; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229652AbiLUDVC (ORCPT + 69 others); Tue, 20 Dec 2022 22:21:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229482AbiLUDU6 (ORCPT ); Tue, 20 Dec 2022 22:20:58 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA6F51FCE6 for ; Tue, 20 Dec 2022 19:20:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1671592809; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=5PhGqrRUN76i46hBbm+WOniSm6R7Qnx8r/lonz443aM=; b=NO0s15sfbYEoHsCKAAjLwetOJbs7W/QeeBFXdGbwR8Y3PCs97ZPhXh4MhQfEs2tP3CFwJC oRn4dOanxcy1rQ9EBfMPNpieclBZi+5GpkT4ngqPNIMzQ8W0+zKWhUfUhL5GZNWyHU797n /QX6Z5GFjdDNn2xsBqdM4EC/35qbs7k= Received: from mail-oa1-f69.google.com (mail-oa1-f69.google.com [209.85.160.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-12-4zk5h8pSM8KtiQTmq9J3Qw-1; Tue, 20 Dec 2022 22:20:08 -0500 X-MC-Unique: 4zk5h8pSM8KtiQTmq9J3Qw-1 Received: by mail-oa1-f69.google.com with SMTP id 586e51a60fabf-1438729f685so6351436fac.19 for ; Tue, 20 Dec 2022 19:20:07 -0800 (PST) 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=5PhGqrRUN76i46hBbm+WOniSm6R7Qnx8r/lonz443aM=; b=UfJ2TzndHBRKL7Mkv3e5b+pRxkcZ1GRgMFN/nyvUvNvTe8ghGbHiJuW2V7z9f88Osg 9sCInzPQQwLrrNHYK2FSsvO/EIgllvJ7WQ8Xpj2cPEPhqxSGSeDkMq5U0Baxpnk/3fSJ 1RPkmJYFjHSRrgbXc6svyOLixLgTTdNNzIDOSp6sgTS03x2AZJYKJ2s/rxKumvxm2+5e 8bgNh1Jh5M7XmPTRBtHSnbrdFK+iqqGUeUiAVBlqXR2ouGnbZMl2oh3KjG73opRLljtz Co9Q20TCf198Y1QcQGwuaOKwqtXmfHoTPTjYr7YcYHzQ4cP4WV5oRHRisXceQqpEx88i OpeA== X-Gm-Message-State: AFqh2koQTxneb731Y2FheF3HDADPfaIDzxL+yq2yevYGyFxSKgPc9qyR 2ktkWAsq64izs4RZYMhV9SNDRAJlJRhPramn36/7lum0nXXZD3zDEIFpZ5cQsgknTysIr+z+fzN AboepA4RPVu53cBrxIjP6o/tKHlEoeLi+8l8v++I/ X-Received: by 2002:a05:6870:3d97:b0:144:b22a:38d3 with SMTP id lm23-20020a0568703d9700b00144b22a38d3mr3041oab.280.1671592807427; Tue, 20 Dec 2022 19:20:07 -0800 (PST) X-Received: by 2002:a05:6870:3d97:b0:144:b22a:38d3 with SMTP id lm23-20020a0568703d9700b00144b22a38d3mr3040oab.280.1671592807260; Tue, 20 Dec 2022 19:20:07 -0800 (PST) MIME-Version: 1.0 References: <20221205084127.535-1-xieyongji@bytedance.com> <20221205084127.535-6-xieyongji@bytedance.com> In-Reply-To: From: Jason Wang Date: Wed, 21 Dec 2022 11:19:56 +0800 Message-ID: Subject: Re: [PATCH v2 05/11] vduse: Introduce bound workqueue for irq injection To: Yongji Xie Cc: "Michael S. Tsirkin" , Thomas Gleixner , Christoph Hellwig , virtualization , linux-kernel Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE 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 6:02 PM Yongji Xie wrote: > > 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. Right. Thanks > > Thanks, > Yongji >