Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp717319pxb; Tue, 2 Feb 2021 16:32:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJyxMFFux/DqjMaqNFBTKyjQkFJVtczNtcsrbGqNnwh/tZWz4N9FYFKRYk9Q0wlSTn7lRaec X-Received: by 2002:a17:906:c78b:: with SMTP id cw11mr567105ejb.448.1612312376254; Tue, 02 Feb 2021 16:32:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612312376; cv=none; d=google.com; s=arc-20160816; b=GiQ8iZGcqSLvwZPRs5Mg9xaXs3zCVzH+/nsN8WoAt1Rafdj2qeFpUAa6Jons75QgGB Si2CEJW6kWyO4RSSZnrqP9zRXUo35aDp/GXG9gx7zhY8G4BnP/YIW/x3FtFHLSijGiEs cHulSzMKY/zJCaQN7JV9s1q2RFafx349RCyjdW09jLsCKX7ciby9BVrmOH/Pl7vIZgwV e5gxFaa7092mHtAFgHca6aTYW0+x4FftwwpbIiQjiy0bnVnD+6uAlglAj0fw+R6CXZEJ ZACt8OH6vH38uJUc9BbMzDHgW91+EyjDfuCYbz03wzzMTN61uvU4QT/fqauRyBLQtVn5 wzeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=HoV6WmzOM8JYFHRnbfZo8tVfL3dwzU/hINcFi1knTHc=; b=FXpZhr1vCRyQfHZkh8SCfCgO94pfRwirUtiOdakoDyy4rykRyhxgFJ9trTD1DGZz+0 O0jIymRBPUJlfKmZK0W5u7NiLlOM0KKMuG85tnFK25jaQrIRWloP6t3jI+kz/LltcCW7 yz2kMz5ROIg6byBDCOV7eTB7kda2ryxhj2UGu/tgNr1+XlrvVF4ARjFBnMsacb5khJ99 4UNJ1MXcjVBkiR54dqPE661oOBAnCv7Lt9/8bZ+gvVAsqIk1C32r+A23LSh7LojnWDT4 /jFX0BvhhAplsh215AiQAZFx1KH7bK7xLMKFYmzBS+Y62PuQnAS3xZxBiJKRUSjR922L 9sUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=XdOENgkv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k8si208377edx.303.2021.02.02.16.32.27; Tue, 02 Feb 2021 16:32:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=XdOENgkv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S238104AbhBBSIg (ORCPT + 99 others); Tue, 2 Feb 2021 13:08:36 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:32302 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233925AbhBBOHw (ORCPT ); Tue, 2 Feb 2021 09:07:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612274784; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HoV6WmzOM8JYFHRnbfZo8tVfL3dwzU/hINcFi1knTHc=; b=XdOENgkvd8cmfnUccX7rF6hlKCiuqTtBIxsmDjpZ2YR26jORetIwvgAU7qJnzJ3V2B+arW Gnad8E++TJ1An6rtvQIyGM+6Ms32KHnZYeGicV6u07zYVv7zRD3wLBYNJanERucDxmiafM hWPZrp+pK2ruN4EzDJEIAyMcdL870Po= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-283-8X0eXTvmNuyA4QDEKnCY3A-1; Tue, 02 Feb 2021 09:06:22 -0500 X-MC-Unique: 8X0eXTvmNuyA4QDEKnCY3A-1 Received: by mail-wm1-f70.google.com with SMTP id y9so1010490wmj.7 for ; Tue, 02 Feb 2021 06:06:22 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=HoV6WmzOM8JYFHRnbfZo8tVfL3dwzU/hINcFi1knTHc=; b=EIQFG6w1vi/KY3p6iHWR8A4C7WakWYf6jCTyKyjQp2auPT1qip2+OiFLynJZm7xpxY 75b3IchqNSTD9x5dIomjdj7pvrvbhNMwEHdflUkahjfrvy014YgVgyQaCpsHKMN4ti6s 6/ls2bGNaVhz6eqRuAKsszg4T5jM+CS8MHwTC8oxKvajYoDI1FlPG0JeJVPVEUpRfKG4 OxrjIaJ2DxF9RrDium9lQ9MHgT7OMgKtEEWqcUl/0cU/92PNrWmROaYSS0kPDrtCN7lD fumUSQrQkqoHJHYSfVG6xEm0FrPqNteF+D/KLcQqsjUrsd10BnhTq3dwdmDMFEMHlj4a EFVQ== X-Gm-Message-State: AOAM5309n6EZD76IKX0h8r0TKeT6fDZjx5T6Urp0+B4v+bPnRLHEO5Gh pegkgV5Oa6TK+dq0Vu8cphBy5ADAaiKxn1jQ2Hb12lQ0BKOOg5WuS9U0EeLzswsCi+ymZ7c1V7A BORINkkoUszlGI4Bdws5frC2X X-Received: by 2002:a1c:2d0b:: with SMTP id t11mr3742608wmt.109.1612274781424; Tue, 02 Feb 2021 06:06:21 -0800 (PST) X-Received: by 2002:a1c:2d0b:: with SMTP id t11mr3742583wmt.109.1612274781204; Tue, 02 Feb 2021 06:06:21 -0800 (PST) Received: from redhat.com (bzq-79-177-39-148.red.bezeqint.net. [79.177.39.148]) by smtp.gmail.com with ESMTPSA id o124sm3431503wmb.5.2021.02.02.06.06.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Feb 2021 06:06:20 -0800 (PST) Date: Tue, 2 Feb 2021 09:06:17 -0500 From: "Michael S. Tsirkin" To: Eli Cohen Cc: Si-Wei Liu , Jason Wang , virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, lulu@redhat.com, Si-Wei Liu Subject: Re: [PATCH 1/2] vdpa/mlx5: Avoid unnecessary query virtqueue Message-ID: <20210202090558-mutt-send-email-mst@kernel.org> References: <20210128134130.3051-1-elic@nvidia.com> <20210128134130.3051-2-elic@nvidia.com> <9d6058d6-5ce1-0442-8fd9-5a6fe6a0bc6b@redhat.com> <20210202070055.GB232587@mtl-vdi-166.wap.labs.mlnx> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20210202070055.GB232587@mtl-vdi-166.wap.labs.mlnx> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 02, 2021 at 09:00:55AM +0200, Eli Cohen wrote: > On Mon, Feb 01, 2021 at 08:15:29PM -0800, Si-Wei Liu wrote: > > On Mon, Feb 1, 2021 at 7:13 PM Jason Wang wrote: > > > > > > > > > On 2021/2/2 上午3:17, Si-Wei Liu wrote: > > > > On Mon, Feb 1, 2021 at 10:51 AM Si-Wei Liu wrote: > > > >> On Thu, Jan 28, 2021 at 5:46 AM Eli Cohen wrote: > > > >>> suspend_vq should only suspend the VQ on not save the current available > > > >>> index. This is done when a change of map occurs when the driver calls > > > >>> save_channel_info(). > > > >> Hmmm, suspend_vq() is also called by teardown_vq(), the latter of > > > >> which doesn't save the available index as save_channel_info() doesn't > > > >> get called in that path at all. How does it handle the case that > > > >> aget_vq_state() is called from userspace (e.g. QEMU) while the > > > >> hardware VQ object was torn down, but userspace still wants to access > > > >> the queue index? > > > >> > > > >> Refer to https://lore.kernel.org/netdev/1601583511-15138-1-git-send-email-si-wei.liu@oracle.com/ > > > >> > > > >> vhost VQ 0 ring restore failed: -1: Resource temporarily unavailable (11) > > > >> vhost VQ 1 ring restore failed: -1: Resource temporarily unavailable (11) > > > >> > > > >> QEMU will complain with the above warning while VM is being rebooted > > > >> or shut down. > > > >> > > > >> Looks to me either the kernel driver should cover this requirement, or > > > >> the userspace has to bear the burden in saving the index and not call > > > >> into kernel if VQ is destroyed. > > > > Actually, the userspace doesn't have the insights whether virt queue > > > > will be destroyed if just changing the device status via set_status(). > > > > Looking at other vdpa driver in tree i.e. ifcvf it doesn't behave like > > > > so. Hence this still looks to me to be Mellanox specifics and > > > > mlx5_vdpa implementation detail that shouldn't expose to userspace. > > > > > > > > > So I think we can simply drop this patch? > > > > Yep, I think so. To be honest I don't know why it has anything to do > > with the memory hotplug issue. > > No relation. That's why I put them in two different patches. Only the > second one is the fix as I stated in the cover letter. > > Anyway, let's just take the second patch. > > Michael, do you need me to send PATCH 2 again as a single patch or can > you just take it? Pls post fixes separately. Thanks! > > > > > -Siwei > > > > > > > > Thanks > > > > > > > > > >> -Siwei > > > >> > > > >> > > > >>> Signed-off-by: Eli Cohen > > > >>> --- > > > >>> drivers/vdpa/mlx5/net/mlx5_vnet.c | 8 -------- > > > >>> 1 file changed, 8 deletions(-) > > > >>> > > > >>> diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c > > > >>> index 88dde3455bfd..549ded074ff3 100644 > > > >>> --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c > > > >>> +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c > > > >>> @@ -1148,8 +1148,6 @@ static int setup_vq(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue *mvq) > > > >>> > > > >>> static void suspend_vq(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue *mvq) > > > >>> { > > > >>> - struct mlx5_virtq_attr attr; > > > >>> - > > > >>> if (!mvq->initialized) > > > >>> return; > > > >>> > > > >>> @@ -1158,12 +1156,6 @@ static void suspend_vq(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue *m > > > >>> > > > >>> if (modify_virtqueue(ndev, mvq, MLX5_VIRTIO_NET_Q_OBJECT_STATE_SUSPEND)) > > > >>> mlx5_vdpa_warn(&ndev->mvdev, "modify to suspend failed\n"); > > > >>> - > > > >>> - if (query_virtqueue(ndev, mvq, &attr)) { > > > >>> - mlx5_vdpa_warn(&ndev->mvdev, "failed to query virtqueue\n"); > > > >>> - return; > > > >>> - } > > > >>> - mvq->avail_idx = attr.available_index; > > > >>> } > > > >>> > > > >>> static void suspend_vqs(struct mlx5_vdpa_net *ndev) > > > >>> -- > > > >>> 2.29.2 > > > >>> > > >