Received: by 2002:a05:7412:a9a3:b0:f9:93eb:408e with SMTP id o35csp76510rdh; Wed, 20 Dec 2023 23:47:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IHh5gT20C/6XwkZOCLXrtWhLF/MKdPv4i/DfeVVRqbxpBYKAFmY5q1Ir/WAjMKYHePzv5Za X-Received: by 2002:a17:90a:c24d:b0:286:6cc0:62a6 with SMTP id d13-20020a17090ac24d00b002866cc062a6mr381915pjx.37.1703144847119; Wed, 20 Dec 2023 23:47:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703144847; cv=none; d=google.com; s=arc-20160816; b=l+YmSwe01HFfMtV9b01yv0AI98z5hHb04IVcZoSBqvAqo3ZicOOshRtiYrA/FXHsTA cqb95AGiOem4keR84/BwhVLE+3AUjUJLBDNIOz4VrkGpMt4HMpU8up5sunteM77zAFPL XoGOvJbDFq2l+vBdbv2qmAbEVnCYqamMZV3i50TbzO3yc4XV8gD71PpotUHl+4Dlg3nx iD5Bt/KAfciVp+Y49J0fcWJoki1qopxYUw1eJKNKmkWI/jU5SfgU4iMRCjXoOqeJ1B7/ lE6A/efcCGrTPPWQ0MCAd12Jg+0DD0MCluj+239dcJ9hxWaHEEo2s2UMb6KVn3F+YBwW T9Cw== 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=PlcV0Wl9P/jGyxXi9Ck909fZjHTENS6mZGvZmebR75E=; fh=hxXmUt799qooV3ViOShcE413A80tUh8nKexgab11OsU=; b=FCFoujYW0Tj3bLnmOhJDLsXtlwUT/rznNBYjlUzoRzDrAHscRRcIG3vBD8TlKnrulJ qQLTNYeBCVXvcEZLhPB0ryJerSKTPkAxOZaoZ/muO2rRTt5+PxioiDB0KXVyA4kro3ZX ++pgma3TjiuYrOvUar/R9ZSYBUsXc31vL/JdVFOEMxWQPYWI1GNCCt1rx+BWIzXVZqJh 9wNnmPEFwAKRi4W8cNC9fkl2a/4ijVqW5zgtrtO5cMWOdyxdQhlLOYuDLKTCL/6+oIi7 H1peluWvG6jmVo2K3cphUb/pyMk6bq9UjDs3FRbcC9OqH0ME8AzaX77h1PgpNECOVYa+ QxKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=WAQqCzvq; spf=pass (google.com: domain of linux-kernel+bounces-7961-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-7961-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id k6-20020a17090ac50600b0028b229b17besi4512217pjt.5.2023.12.20.23.47.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 23:47:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-7961-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=WAQqCzvq; spf=pass (google.com: domain of linux-kernel+bounces-7961-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-7961-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id C244F287D12 for ; Thu, 21 Dec 2023 07:47:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2F9CC15AE7; Thu, 21 Dec 2023 07:47:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="WAQqCzvq" X-Original-To: linux-kernel@vger.kernel.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.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 E914B154BB for ; Thu, 21 Dec 2023 07:47:14 +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=1703144833; 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=PlcV0Wl9P/jGyxXi9Ck909fZjHTENS6mZGvZmebR75E=; b=WAQqCzvqYqSg5dxbPn0SlabbzYmcu2i3Uh1eF4t5vzRKoGTDS8oU+qzG0GUCJu4E5hEr3P wR9SlruRuZhPg64NmPRxgjKgRlT/c+1S3srr8cgzHDg2UkhlYNgIyTavt9eKY5d7s2Su6P ZCJG1oXgDEPYxYeFgLL8OtVjDd2Tvzc= Received: from mail-yw1-f197.google.com (mail-yw1-f197.google.com [209.85.128.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-677--CZvqfnmMP-HaLsz99zk5Q-1; Thu, 21 Dec 2023 02:47:12 -0500 X-MC-Unique: -CZvqfnmMP-HaLsz99zk5Q-1 Received: by mail-yw1-f197.google.com with SMTP id 00721157ae682-5e8d966fbc0so5451917b3.1 for ; Wed, 20 Dec 2023 23:47:12 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703144831; x=1703749631; 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=PlcV0Wl9P/jGyxXi9Ck909fZjHTENS6mZGvZmebR75E=; b=iX3cJ1ywnLy1a1zNo3yO2m6CiMyMBjBXMW3jcxrTxc4v1wWRKLdiHVPAzsGInv+sjg d4wL5KMtW3YlMJ+TYKP1n2Yz9Obia2ElPp+lMYLCeUttv1B/dgo7h/HGi/xId+d+AApg MaObDmWCHAq+jTokdbUo+PkB5pA21MhjXfQdg40WQM46bAJbHdiR+tWfd6Hz/yktgTjh tRqZuiJ3BzC+lL2n15CAqO6sBMJh1JJv08eYahjP0t9z9ZFD+p15ZpDLoEf111vRm+st j23Y2iICY60Eh4OfyFnpCBAHmE5m9y93bjWrpVLCk4GeV58F2T/PBx4ktvwdN3pKc377 iAWg== X-Gm-Message-State: AOJu0Yy8lj/b7KaHxVBOniG6RbRcnlXLYn+oZAq4U/6Ouv3MwkKsoskh S5cuZHJZBKlAcq9iDZ7g89sSDtxFQv1oTOXtpLT9OAP3X9DQiG6COB9WV1Oiy61W0vKHplVzunu 4/ehwR4DaObRTFZ1wjLfo9cDCXV8PwMA+nkt1WJiJYFNI9eL4 X-Received: by 2002:a0d:c884:0:b0:5e4:f37f:77bf with SMTP id k126-20020a0dc884000000b005e4f37f77bfmr137774ywd.44.1703144831319; Wed, 20 Dec 2023 23:47:11 -0800 (PST) X-Received: by 2002:a0d:c884:0:b0:5e4:f37f:77bf with SMTP id k126-20020a0dc884000000b005e4f37f77bfmr137764ywd.44.1703144831077; Wed, 20 Dec 2023 23:47:11 -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> In-Reply-To: From: Eugenio Perez Martin Date: Thu, 21 Dec 2023 08:46:35 +0100 Message-ID: Subject: Re: [PATCH vhost v4 02/15] vdpa: Add VHOST_BACKEND_F_CHANGEABLE_VQ_ADDR_IN_SUSPEND flag To: Jason Wang Cc: Dragos Tatulea , "Michael S . Tsirkin" , Si-Wei Liu , Saeed Mahameed , Leon Romanovsky , virtualization@lists.linux-foundation.org, Gal Pressman , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Parav Pandit , Xuan Zhuo Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Dec 21, 2023 at 3:03=E2=80=AFAM Jason Wang wr= ote: > > 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 after > > > > > DRIVER_OK. Some devices do support this operation when the device= 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 suspend s= tate. > > > > > > > > So I wonder if it's better to just allow such behaviour? > > > > > > Actually I mean, allow drivers to modify the parameters during suspen= d > > > 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. 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 return > > 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 kernel > > 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.