Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp100564rdb; Thu, 21 Dec 2023 04:09:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IG4C6YCR9ckD7GlpPljqJwx+e8MV/UOrFinDZ+FtpakwV/SZf11wNFTTbUqa6Zg+3nXwNGw X-Received: by 2002:a17:902:d4c9:b0:1d0:ad56:d879 with SMTP id o9-20020a170902d4c900b001d0ad56d879mr13180570plg.14.1703160567076; Thu, 21 Dec 2023 04:09:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703160567; cv=none; d=google.com; s=arc-20160816; b=KeItCsNtO735E66gKvbUF1EWWxEhqPnqq/kABUZgBgqTevoXS4xKyRQne5CuSgpPew YV7noJQmv9/fUiPXCKKAEeQF4UHGOL7AybJcdtRj/njxFE71SrQuiSexS2axZ0yKMmnq B296x+/5IyMXuaSD+hBYNlfKom5jYNrO0WNz7B2LQJoRJcLEu/ltt0mWjGiWZk/sqn5l wUyjYoKV6GI5T0Z6jDfIRt8vHi7GeWME05oqgQV4JBO3JJj709cH7c6OsEKnt0JAZjpx FV+mEmK01MWqp6SKliA7EK6dyH3Gvud0+3cKPXM3X/gjEpHCemajPc9EPxCMgMHXwNQa hjcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=u2zddOQ1qeYa0ve/5dlXq/cgaEaRPGUue1VUy/g3vDE=; fh=Y+QJZVm8ah60RElzx+j09RzIAjh6kHSyY66+GOw3f7E=; b=BKwCqbffG+6fJWR5aKV4Ifn5IFe62/Uqd4WokIcWdw8je6Vvz6POEk7K7Pf5zZZOHn ZsIWuf6NvkVjr/yKgjuhdqmjkCwLuYyCAdcXTOLmXRDUmMll5P+j9lQAmMdyPmGtiXg6 SAB6asBhuz/eTfBJWyf4+LKzkqoQrZwtFOdWFulJWvpAf8mO+eUtWe84C96UhpWlo6mM X/nTfcdoDJdLr9DellaZquADvFFtHkdF11DnQaSBmDyxPbxU/zjrjANkpGldUlrGJGOz BQG5V+bzg0eA1MWDGq9y0Qg/GTRe4J8ItGllTLk3cqsKfdX77v+nWPC+vNv2Jx0VshuU 33hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=P16zovW2; spf=pass (google.com: domain of linux-kernel+bounces-8313-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8313-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id m10-20020a170902db0a00b001d33a8a3df6si1215873plx.506.2023.12.21.04.09.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 04:09:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-8313-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=P16zovW2; spf=pass (google.com: domain of linux-kernel+bounces-8313-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8313-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 424FCB24223 for ; Thu, 21 Dec 2023 12:09:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6DD036E59E; Thu, 21 Dec 2023 12:09:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="P16zovW2" X-Original-To: linux-kernel@vger.kernel.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 329E56E2BF for ; Thu, 21 Dec 2023 12:09:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1703160547; 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=u2zddOQ1qeYa0ve/5dlXq/cgaEaRPGUue1VUy/g3vDE=; b=P16zovW23++TbKf9GYzsdnwGBdVIZT0rtU5lkxXzHqy1IO8Qun2IRYgxL4j7X1ZaiSv2PC bkWxfPxLZm9PCmaJkp7v7eAQ7BGbOKiT57K7+w/daUVV5Ss55w8CMBX54MkaeALLR6NXJA BdItMIiAxIEIJVPpMlDu4ZxnqbBzdr4= Received: from mail-yw1-f198.google.com (mail-yw1-f198.google.com [209.85.128.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-618-7lnz2j0_NH-LM2P-W2QkxA-1; Thu, 21 Dec 2023 07:09:05 -0500 X-MC-Unique: 7lnz2j0_NH-LM2P-W2QkxA-1 Received: by mail-yw1-f198.google.com with SMTP id 00721157ae682-5e6fe91c706so13079897b3.2 for ; Thu, 21 Dec 2023 04:09:05 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703160545; x=1703765345; h=content-transfer-encoding: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=u2zddOQ1qeYa0ve/5dlXq/cgaEaRPGUue1VUy/g3vDE=; b=e8Nqh5Xeh6s1PjCCU9N5u9PU1/w/bxvwiOJpIW8cmi3ckS5A+ahFXP2qtU7QfeNkW/ SJN1JQuVc726KqNBZbed72rAA1ieNapka1Meiov6jpck5c0i5PDdSGk8BWwbYnM8MSzq bya/pku4/22WK4GbBuo1StRDUkwt5+HYtOKE5GjvXKw0wp/1rrOSjq/ezRSxzinFlW2x SGIiVKBHoeh3PhIhlC6bPSGkKHTXqTs2lVEMeFXJE4UXv+ph0QleuyJFSp7v+LJRfyR3 A81YTF4jLeF4vZ4nZpyEO5ICR5RHH9gt8+aTrM/QFPddmhwqs6hG4yP9pv98vIRwZNCI kzTA== X-Gm-Message-State: AOJu0YxmGin2W6KE4CdgpcOWmW+PPthcxm64f6p2zn7fB2T7dce5JSwJ 2UUojeAr78TcatcVTfmIohALOoOWSwct/TiZmdv9ImRyh7m0FZ0jMA6tTqt9JyOfaKpjHF/UsTY xCKlvlU6ats0rvyl8BFrkJewLgjRMPIkTkqyhIHHA X-Received: by 2002:a0d:eacc:0:b0:5e8:d7b2:cdcd with SMTP id t195-20020a0deacc000000b005e8d7b2cdcdmr1029732ywe.48.1703160544739; Thu, 21 Dec 2023 04:09:04 -0800 (PST) X-Received: by 2002:a0d:eacc:0:b0:5e8:d7b2:cdcd with SMTP id t195-20020a0deacc000000b005e8d7b2cdcdmr1029718ywe.48.1703160543744; Thu, 21 Dec 2023 04:09:03 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20231219180858.120898-1-dtatulea@nvidia.com> <20231219180858.120898-3-dtatulea@nvidia.com> <70adc734331c1289dceb3bcdc991f3da7e4db2f0.camel@nvidia.com> In-Reply-To: <70adc734331c1289dceb3bcdc991f3da7e4db2f0.camel@nvidia.com> From: Eugenio Perez Martin Date: Thu, 21 Dec 2023 13:08:27 +0100 Message-ID: Subject: Re: [PATCH vhost v4 02/15] vdpa: Add VHOST_BACKEND_F_CHANGEABLE_VQ_ADDR_IN_SUSPEND flag To: Dragos Tatulea Cc: "jasowang@redhat.com" , "xuanzhuo@linux.alibaba.com" , Parav Pandit , "virtualization@lists.linux-foundation.org" , Gal Pressman , "linux-kernel@vger.kernel.org" , "si-wei.liu@oracle.com" , "kvm@vger.kernel.org" , "mst@redhat.com" , Saeed Mahameed , "leon@kernel.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Dec 21, 2023 at 12:52=E2=80=AFPM Dragos Tatulea wrote: > > On Thu, 2023-12-21 at 08:46 +0100, Eugenio Perez Martin wrote: > > On Thu, Dec 21, 2023 at 3:03=E2=80=AFAM Jason Wang wrote: > > > > > > On Wed, Dec 20, 2023 at 9:32=E2=80=AFPM Eugenio Perez Martin > > > wrote: > > > > > > > > On Wed, Dec 20, 2023 at 5:06=E2=80=AFAM Jason Wang wrote: > > > > > > > > > > On Wed, Dec 20, 2023 at 11:46=E2=80=AFAM Jason Wang wrote: > > > > > > > > > > > > On Wed, Dec 20, 2023 at 2:09=E2=80=AFAM Dragos Tatulea wrote: > > > > > > > > > > > > > > The virtio spec doesn't allow changing virtqueue addresses af= ter > > > > > > > DRIVER_OK. Some devices do support this operation when the de= vice is > > > > > > > suspended. The VHOST_BACKEND_F_CHANGEABLE_VQ_ADDR_IN_SUSPEND = flag > > > > > > > advertises this support as a backend features. > > > > > > > > > > > > There's an ongoing effort in virtio spec to introduce the suspe= nd state. > > > > > > > > > > > > So I wonder if it's better to just allow such behaviour? > > > > > > > > > > Actually I mean, allow drivers to modify the parameters during su= spend > > > > > without a new feature. > > > > > > > > > > > > > That would be ideal, but how do userland checks if it can suspend + > > > > change properties + resume? > > > > > > As discussed, it looks to me the only device that supports suspend is > > > simulator and it supports change properties. > > > > > > E.g: > > > > > > static int vdpasim_set_vq_address(struct vdpa_device *vdpa, u16 idx, > > > u64 desc_area, u64 driver_area, > > > u64 device_area) > > > { > > > struct vdpasim *vdpasim =3D vdpa_to_sim(vdpa); > > > struct vdpasim_virtqueue *vq =3D &vdpasim->vqs[idx]; > > > > > > vq->desc_addr =3D desc_area; > > > vq->driver_addr =3D driver_area; > > > vq->device_addr =3D device_area; > > > > > > return 0; > > > } > > > > > > > So in the current kernel master it is valid to set a different vq > > address while the device is suspended in vdpa_sim. But it is not valid > > in mlx5, as the FW will not be updated in resume (Dragos, please > > correct me if I'm wrong). Both of them return success. > > > In the current state, there is no resume. HW Virtqueues will just get re-= created > with the new address. > Oh, then all of this is effectively transparent to the userspace except for the time it takes? In that case you're right, we don't need feature flags. But I think it would be great to also move the error return in case userspace tries to modify vq parameters out of suspend state. Thanks! > > How can we know in the destination QEMU if it is valid to suspend & > > set address? Should we handle this as a bugfix and backport the > > change? > > > > > > > > > > The only way that comes to my mind is to make sure all parents retu= rn > > > > error if userland tries to do it, and then fallback in userland. > > > > > > Yes. > > > > > > > I'm > > > > ok with that, but I'm not sure if the current master & previous ker= nel > > > > has a coherent behavior. Do they return error? Or return success > > > > without changing address / vq state? > > > > > > We probably don't need to worry too much here, as e.g set_vq_address > > > could fail even without suspend (just at uAPI level). > > > > > > > I don't get this, sorry. I rephrased my point with an example earlier > > in the mail. > > >