Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp3633819rwj; Mon, 19 Dec 2022 23:00:48 -0800 (PST) X-Google-Smtp-Source: AMrXdXtw75oTqdWXgsEnWyeOpSkeYRrbbNV48XDx7JthMbwpnGIUmxV9uXBluE2FlnmvKylVJULA X-Received: by 2002:a17:90a:108f:b0:21a:20f9:262f with SMTP id c15-20020a17090a108f00b0021a20f9262fmr13090191pja.7.1671519648494; Mon, 19 Dec 2022 23:00:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671519648; cv=none; d=google.com; s=arc-20160816; b=g+fNpN2viWTGue1PE88ERM4KO1W2guKj9ZwHtVg6TIYR1gCyOgA8sOcKwr1ac5vDxd bG7VfVzz4AqsLOoUBXwL6HJyYYmzeCpr/620ZHJKGiW0/bfJAYqb9/Pz7Oerzy/VtGI5 X64mj8GA14c7gaVag3QCWB3pzRoNRdV8b+HIHltu5rtH+FDUA0R/5mjYlUiXlIecBgZW KS8lj/bgy/Hcs4piR5Gm2DAG80HfuS0LOsTMjnN6Frg0iLH3sDddzzCByS+nqqXu+//P oZhpzda7c4f52vKGNGm7zx1nmpMyFSUPW/V7H1R2UdSssvnxjsRM5b9nTrrzhLKTtQa1 fBHg== 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=SZk3qbzZQcmYDjImwMsiBT91DtulhDzTYm0+1LHAV3w=; b=Y3F445ZzdJ0RIbN9ac6kvSsqz+LfvbXvb8WX7/LRmofmHIlPNVPedQu0he5O81ZI7m fTO/shXhlZMKB1tOqNjawrU5Krk0bjuMy6l6H/yim3NFmONnDwA9ZXvDuFNSUxW/PhYG 6x8aso1W9lrVpNzE7qJX8Yv+Douem/i8GSGbmlWqN0JLqTWM8f3LdRjvSwaGptFpOkvU vyvwtyZp/kac37w6i08f+ZD9V1zTFwH2IescUWE3YLcQwJU8JTsmeGfVdjINGoGT8Avv L0uV4fJmDW8VFoEZzyCX6sFbHOTiMDlRaAqmNCK7QEv0tLHkwzbPeBw/Ato1H3FZFJaC hp0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=IW3qSjbK; 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 k7-20020a17090a514700b00219d31681b8si17435034pjm.42.2022.12.19.23.00.39; Mon, 19 Dec 2022 23:00:48 -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=IW3qSjbK; 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 S229866AbiLTGcM (ORCPT + 70 others); Tue, 20 Dec 2022 01:32:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40782 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229662AbiLTGcK (ORCPT ); Tue, 20 Dec 2022 01:32:10 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E86910A9 for ; Mon, 19 Dec 2022 22:31:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1671517885; 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=SZk3qbzZQcmYDjImwMsiBT91DtulhDzTYm0+1LHAV3w=; b=IW3qSjbKUr/0Da4mswqkjWfZwuJDCdURgs5e8MZ7+itrnID+qaTjdMQCavlhK++tTB+GQw JI/LWnzxpe/n6r+zc4DYmfdBIDtJQq3ZyefqTff+uonb0SCjiAUUHhORos4BzhHQa/L0xv 3Y2tfIkN2gTkmxIpg7FHPogokrrquT0= Received: from mail-oo1-f69.google.com (mail-oo1-f69.google.com [209.85.161.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-447-pIp4y_v4MKmf0t36tn7gZA-1; Tue, 20 Dec 2022 01:31:24 -0500 X-MC-Unique: pIp4y_v4MKmf0t36tn7gZA-1 Received: by mail-oo1-f69.google.com with SMTP id v10-20020a4a860a000000b00480b3e2b5afso5247890ooh.12 for ; Mon, 19 Dec 2022 22:31:24 -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=SZk3qbzZQcmYDjImwMsiBT91DtulhDzTYm0+1LHAV3w=; b=k30KByGxvT1W1uUxwa6Y+O8TIbgZW3Ug3uPRZs8eprWqzU3+MO+OPAj+GiHhYOaW5w fsU6vmsz5/+3gl6Y2flLj5tqaFxppcmam0HrlLpfplBEp0pS2QTNR7sO4kFctR+j6GvF Vi+m/eBmMjOMp1wL184fXQKFJqS1n/z2++jq3VXt0yKOsN4vs/AUsytDzPGf5wUvthdE RnTnIe27LjI4cqkDOLRuw3jqJRALKvJHkzZWdQI9Yf95YaQNpc3rlrAR6DbXW8q8DRJ8 pMR2WP/PbY2FtSAVVpOpQ5sQj2D11D2NHX7x+voX41eIAtEZunhWM4nf/ulrtDJL+zC9 W7ZQ== X-Gm-Message-State: AFqh2kpTjaeARkuPfkhxrVMTxWl3dnmARm/2+FomZN5wgwsowlXKudPa Y/pOjqz/vW0pTKdsn1CwQnmXVcx88ajT1FkVoAieg3qoYEShIeUV4ZcUb7eCBC4YbGbznt19C4+ OM+TdKSP2nf0air4IKv2cCz8t6lrbdvLbykRjPBVi X-Received: by 2002:a05:6870:bb1a:b0:144:b22a:38d3 with SMTP id nw26-20020a056870bb1a00b00144b22a38d3mr1889640oab.280.1671517883497; Mon, 19 Dec 2022 22:31:23 -0800 (PST) X-Received: by 2002:a05:6870:bb1a:b0:144:b22a:38d3 with SMTP id nw26-20020a056870bb1a00b00144b22a38d3mr1889637oab.280.1671517883295; Mon, 19 Dec 2022 22:31:23 -0800 (PST) MIME-Version: 1.0 References: <20221205084127.535-1-xieyongji@bytedance.com> <20221205084127.535-4-xieyongji@bytedance.com> In-Reply-To: From: Jason Wang Date: Tue, 20 Dec 2022 14:31:12 +0800 Message-ID: Subject: Re: [PATCH v2 03/11] vdpa: Add set_irq_affinity callback in vdpa_config_ops 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 Mon, Dec 19, 2022 at 3:12 PM Yongji Xie wrote: > > On Mon, Dec 19, 2022 at 2:06 PM Jason Wang wrote: > > > > On Mon, Dec 19, 2022 at 12:39 PM Yongji Xie wrote: > > > > > > On Fri, Dec 16, 2022 at 11:58 AM Jason Wang wrote: > > > > > > > > On Mon, Dec 5, 2022 at 4:43 PM Xie Yongji wrote: > > > > > > > > > > This introduces set_irq_affinity callback in > > > > > vdpa_config_ops so that vdpa device driver can > > > > > get the interrupt affinity hint from the virtio > > > > > device driver. The interrupt affinity hint would > > > > > be needed by the interrupt affinity spreading > > > > > mechanism. > > > > > > > > > > Signed-off-by: Xie Yongji > > > > > --- > > > > > drivers/virtio/virtio_vdpa.c | 4 ++++ > > > > > include/linux/vdpa.h | 8 ++++++++ > > > > > 2 files changed, 12 insertions(+) > > > > > > > > > > diff --git a/drivers/virtio/virtio_vdpa.c b/drivers/virtio/virtio_vdpa.c > > > > > index 08084b49e5a1..4731e4616ee0 100644 > > > > > --- a/drivers/virtio/virtio_vdpa.c > > > > > +++ b/drivers/virtio/virtio_vdpa.c > > > > > @@ -275,9 +275,13 @@ static int virtio_vdpa_find_vqs(struct virtio_device *vdev, unsigned int nvqs, > > > > > struct virtio_vdpa_device *vd_dev = to_virtio_vdpa_device(vdev); > > > > > struct vdpa_device *vdpa = vd_get_vdpa(vdev); > > > > > const struct vdpa_config_ops *ops = vdpa->config; > > > > > + struct irq_affinity default_affd = { 0 }; > > > > > struct vdpa_callback cb; > > > > > int i, err, queue_idx = 0; > > > > > > > > > > + if (ops->set_irq_affinity) > > > > > + ops->set_irq_affinity(vdpa, desc ? desc : &default_affd); > > > > > > > > I wonder if we need to do this in vhost-vDPA. > > > > > > I don't get why we need to do this in vhost-vDPA? Should this be done in VM? > > > > If I was not wrong, this tries to set affinity on the host instead of > > the guest. More below. > > > > Yes, it's host stuff. This is used by the virtio device driver to pass > the irq affinity hint (tell which irq vectors don't need affinity > management) to the irq affinity manager. In the VM case, it should > only be related to the guest's virtio device driver and pci irq > affinity manager. So I don't get why we need to do this in vhost-vDPA. It's not necessarily the VM, do we have the same requirement for userspace (like DPDK) drivers? Thanks > > > > > > > > Or it's better to have a > > > > default affinity by the vDPA parent > > > > > > > > > > I think both are OK. But the default value should always be zero, so I > > > put it in a common place. > > > > I think we should either: > > > > 1) document the zero default value in vdpa.c > > 2) set the zero in both vhost-vdpa and virtio-vdpa, or in the vdpa core > > > > Can we only call it in the virtio-vdpa case? Thus the vdpa device > driver can know whether it needs to do the automatic irq affinity > management or not. In the vhost-vdpa case, we actually don't need the > irq affinity management. > > Thanks, > Yongji >