Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2179023rwb; Thu, 15 Dec 2022 21:17:31 -0800 (PST) X-Google-Smtp-Source: AA0mqf66QvCO+SmqSARQ3dAfDfm8xIekdnSkhJuSvF587XwbV5EvQ0z/fJa/oUz3t0wQx6+PA9GT X-Received: by 2002:a17:902:7609:b0:185:441e:6ef3 with SMTP id k9-20020a170902760900b00185441e6ef3mr34231410pll.61.1671167851461; Thu, 15 Dec 2022 21:17:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671167851; cv=none; d=google.com; s=arc-20160816; b=MF7XQf/58K/9cA/PK+6nBBd4wVrld2iIbG2CznrMOl/WLpeFWSpM5tSh/vMZLdt0J5 6o2/wrlBeszdLDQKanTblaOSbc/ZdMTioioZtNV5QGdg1lHOaMPL7PBKHa+0+VFuVluJ xr3OnFHAP5TULT9/FBVAejZc2CtvnrIUVBPIngf3+JPQX9n10uZ/HmRICgiZdzrQpfgc ud8N6f/1LLEwJcDlExkwo97irmUgnLKXXxQoOHDbHbtbr1W12zJDEh5cH7fl7F26yqKg xiBmtFT1FdfQLwoly6hVNhnxNs4oZUVSqppPTLynFtswaRKxgt97hXkuV8inf7MtVSpC 4Ymw== 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=ZDZbw5KBbPfiS0aQTncakmGLck0pebaODb2v7fHtSkU=; b=TLceYDToHOHwHK//MXiCjoZc4vmbdHNY9BPBIerBTI5aQZjpUMgwhFrihOXm0vtC8M sgV9YwEijmdco7sOH2IWwAnBZbzrstk1jHg9/HudZ+dOtyTo1XYTmRKc/TiT6i1cKHx9 i6tL9GHykgEy4RfSvf1uzev/UJ1pRrXD1Yn48x+ow5HsxVFM5O1hoKjNKRxoOtiXyJfo 5+vZ2B4Gz5RmntXE8Yk1bAYGizMO4BsmIfK5KzvU+11dNwP3Att3oXGzvQJHe3ZKd6sI EP4+o5+o/cK0YdGrN4IR6HeXl4uKNZSU1RfD2kpjIMATs08MHARpqKQ3Djjt5+88K0vd TFLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=K5FGe97I; 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 bf5-20020a170902b90500b001898f8e6f6csi1383229plb.92.2022.12.15.21.17.22; Thu, 15 Dec 2022 21:17:31 -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=K5FGe97I; 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 S229928AbiLPD7U (ORCPT + 68 others); Thu, 15 Dec 2022 22:59:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229611AbiLPD7R (ORCPT ); Thu, 15 Dec 2022 22:59:17 -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 A7C2157B68 for ; Thu, 15 Dec 2022 19:58:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1671163108; 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=ZDZbw5KBbPfiS0aQTncakmGLck0pebaODb2v7fHtSkU=; b=K5FGe97IkNjfXBTxF0LGNcaYuRAQXLRE2YGPtaytDeklxN0OjL/Eg97aGBLesHMsClLcYU mEsqk0VIma13L3cMXeSmNeOecdg96LnFFbEckTrFK8R6tlkKFEiONYgMXuyxlmgfjlh58E 1ZMQ4dcRsWgsTS52NBX3ceQTQTxOy3s= Received: from mail-oi1-f199.google.com (mail-oi1-f199.google.com [209.85.167.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-364-gqvu7vqgOAaqwOVQr5SF0Q-1; Thu, 15 Dec 2022 22:58:26 -0500 X-MC-Unique: gqvu7vqgOAaqwOVQr5SF0Q-1 Received: by mail-oi1-f199.google.com with SMTP id bi37-20020a05680818a500b0035ea4ea8db5so369305oib.11 for ; Thu, 15 Dec 2022 19:58:26 -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=ZDZbw5KBbPfiS0aQTncakmGLck0pebaODb2v7fHtSkU=; b=rlW4IR6q4H/AJ9jRj8j6wX8cgiIz++qaSW6Sh/Cx6ndgFCkzAp8f7zOjtoDU2JULRj HlZXEPfgIw8M2mQd+h8fpVjvETShlA8xmHdmpyW4dmPqUm3ZBjGclwtX/xGWOxpcIBxe sHM6dePXk9usDdNva8ylH3VV3H9f9xfFObku9471+1hcWzj6bLp1EsPb2sJFCTskQnvY Gbx4e15FM9oWalm09cgyXMyVlEQ2q7jrx0Mhrn1GcegFR425bpTIZxORfDuZbLtgGShj aU/qeD8JWfmZwTL6+vJN8MTVmUr3pTQYdGKyrff31Z0Ts9/Nrt5qpzGug32VTcAEFBn2 6dhw== X-Gm-Message-State: ANoB5pmL3E4VuBwRTUkInNRcqCcmM1G4AkrFNbGrOJAenhUtU+rmtsTL Ve9k1CRRzOK+70uMeRRbtWaq4FfHfGzqI0eQpXFW2W4j8Faw78/aw/bw4p/iHYATGS6tlKveEUs YsfKcCX1z+4KcrmL71vVtUiJW3Xj8FNIzz3s0tHs4 X-Received: by 2002:a05:6870:9e8f:b0:144:a97b:1ae2 with SMTP id pu15-20020a0568709e8f00b00144a97b1ae2mr321068oab.35.1671163106199; Thu, 15 Dec 2022 19:58:26 -0800 (PST) X-Received: by 2002:a05:6870:9e8f:b0:144:a97b:1ae2 with SMTP id pu15-20020a0568709e8f00b00144a97b1ae2mr321067oab.35.1671163106015; Thu, 15 Dec 2022 19:58:26 -0800 (PST) MIME-Version: 1.0 References: <20221205084127.535-1-xieyongji@bytedance.com> <20221205084127.535-4-xieyongji@bytedance.com> In-Reply-To: <20221205084127.535-4-xieyongji@bytedance.com> From: Jason Wang Date: Fri, 16 Dec 2022 11:58:15 +0800 Message-ID: Subject: Re: [PATCH v2 03/11] vdpa: Add set_irq_affinity callback in vdpa_config_ops To: Xie Yongji Cc: mst@redhat.com, tglx@linutronix.de, hch@lst.de, virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org 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 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. Or it's better to have a default affinity by the vDPA parent itself. (Looking at virtio-pci, it doesn't do something like this). Thanks > + > for (i = 0; i < nvqs; ++i) { > if (!names[i]) { > vqs[i] = NULL; > diff --git a/include/linux/vdpa.h b/include/linux/vdpa.h > index 0ff6c9363356..482ff7d0206f 100644 > --- a/include/linux/vdpa.h > +++ b/include/linux/vdpa.h > @@ -256,6 +256,12 @@ struct vdpa_map_file { > * @vdev: vdpa device > * @idx: virtqueue index > * Returns the irq affinity mask > + * @set_irq_affinity: Pass the irq affinity hint from the virtio > + * device driver to vdpa driver (optional). > + * Needed by the interrupt affinity spreading > + * mechanism. > + * @vdev: vdpa device > + * @desc: irq affinity hint > * @set_group_asid: Set address space identifier for a > * virtqueue group (optional) > * @vdev: vdpa device > @@ -344,6 +350,8 @@ struct vdpa_config_ops { > const struct cpumask *cpu_mask); > const struct cpumask *(*get_vq_affinity)(struct vdpa_device *vdev, > u16 idx); > + void (*set_irq_affinity)(struct vdpa_device *vdev, > + struct irq_affinity *desc); > > /* DMA ops */ > int (*set_map)(struct vdpa_device *vdev, unsigned int asid, > -- > 2.20.1 >