Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1716034rwd; Fri, 9 Jun 2023 00:44:54 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4eKHaBZ2nE+kyy2R7VPOHgbnkyW+UITGHPle9g6xRlQ+WUTkqe/WBYjIlEamhsm3DIxltH X-Received: by 2002:a05:620a:4094:b0:75d:53eb:8c08 with SMTP id f20-20020a05620a409400b0075d53eb8c08mr604572qko.42.1686296694619; Fri, 09 Jun 2023 00:44:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686296694; cv=none; d=google.com; s=arc-20160816; b=nGqY63BhHFkl5ba+PexysRNbWdg0DkFDg7hOybfBhG6r7unvKuTKvjTKoOwgkey7Rz r8RnW4oD+G5Km0gqejkp8GMFcCBYfSvG2SUtEAhR2d5zedKFl5AP9ZzD3OMBlLS/b/qO CQQmLhwqBKOviPhVlxMBepeUYqIpklOZg9Hlf9DSVhA+rPG0tCEkfTTEBviZWoVEfB9m +7cKrw2V4xnklC+3OKy94D47QnlbYuCctyefutqA49OC00zxgWW1ItdC5RMFtDEFx3NV ZhLLOh33/ETp7K6sayjfVguQi8lePChUTzBO8dXk7oUpAFbllRVDZwlj2CDwNdayDPoG Yjdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=bYfLgsVFNCZ8nRyAtdqv5Pzu6gYjvla7lXAg7Aj2Y+s=; b=XxqrMISCs/EC5z0JdNLv81+SVTUIA90XP2vxKDmiyuNQ3FNH6A2Vo+cqq+zM95xFU+ Jxv8QiHJy2e55Yb5TRFPNyh/7vbvfpiFs/PhUwBmVOZJnGY3Cw89io59d1lncu8BBHEk ImlkrqpSk7EfST4MIiSYJyqcP3Dx2J5ruJ45M8przUOPogsGe5iOATSlRqYxpHGjaGUY BWdDToYxt4lbZWcXVrL665fqIv9TO38Xp7K0fH+JjTefXJ28g1uxiNNXUoKVIGFSJuNe hJCG6bTfgudO7NV19XQisB8tH4WPnir5oOXHaKNQsZ/9+o7evFCiw04qrIo2mkKEhIut luQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=OnhqCBym; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e10-20020a17090a728a00b00257a8dc0348si2368797pjg.75.2023.06.09.00.44.40; Fri, 09 Jun 2023 00:44:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=OnhqCBym; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238930AbjFIHi0 (ORCPT + 99 others); Fri, 9 Jun 2023 03:38:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239020AbjFIHiH (ORCPT ); Fri, 9 Jun 2023 03:38:07 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8133A2D7C for ; Fri, 9 Jun 2023 00:37:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686296238; 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=bYfLgsVFNCZ8nRyAtdqv5Pzu6gYjvla7lXAg7Aj2Y+s=; b=OnhqCBymOShT6mrRhsbBNdUscX6jlm0WjT882anBdBNRFMjQaG46L+MLd+2hjnfR8yOvq7 Up+XgvJRuh/zitui8eTOVIlp1PohX7DWtJPv/Y5ZvAIMEAFUrvQmvXFsSVX/hT2BTM8Id9 l0AKCTmgZTmctbS/zhQAHC3q3fhlMow= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-655-XOMKqdu-OjGQGLVGGtZx6Q-1; Fri, 09 Jun 2023 03:37:17 -0400 X-MC-Unique: XOMKqdu-OjGQGLVGGtZx6Q-1 Received: by mail-ed1-f72.google.com with SMTP id 4fb4d7f45d1cf-5142da822cbso1697894a12.2 for ; Fri, 09 Jun 2023 00:37:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686296236; x=1688888236; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=bYfLgsVFNCZ8nRyAtdqv5Pzu6gYjvla7lXAg7Aj2Y+s=; b=CsqpWblMHaeuyxWUOawKGLz/GftetlJHSTHpxJugbMIYcQLL+vkRggDkz7CkMG4olS j8RY6G3cYWLQI0ne0P1Mc2omDJCxpPaOaY67AUZA3ETZe9G/Pl1fI+zn9Hgo6+jPxkkR OQDuOM/okzDUPlxZX7A4XNKbCKpINYjv3mFy0CS65S2Bn/8JccgP1ADDCa7ioul2WmaK jykxYxLwRhrJIHFe7yytUGzeDSRAS5Apnl60Lwqf9nOPyYVXlnJB83Ff4QFDnfGprcjM e8hJdulKKM1N3klKp3B/ZITDBRok6ZBhWZh4Hn+kDxd5LIe0/SQrsDPjhISYmU76dy/J M4bQ== X-Gm-Message-State: AC+VfDwfHlWVjD4zVSwah6X2P4chXlTFiu/irp7F0c48rI7kEiVIaZ0m ofiVLFr7ivY1vEjkuGyo2jvrXJQL7ZrwFClJXTp+dD1UJOXDbo9AKoPtNRCp/HAoE2iGx3X5TIH DAmeuPPxi7gYcp4vQLm2sBHam X-Received: by 2002:a17:907:7ba9:b0:978:62c1:6b4b with SMTP id ne41-20020a1709077ba900b0097862c16b4bmr1270363ejc.61.1686296236529; Fri, 09 Jun 2023 00:37:16 -0700 (PDT) X-Received: by 2002:a17:907:7ba9:b0:978:62c1:6b4b with SMTP id ne41-20020a1709077ba900b0097862c16b4bmr1270345ejc.61.1686296236130; Fri, 09 Jun 2023 00:37:16 -0700 (PDT) Received: from sgarzare-redhat (host-87-12-25-111.business.telecomitalia.it. [87.12.25.111]) by smtp.gmail.com with ESMTPSA id v7-20020a1709063bc700b00965b5540ad7sm967116ejf.17.2023.06.09.00.37.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Jun 2023 00:37:15 -0700 (PDT) Date: Fri, 9 Jun 2023 09:37:12 +0200 From: Stefano Garzarella To: "Michael S. Tsirkin" Cc: Jason Wang , Shannon Nelson , virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, Eugenio =?utf-8?B?UMOpcmV6?= , Tiwei Bie , kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] vhost-vdpa: filter VIRTIO_F_RING_PACKED feature Message-ID: References: <20230607054246-mutt-send-email-mst@kernel.org> <20230608020111-mutt-send-email-mst@kernel.org> <5giudxjp6siucr4l3i4tggrh2dpqiqhhihmdd34w3mq2pm5dlo@mrqpbwckpxai> <20230608102259-mutt-send-email-mst@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230608102259-mutt-send-email-mst@kernel.org> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 08, 2023 at 10:23:21AM -0400, Michael S. Tsirkin wrote: >On Thu, Jun 08, 2023 at 05:29:58PM +0800, Jason Wang wrote: >> On Thu, Jun 8, 2023 at 5:21 PM Stefano Garzarella wrote: >> > >> > On Thu, Jun 08, 2023 at 05:00:00PM +0800, Jason Wang wrote: >> > >On Thu, Jun 8, 2023 at 4:00 PM Stefano Garzarella wrote: >> > >> >> > >> On Thu, Jun 08, 2023 at 03:46:00PM +0800, Jason Wang wrote: >> > >> >> > >> [...] >> > >> >> > >> >> > > > > I have a question though, what if down the road there >> > >> >> > > > > is a new feature that needs more changes? It will be >> > >> >> > > > > broken too just like PACKED no? >> > >> >> > > > > Shouldn't vdpa have an allowlist of features it knows how >> > >> >> > > > > to support? >> > >> >> > > > >> > >> >> > > > It looks like we had it, but we took it out (by the way, we were >> > >> >> > > > enabling packed even though we didn't support it): >> > >> >> > > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=6234f80574d7569444d8718355fa2838e92b158b >> > >> >> > > > >> > >> >> > > > The only problem I see is that for each new feature we have to modify >> > >> >> > > > the kernel. >> > >> >> > > > Could we have new features that don't require handling by vhost-vdpa? >> > >> >> > > > >> > >> >> > > > Thanks, >> > >> >> > > > Stefano >> > >> >> > > >> > >> >> > > Jason what do you say to reverting this? >> > >> >> > >> > >> >> > I may miss something but I don't see any problem with vDPA core. >> > >> >> > >> > >> >> > It's the duty of the parents to advertise the features it has. For example, >> > >> >> > >> > >> >> > 1) If some kernel version that is packed is not supported via >> > >> >> > set_vq_state, parents should not advertise PACKED features in this >> > >> >> > case. >> > >> >> > 2) If the kernel has support packed set_vq_state(), but it's emulated >> > >> >> > cvq doesn't support, parents should not advertise PACKED as well >> > >> >> > >> > >> >> > If a parent violates the above 2, it looks like a bug of the parents. >> > >> >> > >> > >> >> > Thanks >> > >> >> >> > >> >> Yes but what about vhost_vdpa? Talking about that not the core. >> > >> > >> > >> >Not sure it's a good idea to workaround parent bugs via vhost-vDPA. >> > >> >> > >> Sorry, I'm getting lost... >> > >> We were talking about the fact that vhost-vdpa doesn't handle >> > >> SET_VRING_BASE/GET_VRING_BASE ioctls well for packed virtqueue before >> > >> that series [1], no? >> > >> >> > >> The parents seem okay, but maybe I missed a few things. >> > >> >> > >> [1] https://lore.kernel.org/virtualization/20230424225031.18947-1-shannon.nelson@amd.com/ >> > > >> > >Yes, more below. >> > > >> > >> >> > >> > >> > >> >> Should that not have a whitelist of features >> > >> >> since it interprets ioctls differently depending on this? >> > >> > >> > >> >If there's a bug, it might only matter the following setup: >> > >> > >> > >> >SET_VRING_BASE/GET_VRING_BASE + VDUSE. >> > >> > >> > >> >This seems to be broken since VDUSE was introduced. If we really want >> > >> >to backport something, it could be a fix to filter out PACKED in >> > >> >VDUSE? >> > >> >> > >> mmm it doesn't seem to be a problem in VDUSE, but in vhost-vdpa. >> > >> I think VDUSE works fine with packed virtqueue using virtio-vdpa >> > >> (I haven't tried), so why should we filter PACKED in VDUSE? >> > > >> > >I don't think we need any filtering since: >> > > >> > >PACKED features has been advertised to userspace via uAPI since >> > >6234f80574d7569444d8718355fa2838e92b158b. Once we relax in uAPI, it >> > >would be very hard to restrict it again. For the userspace that tries >> > >to negotiate PACKED: >> > > >> > >1) if it doesn't use SET_VRING_BASE/GET_VRING_BASE, everything works well >> > >2) if it uses SET_VRING_BASE/GET_VRING_BASE. it might fail or break silently >> > > >> > >If we backport the fixes to -stable, we may break the application at >> > >least in the case 1). >> > >> > Okay, I see now, thanks for the details! >> > >> > Maybe instead of "break silently", we can return an explicit error for >> > SET_VRING_BASE/GET_VRING_BASE in stable branches. >> > But if there are not many cases, we can leave it like that. >> >> A second thought, if we need to do something for stable. is it better >> if we just backport Shannon's series to stable? >> >> > >> > I was just concerned about how does the user space understand that it >> > can use SET_VRING_BASE/GET_VRING_BASE for PACKED virtqueues in a given >> > kernel or not. >> >> My understanding is that if packed is advertised, the application >> should assume SET/GET_VRING_BASE work. >> >> Thanks > > >Let me ask you this. This is a bugfix yes? What is the appropriate Fixes >tag? I would say: Fixes: 4c8cf31885f6 ("vhost: introduce vDPA-based backend") because we had an allow list and enabled PACKED explicitly. I'm not sure if the parents at that time supported PACKED, but maybe it doesn't matter since we are talking about the code in vhost-vdpa. Thanks, Stefano