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 02A2BEC0 for ; Mon, 20 Jan 2025 00:41:10 +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=1737333672; cv=none; b=YZN5Chw3K0MPjt1Ez6X/9HXvwE8Xn9ZJeeZOvmZOXwf1Mz+52Gic/VzurqoqucJzICAGCyPVbnuV0YtucbaEQKDcwxnjw7uGKRY0snkaoZ8Y6ooROgOdTTnCatk4KjEsRKRZqEt9w5x3A1/3DuXatWI89oK9+JYi4rbEkR2dDh0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737333672; c=relaxed/simple; bh=aA1N/FCwEJWzfKwIbQDHaCbEggvd2ib8Yz4yJXSDdJM=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=YyCEnCqCP/dmbpHJJrx1XUHXlVaJ1QiCDbbSNgsfH2XicKqTiE2sb1yMOVMekJJ6MBwD/6QEmCX35s9+jfGR5wfsyd3GxvPVhLUTk8IuqK4hmT385baMdzNEi+Qbb6Skh9jHnOOCsw2FfNkCHjLCYmm2Y65WxXFAv75M1sdB7Tw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none 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=bfePNmb4; arc=none smtp.client-ip=170.10.133.124 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="bfePNmb4" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1737333669; 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=QoODFoEJ/D6WHGy7MOEpfhr94tOI/fDa1CVKWtBtZbg=; b=bfePNmb4bRBoCAXBtcHTOXLQLg6RUjXL5H1MiAm+c+efGr3SpxfgJpF2dHVeib1MWbEz7u QL+kE937VNIVmeicD4KkfyuOwVpofYX2B2xwT8FPX8Ln25dG6JdxkODRmyPnQ7bi/4uRAw 0Mo6EQqBx8Tm6xD8CykIV89FYknnVKk= Received: from mail-pj1-f70.google.com (mail-pj1-f70.google.com [209.85.216.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-20-ghjSZDZ9OnOYWiaO8vk00A-1; Sun, 19 Jan 2025 19:41:08 -0500 X-MC-Unique: ghjSZDZ9OnOYWiaO8vk00A-1 X-Mimecast-MFC-AGG-ID: ghjSZDZ9OnOYWiaO8vk00A Received: by mail-pj1-f70.google.com with SMTP id 98e67ed59e1d1-2f5538a2356so7212131a91.2 for ; Sun, 19 Jan 2025 16:41:08 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737333667; x=1737938467; 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=QoODFoEJ/D6WHGy7MOEpfhr94tOI/fDa1CVKWtBtZbg=; b=kkOH+EkFTTzYy5j3vOBxNEhIJUwwwikvfFCXgGTxmtyYJ4m3z38a2k5aS5tgN2rNbe nd7KgQWZnVcp5Nxz6QX8o7B0fHhY7TcXWIhbzHRZy9aaUVUOzP2S+DU8aP/SzNAA18lr SiD9q2NqhP7j96RwludenxvwdTUtggNjfA/5MjI0n323whWVdsYjmUGIqtPtoxZAjbJF X/fv/Yp74rD4z8aSyNXmhyE0xkkN90fFCkEmrRp2TB/cygNhJeU48dwceS3iDa8SNu+P 7x3YC0EpMl5lTokaErIMi1XRo4vIn0BPKgJI6C8XaCUqvIPKS3STXP3BOcSzI32iNwpU z20A== X-Forwarded-Encrypted: i=1; AJvYcCVRaPaCsyAgYPAeZmGetjtiRdvHsJZmA1OvLACKxPifi1zdIENQmU/KezEaES/Ie8QpDPc1NQN0klx0LEQ=@vger.kernel.org X-Gm-Message-State: AOJu0YxXJy6eEpW1g9IWVceNybLX4bZqSnE1RM6FhU2ZsioFkjvVz6Th 6MdNziSvyDeQVoouscjKIztenvFvYkqNbbMCiuEXML9yAZmw7i5229Zof6qVxdW8ockGBPBtNfO j+tE3s8Ai0M3Jtx25Of4oisPvEc0ebRFYieC/1a5HM9nkDDE/1GW8jy23Zsnk+4XYlyEvO4LNU/ Tt6b6qEht1bfg3Xn2bTNMbibUDYJCy3onTCz0g X-Gm-Gg: ASbGncvL6/1HO2Kq3aLbWSB1KotSfTGOIvAjL2lLAzNszXsB/Iv6vBMklpc1EZO2dbh 9LpgSnYnE3K69APZSbOHxNulygIP7sGCkwS+dcJo2PgnGL7L9z9Uh X-Received: by 2002:a17:90a:d003:b0:2ee:a04b:92ce with SMTP id 98e67ed59e1d1-2f782d8c844mr13718662a91.32.1737333667411; Sun, 19 Jan 2025 16:41:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IGvOsgeJvjTzqlxcpcXrDzMSHfJqhVYBVkIV2UaUnhj4GnP64AkNHuirJUh0W/boBZuXQpajGMQJ+ugWEd6ZBA= X-Received: by 2002:a17:90a:d003:b0:2ee:a04b:92ce with SMTP id 98e67ed59e1d1-2f782d8c844mr13718637a91.32.1737333666967; Sun, 19 Jan 2025 16:41:06 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20250109-tun-v2-0-388d7d5a287a@daynix.com> <20250109-tun-v2-3-388d7d5a287a@daynix.com> <20250110052246-mutt-send-email-mst@kernel.org> <2e015ee6-8a3b-43fb-b119-e1921139c74b@daynix.com> In-Reply-To: From: Jason Wang Date: Mon, 20 Jan 2025 08:40:55 +0800 X-Gm-Features: AbW1kvZySvRTtG6CQaeo9DOkWdfLmhPa3wBjyc1FO_e-8MjSnO1jhzJ2Si8rLnw Message-ID: Subject: Re: [PATCH v2 3/3] tun: Set num_buffers for virtio 1.0 To: Akihiko Odaki Cc: "Michael S. Tsirkin" , Jonathan Corbet , Willem de Bruijn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Xuan Zhuo , Shuah Khan , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, kvm@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-kselftest@vger.kernel.org, Yuri Benditovich , Andrew Melnychenko , Stephen Hemminger , gur.stavi@huawei.com, devel@daynix.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Jan 16, 2025 at 1:30=E2=80=AFPM Akihiko Odaki wrote: > > On 2025/01/16 10:06, Jason Wang wrote: > > On Wed, Jan 15, 2025 at 1:07=E2=80=AFPM Akihiko Odaki wrote: > >> > >> On 2025/01/13 12:04, Jason Wang wrote: > >>> On Fri, Jan 10, 2025 at 7:12=E2=80=AFPM Akihiko Odaki wrote: > >>>> > >>>> On 2025/01/10 19:23, Michael S. Tsirkin wrote: > >>>>> On Fri, Jan 10, 2025 at 11:27:13AM +0800, Jason Wang wrote: > >>>>>> On Thu, Jan 9, 2025 at 2:59=E2=80=AFPM Akihiko Odaki wrote: > >>>>>>> > >>>>>>> The specification says the device MUST set num_buffers to 1 if > >>>>>>> VIRTIO_NET_F_MRG_RXBUF has not been negotiated. > >>>>>> > >>>>>> Have we agreed on how to fix the spec or not? > >>>>>> > >>>>>> As I replied in the spec patch, if we just remove this "MUST", it > >>>>>> looks like we are all fine? > >>>>>> > >>>>>> Thanks > >>>>> > >>>>> We should replace MUST with SHOULD but it is not all fine, > >>>>> ignoring SHOULD is a quality of implementation issue. > >>>>> > >>> > >>> So is this something that the driver should notice? > >>> > >>>> > >>>> Should we really replace it? It would mean that a driver conformant = with > >>>> the current specification may not be compatible with a device confor= mant > >>>> with the future specification. > >>> > >>> I don't get this. We are talking about devices and we want to relax s= o > >>> it should compatibile. > >> > >> > >> The problem is: > >> 1) On the device side, the num_buffers can be left uninitialized due t= o bugs > >> 2) On the driver side, the specification allows assuming the num_buffe= rs > >> is set to one. > >> > >> Relaxing the device requirement will replace "due to bugs" with > >> "according to the specification" in 1). It still contradicts with 2) s= o > >> does not fix compatibility. > > > > Just to clarify I meant we can simply remove the following: > > > > """ > > The device MUST use only a single descriptor if VIRTIO_NET_F_MRG_RXBUF > > was not negotiated. Note: This means that num_buffers will always be 1 > > if VIRTIO_NET_F_MRG_RXBUF is not negotiated. > > """ > > > > And > > > > """ > > If VIRTIO_NET_F_MRG_RXBUF has not been negotiated, the device MUST set > > num_buffers to 1. > > """ > > > > This seems easier as it reflects the fact where some devices don't set > > it. And it eases the transitional device as it doesn't need to have > > any special care. > > That can potentially break existing drivers that are compliant with the > current and assumes the num_buffers is set to 1. Those drivers are already 'broken'. Aren't they? Thanks > > Regards, > Akihiko Odaki > > > > > Then we don't need any driver normative so I don't see any conflict. > > > > Michael suggests we use "SHOULD", but if this is something that the > > driver needs to be aware of I don't know how "SHOULD" can help a lot > > or not. > > > >> > >> Instead, we should make the driver requirement stricter to change 2). > >> That is what "[PATCH v3] virtio-net: Ignore num_buffers when unused" d= oes: > >> https://lore.kernel.org/r/20250110-reserved-v3-1-2ade0a5d2090@daynix.c= om > >> > >>> > >>>> > >>>> We are going to fix all implementations known to buggy (QEMU and Lin= ux) > >>>> anyway so I think it's just fine to leave that part of specification= as is. > >>> > >>> I don't think we can fix it all. > >> > >> It essentially only requires storing 16 bits. There are details we nee= d > >> to work out, but it should be possible to fix. > > > > I meant it's not realistic to fix all the hypervisors. Note that > > modern devices have been implemented for about a decade so we may have > > too many versions of various hypervisors. (E.g DPDK seems to stick > > with the same behaviour of the current kernel). > > >> > >> Regards, > >> Akihiko Odaki > >> > > > > Thanks > > >