From mboxrd@z Thu Jan 1 00:00:00 1970 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 1E6F9402459 for ; Tue, 24 Mar 2026 15:24:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774365883; cv=none; b=t8rm6fG+AsZb2IDwez2yQogLNRjbr6/V5v3pNjijfgqscVEayyr/3Ymu/84j/n4ctQhcsGwIDxRmz9XLk5Fc9ZEpCmZgxr94N1GQajPhgFLxMFymT0tRiA70bgWxrPQ/p5YdIV5R3HdT+QvAnwQ3iyAT37QpGnYe/AKo+lUvESQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774365883; c=relaxed/simple; bh=Lcf72Rzm78gc5DlMU+0uRPGYeGfW3qCW7AY97IDSli8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=RH31mDTiavP3YNOf6YwcljDosJ32kCI2tccVPOU5G+M78NjB4JuQ1VgXcFTMA4Gab/WU8P0prdz5/lW2mxH5lMd/uHBmJDkHYIvmvoVTTiZduiC4+Ml/tKgzrbJ/ofv95MJGWADOaPbFrFJIAK8fkF+Bhb+nbwXrWK6u8fgXLEA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=KKe39VbI; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=X7pu3b2C; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="KKe39VbI"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="X7pu3b2C" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1774365880; 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=4v4xqTqHjMjWJnkL34okqRK9gfII8qgKulp2fDfnMdA=; b=KKe39VbI55HDXy1IDEtNGcA+J9hB37yzeK01GZnakQ+UZr4ZFsF4P0bDlncAYZbm+bgVkK Bx63M7Q4W1ahQG4GF6u2tmQPyShrffHLIp+tI1huL8woHT0X/1j0XM6JLR5CUckwYFebIZ /dm3dfE0Ah25x1k6R+yxZHy7YBK1nII= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-106-CtkpL6SdN7CMd66o5i4TIA-1; Tue, 24 Mar 2026 11:24:38 -0400 X-MC-Unique: CtkpL6SdN7CMd66o5i4TIA-1 X-Mimecast-MFC-AGG-ID: CtkpL6SdN7CMd66o5i4TIA_1774365877 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-486fb142205so48929495e9.1 for ; Tue, 24 Mar 2026 08:24:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1774365877; x=1774970677; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=4v4xqTqHjMjWJnkL34okqRK9gfII8qgKulp2fDfnMdA=; b=X7pu3b2CJ8iouNF3mxxQ7sMNiFTy7nkhQ9sWU9oLmW88J2nqICZ6y5Nj776sSc2Om7 D5XOmQ66P3TPEEb+ERuMJAlOVi3Azldbq9HeMmK4GFye3aYuga7J6HfqXb9tA9L/8rfi PvNW7OzyJtqZfy6MB8W3YSDoTU+OGiTQjPKg9GfVBXRU/GnByLJpJ/fytyRWQnWPOzyI AL8IOd4csSqIamU8vuK0uGC5HsBgCbroNzEvInCRACyhLVVts2ptAaqOUxaBdGNGN4JL ka1VW22JF0j7WNYjktHDLhWZiB0/QUIlufZ7w0YYU47wFpDcb4X1vRbfjjdvKCMyd8/u 6E5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774365877; x=1774970677; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=4v4xqTqHjMjWJnkL34okqRK9gfII8qgKulp2fDfnMdA=; b=gzTFBt3//aV6sGcuPpJI3nCrKEMhKFjBLZog9iGc2u2RYKRu/LouXGxSOPZKiVSOhK JDjQksltU1Js2518xGRRcSvXrMV/00PhZAERo3sBvP+dBeQYizsSegC5RzBFWYFo/AeU ZYC8QjTGU6tnOx2o9+K+ZR8SjkUNnd8O8X5UlBwsENOwvE2oiV6mln0ZOIr+Oc+gw9c3 xbTyF9km9873eouMJv9I9o/kZgu0q3INwJZpSdyRbhQkVCsFXWh/gH4pX9Uj/Xru7qVX S3SKsXTJKB2y1FILEdxgX/AtJUruaGdcfJ2rXafaOOU0krfpR7BgADrVdRcKK5lahqSv X8Sg== X-Forwarded-Encrypted: i=1; AJvYcCWi84K+jQN7AIuDsVX1Ca14xj+HyXB6DGDSPeoODLSuq/nNpUevT74hVODkmH+clNfL0FrUvU/WSSaLAaw=@vger.kernel.org X-Gm-Message-State: AOJu0YybuRQvDTK1te8vpRDwm7sJZGTOahQkmeYjVxhVW56TMQWMjW65 AY2SlS8u0D+6zStz7S30g76zTA/uy6rUeaGR5D8ol2bq7U4DB6QFjAzozaNDr0b+vv9uckX4gWO B+XvV1JswHLWs91+v/PLW3gfHTEQ+0wL/rW70DuoNlBG9tWKEl+xb+q+r4qyEf2SgIA== X-Gm-Gg: ATEYQzy44365FcFJSFv6bzsNf1ToxXLKuFhf85Y9Mb4CqpBXg5jVJ0oGVDoF4CpdPMp Z9WBGG3yJ709AEMY1Kf/kXSd0nBMqaSzQYn7ZcgVbHOV/8IABeZz9Dy1vDOYGoj/96bHz6FGL1N lRrUmpxmpmcmyeJsjwBcM7twS6iZ3sS7pwVxDSZLiEBsiFSVCBUZiVejfpfXk0dNOrbTFwz4Z9M VKI+MtrZy8lYPmX0/AWVp523IfYV/gn7fm2qJ27kW22lVlivv/c4glmt3Bko0nXV88Hb9N6xmxT BaAi0gHw7mCub4VMM1jSLZmYRbldc12sx0WLlKIj/EVsJhO+eDg6iPsLeKIDVq8pqmo+BlbqkSX tM8V4AHH1wAbNFIHU X-Received: by 2002:a05:600c:8b2a:b0:486:ff92:63e5 with SMTP id 5b1f17b1804b1-48715fc32admr2453135e9.6.1774365876999; Tue, 24 Mar 2026 08:24:36 -0700 (PDT) X-Received: by 2002:a05:600c:8b2a:b0:486:ff92:63e5 with SMTP id 5b1f17b1804b1-48715fc32admr2452355e9.6.1774365876419; Tue, 24 Mar 2026 08:24:36 -0700 (PDT) Received: from redhat.com ([2a0d:6fc0:1525:da00:3ac2:1a22:72ff:4256]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-487116abe8esm60822765e9.4.2026.03.24.08.24.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Mar 2026 08:24:35 -0700 (PDT) Date: Tue, 24 Mar 2026 11:24:33 -0400 From: "Michael S. Tsirkin" To: Eugenio Perez Martin Cc: Jason Wang , Cindy Lu , Xuan Zhuo , linux-kernel@vger.kernel.org, Maxime Coquelin , Stefano Garzarella , Laurent Vivier , Yongji Xie , virtualization@lists.linux.dev Subject: Re: [PATCH v3 3/3] vduse: add F_QUEUE_READY feature Message-ID: <20260324112340-mutt-send-email-mst@kernel.org> References: <20260310190759.1097506-1-eperezma@redhat.com> <20260310190759.1097506-4-eperezma@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Tue, Mar 24, 2026 at 03:01:47PM +0100, Eugenio Perez Martin wrote: > On Fri, Mar 13, 2026 at 8:08 AM Eugenio Perez Martin > wrote: > > > > On Fri, Mar 13, 2026 at 7:05 AM Jason Wang wrote: > > > > > > On Thu, Mar 12, 2026 at 2:24 PM Eugenio Perez Martin > > > wrote: > > > > > > > > On Thu, Mar 12, 2026 at 4:58 AM Jason Wang wrote: > > > > > > > > > > On Wed, Mar 11, 2026 at 3:08 AM Eugenio Pérez wrote: > > > > > > > > > > > > Add the VDUSE_F_QUEUE_READY feature flag. This allows the kernel module > > > > > > to explicitly signal userspace when a specific virtqueue has been > > > > > > enabled. > > > > > > > > > > > > In scenarios like Live Migration of VirtIO net devices, the dataplane > > > > > > starts after the control virtqueue allowing QEMU to apply configuration > > > > > > in the destination device. > > > > > > > > > > > > Signed-off-by: Eugenio Pérez > > > > > > --- > > > > > > v2: > > > > > > * Fix comment of vduse_dev_request.vq_ready > > > > > > * Set vq_ready before sending the message to the VDUSE userland > > > > > > instance, avoiding the need for SMP sync after receiving the message. > > > > > > --- > > > > > > drivers/vdpa/vdpa_user/vduse_dev.c | 28 +++++++++++++++++++++++++++- > > > > > > include/uapi/linux/vduse.h | 18 ++++++++++++++++++ > > > > > > 2 files changed, 45 insertions(+), 1 deletion(-) > > > > > > > > > > > > diff --git a/drivers/vdpa/vdpa_user/vduse_dev.c b/drivers/vdpa/vdpa_user/vduse_dev.c > > > > > > index 17e0358d3a68..4f642b95a7cb 100644 > > > > > > --- a/drivers/vdpa/vdpa_user/vduse_dev.c > > > > > > +++ b/drivers/vdpa/vdpa_user/vduse_dev.c > > > > > > @@ -9,6 +9,7 @@ > > > > > > */ > > > > > > > > > > > > #include "linux/virtio_net.h" > > > > > > +#include > > > > > > #include > > > > > > #include > > > > > > #include > > > > > > @@ -53,7 +54,7 @@ > > > > > > #define IRQ_UNBOUND -1 > > > > > > > > > > > > /* Supported VDUSE features */ > > > > > > -static const uint64_t vduse_features; > > > > > > +static const uint64_t vduse_features = BIT_U64(VDUSE_F_QUEUE_READY); > > > > > > > > > > > > /* > > > > > > * VDUSE instance have not asked the vduse API version, so assume 0. > > > > > > @@ -120,6 +121,7 @@ struct vduse_dev { > > > > > > char *name; > > > > > > struct mutex lock; > > > > > > spinlock_t msg_lock; > > > > > > + u64 vduse_features; > > > > > > u64 msg_unique; > > > > > > u32 msg_timeout; > > > > > > wait_queue_head_t waitq; > > > > > > @@ -601,8 +603,29 @@ static void vduse_vdpa_set_vq_ready(struct vdpa_device *vdpa, > > > > > > { > > > > > > struct vduse_dev *dev = vdpa_to_vduse(vdpa); > > > > > > struct vduse_virtqueue *vq = dev->vqs[idx]; > > > > > > + struct vduse_dev_msg msg = { 0 }; > > > > > > + int r; > > > > > > > > > > > > vq->ready = ready; > > > > > > + > > > > > > + if (!(dev->vduse_features & BIT_U64(VDUSE_F_QUEUE_READY))) > > > > > > + return; > > > > > > + > > > > > > + msg.req.type = VDUSE_SET_VQ_READY; > > > > > > + msg.req.vq_ready.num = idx; > > > > > > + msg.req.vq_ready.ready = !!ready; > > > > > > + > > > > > > + r = vduse_dev_msg_sync(dev, &msg); > > > > > > + > > > > > > + if (r < 0) { > > > > > > + dev_dbg(&vdpa->dev, "device refuses to set vq %u ready %u", > > > > > > + idx, ready); > > > > > > + > > > > > > + /* We can't do better than break the device in this case */ > > > > > > > > > > It's better to explain why we can't depend on vduse_dev_msg_sync() here. > > > > > > > > > > For example it did: > > > > > > > > > > if (unlikely(dev->broken)) > > > > > return -EIO; > > > > > > > > > > init_waitqueue_head(&msg->waitq); > > > > > spin_lock(&dev->msg_lock); > > > > > if (unlikely(dev->broken)) { > > > > > spin_unlock(&dev->msg_lock); > > > > > return -EIO; > > > > > } > > > > > > > > > > and > > > > > > > > > > if (!msg->completed) { > > > > > list_del(&msg->list); > > > > > msg->resp.result = VDUSE_REQ_RESULT_FAILED; > > > > > /* Mark the device as malfunction when there is a timeout */ > > > > > if (!ret) > > > > > vduse_dev_broken(dev); > > > > > } > > > > > > > > > > > > > I'm not sure I follow you here. > > > > > > > > We can't do better than breaking the device because the function > > > > returns no error state, and the caller does not expect an error code. > > > > Do you mean we can't depend on vduse_dev_msg_sync to call > > > > vduse_dev_broken(dev) by itself? > > > > > > I think I meant, reset seems to be more heavyweight than suspend. > > > > > > So if reset can fail, I don't see reason ot break device only for > > > suspend failure. > > > > > > > Sorry I still don't get you. > > > > This series does not implement suspend at all. It doesn't modify the > > VDUSE device reset or the virtio reset behavior. It only implements > > the vq ready message for the device. If the device returns an error > > from that operation, what is your proposal for when the driver sends > > new messages like resume? > > > > Friendly ping. Jason, more comments? If this is to go in it has to go into linux next. -- MST