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 C1AD6317148 for ; Fri, 13 Mar 2026 12:06:46 +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=1773403608; cv=none; b=iPFB92GKwhP4JjFH+Rs645QoW2INn9BvMPBuIDoV5XBqmymBaHvnGjgaHOSLiY52BDT0mHISYwD3oiBe6jLxRA3GBOCqRV+fcPA+l3LwXh+j/aGiVIII+2K0UWannsZuH7lyyxZblug0QiO5hMkJBseqAIX3s+Iqa1MAEUG06l4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773403608; c=relaxed/simple; bh=wOJF9PADpLMdeYA8UeTV97nkSaYwDHF+GFF9hpnOpJI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=kHJtgmfTGRCdJSfciWIzGJG5um6Fkvft0oRdj5WLXVd7xkJqGMai7LIPCJVz16wi/c7c0Z9L4xWajF0++YRY5P+ZQBuUKjcNz33Vur5ksiivsIWoJxQHaPnOfMn2vLO5QGINadqwwhRtQZsMf0BkwtRYtSEqcnmcQVRKItJ2qf0= 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=BDE2UHA7; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=RM6DE2q7; 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="BDE2UHA7"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="RM6DE2q7" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1773403605; 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=vq5HK1/jLHMAoEi3YRT5LDWCu6Y1xHBbOLaOaWUJPeo=; b=BDE2UHA7szVN3/hEdFJLDG4fDZe9YqfTKRjIIfHmE8rr7tTJ/KffEDskCJpvS/nmizzqgT ysjC4+9msx2gW+bRzq4jFpuhr91078s7aqo6Zggc7q5JqXhJA2eJl1aVPM6DxzKV4F9QqS Bo8NB5Sj+JjBq7jetiFapcuBHoACAZA= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-68-eI1reFp1OburDsD6qhpgqg-1; Fri, 13 Mar 2026 08:06:44 -0400 X-MC-Unique: eI1reFp1OburDsD6qhpgqg-1 X-Mimecast-MFC-AGG-ID: eI1reFp1OburDsD6qhpgqg_1773403603 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-439c12269f3so1304652f8f.3 for ; Fri, 13 Mar 2026 05:06:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1773403603; x=1774008403; 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=vq5HK1/jLHMAoEi3YRT5LDWCu6Y1xHBbOLaOaWUJPeo=; b=RM6DE2q7tqfYXhK1QI8unBylF5gD3t+b1wfTgn5fhkAnNWacAVwaMj0W3QtEcB6BYU 77IeAZvWT1fMcpd/sglzh/BqxISJ35Bn26/cEwqU8VLsifnlBqjBDyKcdEknInT/m5C+ tQpBQ1i6GeIUuprl783fHLgjnxLQcuCjIPqfr5jrGgGeimrTWFtVRlSQRhAjT2HBIG1j B+Jf4jIfineVwY6Vf+0JcCgpzf/YxEeDwgJHCLhZQAH7aIlCiVZaaXbsObr+t4DVJy/J iE7GbvHtclDerkPLpkO1SGuBvVhysetYlx9XvvxzmhBGaViQsZ2D69FG360l1vZ894OI ALPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773403603; x=1774008403; 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=vq5HK1/jLHMAoEi3YRT5LDWCu6Y1xHBbOLaOaWUJPeo=; b=i1OdyqjnYqXT84c87kXQIVwYAEhmCuJLmsgNtTQTrHA6lnHN1M/r6DtgQKwB7m17Ta RQg5sGgcrS2/3xzcZMKbPqFhUMx00fabN/81gYik1wOl/1CsdC92IAtk30Oqnpx9FOnV mJrN/G3QUD1Bx6qyRNbf5+JpLBwnLxOrj8YMzzhxbRv9Y02EcoBZZjHFluTi/pR/P/Wo zKGtn2r4hn9noCCndWv/aNSbCME7AqgFTAGwPQ3mAgmz8zsXK94YRnS4cNgNqNmqpUhu KVsgiJYyfK1YW/C3wPpZFNzN0WdHlC97tkcZpk57h+nsAUiEbq1n5+TW8CXupl0vO9JF Noow== X-Forwarded-Encrypted: i=1; AJvYcCUzxiEQXSUEH13RCEeCsJHucgnP5zSRdBjI9DSu3BPtCfc8XnwaiQkXUe1BEpvInriPQDrIKgzTQ7CHm24=@vger.kernel.org X-Gm-Message-State: AOJu0Yyc76DhajSRYdjwGbqmzA8mJ07n796urtN6Ow8TJVP4buOnGOEs BulOKvj+lm4ZPc1C6wKq06Z9wAHGTt/SOZ3NYTKCXwiqRKg3yzPZnNwfemwkcvDvEaYqr/brpu5 6EtaZVnwyqpyFqQEbAqa7UVV9DQNkUEWaOe2Ty2byj+JRmgGHEOAjoKWH8kN7sqnchA== X-Gm-Gg: ATEYQzxsZXbroUc7bokCHxC7RmDDFBiYE6ZExXYS01E0MASSqyw6ROzk8YhSBNtAaTk 0/YInhA0HfsJWjUHOhlJULrZt2sQ28t1fa8pyNb429ZQWbY0do1TlsQw2ywORhAT5N+R8jZGMeb turCX1U+ywBgtPb/BhBoQsARYuf7bfVHfu3XUAxV9lsSRPMmk3A1hGP7DpPeBwSMQkjDPeDfLBR 94MYvi8VfC7BqlRuXooe6Sv3lGGaJwQBFU4f3CQq6wHqO58WnNPSNUegLsmKlF593j4pOItuwDW nhb7VmOXD0Hcqk/xDpPJlN72dLRGszx61mjIGxob9bSa81z01/Dq3s8eHdWhc5cDWHS6IgpThAn Pi2ShIVYaEL14CFKIuJZMw6O2n0cSUL3L6/x/KDmvdAbb6A== X-Received: by 2002:a05:6000:2087:b0:439:ad2d:99f8 with SMTP id ffacd0b85a97d-43a04db0a4dmr5715558f8f.30.1773403603137; Fri, 13 Mar 2026 05:06:43 -0700 (PDT) X-Received: by 2002:a05:6000:2087:b0:439:ad2d:99f8 with SMTP id ffacd0b85a97d-43a04db0a4dmr5715452f8f.30.1773403602538; Fri, 13 Mar 2026 05:06:42 -0700 (PDT) Received: from redhat.com (IGLD-80-230-79-166.inter.net.il. [80.230.79.166]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-439fe228986sm14429080f8f.35.2026.03.13.05.06.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Mar 2026 05:06:41 -0700 (PDT) Date: Fri, 13 Mar 2026 08:06:39 -0400 From: "Michael S. Tsirkin" To: Eugenio Perez Martin Cc: Maxime Coquelin , Yongji Xie , virtualization@lists.linux.dev, linux-kernel@vger.kernel.org, Xuan Zhuo , Dragos Tatulea DE , jasowang@redhat.com, Cindy Lu Subject: Re: [RFC 1/2] virtio_net: timeout control virtqueue commands Message-ID: <20260313080611-mutt-send-email-mst@kernel.org> References: <20251022073231-mutt-send-email-mst@kernel.org> <20251028100923-mutt-send-email-mst@kernel.org> <20251028104154-mutt-send-email-mst@kernel.org> <20251109164528-mutt-send-email-mst@kernel.org> 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 Fri, Mar 13, 2026 at 12:32:18PM +0100, Eugenio Perez Martin wrote: > On Fri, Mar 13, 2026 at 12:31 PM Eugenio Perez Martin > wrote: > > > > On Sun, Nov 9, 2025 at 10:47 PM Michael S. Tsirkin wrote: > > > > > > On Wed, Nov 05, 2025 at 10:02:48AM +0100, Eugenio Perez Martin wrote: > > > > On Tue, Oct 28, 2025 at 3:57 PM Eugenio Perez Martin > > > > wrote: > > > > > > > > > > On Tue, Oct 28, 2025 at 3:42 PM Michael S. Tsirkin wrote: > > > > > > > > > > > > On Tue, Oct 28, 2025 at 03:37:09PM +0100, Eugenio Perez Martin wrote: > > > > > > > On Tue, Oct 28, 2025 at 3:10 PM Michael S. Tsirkin wrote: > > > > > > > > > > > > > > > > On Wed, Oct 22, 2025 at 02:55:18PM +0200, Eugenio Perez Martin wrote: > > > > > > > > > On Wed, Oct 22, 2025 at 1:43 PM Michael S. Tsirkin wrote: > > > > > > > > > > > > > > > > > > > > On Wed, Oct 22, 2025 at 12:50:53PM +0200, Eugenio Perez Martin wrote: > > > > > > > > > > > Let me switch to MQ as I think it illustrates the point better. > > > > > > > > > > > > > > > > > > > > > > IIUC the workflow: > > > > > > > > > > > a) virtio-net sends MQ_VQ_PAIRS_SET 2 to the device > > > > > > > > > > > b) VDUSE CVQ sends ok to the virtio-net driver > > > > > > > > > > > c) VDUSE CVQ sends the command to the VDUSE device > > > > > > > > > > > d) Now the virtio-net driver sends virtio-net sends MQ_VQ_PAIRS_SET 1 > > > > > > > > > > > e) VDUSE CVQ sends ok to the virtio-net driver > > > > > > > > > > > > > > > > > > > > > > The device didn't process the MQ_VQ_PAIRS_SET 1 command at this point, > > > > > > > > > > > so it potentially uses the second rx queue. But, by the standard: > > > > > > > > > > > > > > > > > > > > > > The device MUST NOT queue packets on receive queues greater than > > > > > > > > > > > virtqueue_pairs once it has placed the VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET > > > > > > > > > > > command in a used buffer. > > > > > > > > > > > > > > > > > > > > > > So the driver does not expect rx buffers on that queue at all. From > > > > > > > > > > > the driver's POV, the device is invalid, and it could mark it as > > > > > > > > > > > broken. > > > > > > > > > > > > > > > > > > > > ok intresting. Note that if userspace processes vqs it should process > > > > > > > > > > cvq too. I don't know what to do in this case yet, I'm going on > > > > > > > > > > vacation, let me ponder this a bit. > > > > > > > > > > > > > > > > > > > > > > > > > > > > Sure. > > > > > > > > > > > > > > > > So let me ask you this, how are you going to handle device reset? > > > > > > > > Same issue, it seems to me. > > > > > > > > > > > > > > > > > > > > > > Well my proposal is to mark it as broken so it needs to be reset > > > > > > > manually. > > > > > > > > > > > > > > > > > > Heh but guest assumes after reset device does not poke at guest > > > > > > memory, and will free up and reuse that memory. > > > > > > If userspace still pokes at it -> plus plus ungood. > > > > > > > > > > > > > > > > I don't get this part. Once the device is reset, the device should not > > > > > poke at guest memory (unless it is malicious or similar). Why would it > > > > > do it? > > > > > > > > Friendly ping. > > > > > > > > > > > > OK I thought about it a bunch. A lot of net drivers actually > > > just queue ethtool commands and finish them asynchronously. > > > Thinkably virtio could expose an API on whether it is safe to > > > wait for buffers to be used. virtio-net would then either > > > send commands directly or do the asynchronous thing. > > > Hmm? > > > > > > > I think it's the best solution too, yes. The series [1] implements for > > set_rx_mode. We can do it for all the CVQ commands and then whitelist > > them in VDUSE code. Am I missing something? Does anyone foresee any > > command that will not be possible to convert? > > > > Adding the [1] link... > > [1] https://lore.kernel.org/netdev/20260112181626.20117-1-viswanathiyyappan@gmail.com/ what's the status of that one?