Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1475791rwd; Thu, 8 Jun 2023 19:35:27 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7shkjh5FLT9Q4R+TELLyat1UtWT8m0s36RQPEL4A2ZlCPB4rzMg/c+YHXcmFHBak2K3mqb X-Received: by 2002:a17:90a:6309:b0:259:5494:db4a with SMTP id e9-20020a17090a630900b002595494db4amr107495pjj.30.1686278127427; Thu, 08 Jun 2023 19:35:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686278127; cv=none; d=google.com; s=arc-20160816; b=o0qg8IMBn5PFxpI1s3sqCPfPffXeLnDWqpCnDMVj9hnoMKkm7Q7+pkIg/BgFdPeT8n jJYz8hs9JE7oTkHHsnC3+NxDlSVrmOD2+2UKNnY+vJX0Da4hNLBHxDcbnStzqWvHIyTH HNCbhb+YLfsUxW77X3M6A5R24TXnpKBgQIW0Rx6E8KINEv2J5hWqyfwPqv60ppFQdpS5 xNBrF92Sspqcemmix6a2Z0S5Yig2Jln6cYTAqQXS5yjBXVAY/8x/wQadL30+hIxCrRGW l5zaX3znpdYk02iejzYaIrtp/MuSSd5zufp0yHDGHppoOMZD6WI/Ff2E9qOaMspVIe36 dnCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=kgOrLEw+CGqbzexB3hSoqE0ZkI0YLrxw+EejRuKoWQE=; b=b6gt9cp/CF9pKERw00Mdw0gmYs2PMTiJ9XUP7pXHLA1AiYxASyoT56N1QNRlL1h2aG TYzugxQsEzgD/EgM636SzpPbl3SDAuv57HD0E88hoMHzr984t3OdyFGpdVQgCNHxCUOV TaccHYjnJBJxLdpOwxTuowJ2pydqiV+uf119vFxtobe54sUvdhIqXYc3ZKOw8Ad8TVWd 0I37ACLd0ZwpiaSeIaaWrXwOacPIykbTfpiDgbDAAgeQ8hBxfpVN5kjcAURheWGxFfAs lDthkj/Fd1PyJDkoz0dPCf6QwQoScbDP1Iq3boIwzdDnHX8GMxdSn9PX7dlRWPaiIyNz aPQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=IsmGcg6v; 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 d2-20020a17090a02c200b00256078a4c6bsi3542850pjd.78.2023.06.08.19.35.15; Thu, 08 Jun 2023 19:35:27 -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=IsmGcg6v; 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 S237276AbjFICRz (ORCPT + 99 others); Thu, 8 Jun 2023 22:17:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231985AbjFICRy (ORCPT ); Thu, 8 Jun 2023 22:17:54 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52C34C2 for ; Thu, 8 Jun 2023 19:17:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686277027; 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=kgOrLEw+CGqbzexB3hSoqE0ZkI0YLrxw+EejRuKoWQE=; b=IsmGcg6vkYv5UL1k0/shSxVwrLmoqd+1MjOE9S5CeR1KcAX7SPN04+xdghMCDRYSeMe9/o 3QdJILRH2TIl9sdz1QCFR2Yd1ffMUH93r0iJERq06a1SeSoQyJ+06HFLWxjSBv9rM7uaEQ RWVKM9PQInydK3SboFSa+zEEc+I23dc= Received: from mail-lj1-f197.google.com (mail-lj1-f197.google.com [209.85.208.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-538-_wzu3TntNG2ibX5tsACN3Q-1; Thu, 08 Jun 2023 22:17:05 -0400 X-MC-Unique: _wzu3TntNG2ibX5tsACN3Q-1 Received: by mail-lj1-f197.google.com with SMTP id 38308e7fff4ca-2b1acd44a31so9035261fa.0 for ; Thu, 08 Jun 2023 19:17:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686277024; x=1688869024; 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=kgOrLEw+CGqbzexB3hSoqE0ZkI0YLrxw+EejRuKoWQE=; b=Op8tf8XtvnPW3usmxolyD7G0kGUWGCLWdZ0kRxjhKdZUIRUnAkmOjoVyHSyPiYbXMU ao+SvVyMga7sWz9ADPaYBwRxLjie3PXK+7bhxXL/9+RGVlqy+P3YEGQuClYm4jM6lkO0 rGiWvrgsY+bX56cOuJthJrWTR1zNPVkoURCHiqHMVfc+CBDD4X5K8iOckkOvFtzu2zze SWvHZzuOYwwISp1iXQDhu8PWS+RPA4/9eUdzIqkD7hxWma4RviUI4qIGjFsrhpXRbA2m OcM7TH3izTxqEZlCP3mCNUvXKyiQripdzvnY0+oJQmD5MRAc2T9P0CvniJHU9NZsZpxg RzZg== X-Gm-Message-State: AC+VfDz9bbD1uR8tQIHpa4tuBcf9g7ZYKY2FOQsiFVrBrbw0XKPFMzBk nGbGuu198yex0E6IAPGb0yzzY9jwvWbgaKtciJagLVWQt7bmVJvNutJ1cFRewcgctRjoFyMo/SY MjqAxr6MLWIjju52cainl0fsIIU1ReJ/l8LyBy9NhEnP1Lxrs X-Received: by 2002:a2e:b163:0:b0:2b0:a4b1:df6 with SMTP id a3-20020a2eb163000000b002b0a4b10df6mr123923ljm.49.1686277023829; Thu, 08 Jun 2023 19:17:03 -0700 (PDT) X-Received: by 2002:a2e:b163:0:b0:2b0:a4b1:df6 with SMTP id a3-20020a2eb163000000b002b0a4b10df6mr123915ljm.49.1686277023521; Thu, 08 Jun 2023 19:17:03 -0700 (PDT) MIME-Version: 1.0 References: <20230606085643-mutt-send-email-mst@kernel.org> <20230607054246-mutt-send-email-mst@kernel.org> <20230608020111-mutt-send-email-mst@kernel.org> <5giudxjp6siucr4l3i4tggrh2dpqiqhhihmdd34w3mq2pm5dlo@mrqpbwckpxai> <20230608102259-mutt-send-email-mst@kernel.org> In-Reply-To: <20230608102259-mutt-send-email-mst@kernel.org> From: Jason Wang Date: Fri, 9 Jun 2023 10:16:50 +0800 Message-ID: Subject: Re: [PATCH] vhost-vdpa: filter VIRTIO_F_RING_PACKED feature To: "Michael S. Tsirkin" Cc: Stefano Garzarella , Shannon Nelson , virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, =?UTF-8?Q?Eugenio_P=C3=A9rez?= , Tiwei Bie , kvm@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 8, 2023 at 10:23=E2=80=AFPM 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=E2=80=AFPM Stefano Garzarella wrote: > > > > > > On Thu, Jun 08, 2023 at 05:00:00PM +0800, Jason Wang wrote: > > > >On Thu, Jun 8, 2023 at 4:00=E2=80=AFPM 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 h= ow > > > >> >> > > > > 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=3D6234f80574d7569444d8718355fa2838e92b158b > > > >> >> > > > > > > >> >> > > > The only problem I see is that for each new feature we ha= ve 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 co= re. > > > >> >> > > > > >> >> > 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 w= ell > > > >> >> > > > > >> >> > 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-vDP= A. > > > >> > > > >> 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 bef= ore > > > >> 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 trie= s > > > >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 fo= r > > > 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 give= n > > > 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? Not sure since it may break existing user space applications which make it hard to be backported to -stable. Before the fix, PACKED might work if SET/GET_VRING_BASE is not used. After the fix, PACKED won't work at all. Thanks What is the appropriate Fixes > tag? > > > > > > > Thanks, > > > Stefano > > > >