Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp768451rwd; Thu, 8 Jun 2023 07:31:14 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6vvZGLoeqBcJFm4u1y1H+re/Sdptrre3+VA8PNDJeC+7B2pqFGB9IoB1KQZioTdrlrjvbv X-Received: by 2002:a05:6a20:7f83:b0:10e:ce12:356c with SMTP id d3-20020a056a207f8300b0010ece12356cmr4599559pzj.17.1686234674224; Thu, 08 Jun 2023 07:31:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686234674; cv=none; d=google.com; s=arc-20160816; b=08r3uQsLJf81rMoX3PBxZ42ZMET4oEVA/af+ptSPpko7wl5k7WWQpBEar9dYImcHoh wT/5Bo+0mVL2mTreTf8JWMpgWjanFxf4lOeXa9TAkAnqyoRIfA52gaOxc4oEC7Ded0go 0EgKpH/5yxXKDmWB66cQN9tJZY/S/GHJezinkM3owLV52DQezqRTdOYUvxgQnu+It0x9 oq5dWx9el2vX8eUOi8yKTr4Zo4kGdd4l8sJcaq6NrTASxhCQwf3v/vsXu/tigD3DOSPY bbuw8GajTKMS+9eA1ieEYrvttJQ8DzDGyoJK69YEkwjKGoYLOgO/Ioxu2eEHxnO7WDx9 /OOw== 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; bh=Ylaz4EsLWG8gT+tyBhiFM3PeWqHKsVLZz02Gzuw52i8=; b=fXddogkFtGbT+4yCcVWsPs/C/HgPx/NSWvvDwjLzk3nnzJZYu4HcTRlJykLA7nisEg rn9k6Xh8Rf/XhbCoWw7qtgceeaNF8KrNEL6PG7Ht7wCxndshrsIweN4JOpuFhvh3c25Y k4I0c7XHE0NHEbFQ2RjzqJ4X9rXwqG2aUf3V5bDozrrCQr2BFH4PyJAlT4Hd6XAL65R6 AFK1R01Qnm/0a+aCNJisiA6eDrJLBaMUYs0ucZfR6zAMFUAog7KJ1ISU13g60JRvjxdp yl9kiIdjvyJWhVkCzMkri4RsniR1nyxN6Ep5NE/9IpqjqTQPGM7gVXvOAf2neH+v9n70 tFOw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (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 o6-20020a639206000000b00542924cbf7bsi1109554pgd.233.2023.06.08.07.30.59; Thu, 08 Jun 2023 07:31:14 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237010AbjFHOYS (ORCPT + 99 others); Thu, 8 Jun 2023 10:24:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236877AbjFHOYQ (ORCPT ); Thu, 8 Jun 2023 10:24:16 -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 8BD922D57 for ; Thu, 8 Jun 2023 07:23:29 -0700 (PDT) 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-513-El9sXypZOSya_lPJ7oBg-A-1; Thu, 08 Jun 2023 10:23:27 -0400 X-MC-Unique: El9sXypZOSya_lPJ7oBg-A-1 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-30ae4ed92eeso309780f8f.1 for ; Thu, 08 Jun 2023 07:23:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686234206; x=1688826206; 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=Ylaz4EsLWG8gT+tyBhiFM3PeWqHKsVLZz02Gzuw52i8=; b=VcFUFLg1Q8vc56tDo9nn3G0oxYlAKBbSEwpll0auKSpnxxxyxzoHEA86PKrnHb/CfN dB8XvECzUiOPYVipVbHiCyHKllT4Ber3KveeZf6HdBSkdRY0JqPxH3HEVJXnioOHPRFP UP/nJO1q0kXAEUHaEYWHMuGY3h6GKJHAlBN+00+wwMwXNpdOi47TgZ3oNu3nlQMST8N7 h/9hG/feJZc31/3eAkC4Dfbsgv1OEKf0eoDr4oHZ21NFFM+Q3XDHkyP+yPB8BKXMGoGK 3RcW/0AjC4FrYLnqUDTE7g/xhPc+BMsfzU19Csr7RztAXmCZvJGPj9TrZCxEwg+F5xu+ z/lw== X-Gm-Message-State: AC+VfDz9gxdwB8HEUUiGxIUMZnTVfYph8BuHNmFD06TQLsJTlflkOqAJ ldvRW7DC6JRyUmA/63U1evEWLI5VoppEpqRmJEmjpvlch99gyrRTI/ivYdntEsvW8LIjnnimAPP RtGBSMsBImMMKawRAMrgl5+I+ X-Received: by 2002:adf:dfc1:0:b0:30e:4886:3533 with SMTP id q1-20020adfdfc1000000b0030e48863533mr7800344wrn.34.1686234206023; Thu, 08 Jun 2023 07:23:26 -0700 (PDT) X-Received: by 2002:adf:dfc1:0:b0:30e:4886:3533 with SMTP id q1-20020adfdfc1000000b0030e48863533mr7800329wrn.34.1686234205650; Thu, 08 Jun 2023 07:23:25 -0700 (PDT) Received: from redhat.com ([2.55.41.2]) by smtp.gmail.com with ESMTPSA id 26-20020a05600c021a00b003f7f475c3c7sm2175514wmi.8.2023.06.08.07.23.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Jun 2023 07:23:25 -0700 (PDT) Date: Thu, 8 Jun 2023 10:23:21 -0400 From: "Michael S. Tsirkin" To: Jason Wang Cc: Stefano Garzarella , Shannon Nelson , virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, Eugenio =?iso-8859-1?Q?P=E9rez?= , Tiwei Bie , kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] vhost-vdpa: filter VIRTIO_F_RING_PACKED feature Message-ID: <20230608102259-mutt-send-email-mst@kernel.org> References: <20230606085643-mutt-send-email-mst@kernel.org> <20230607054246-mutt-send-email-mst@kernel.org> <20230608020111-mutt-send-email-mst@kernel.org> <5giudxjp6siucr4l3i4tggrh2dpqiqhhihmdd34w3mq2pm5dlo@mrqpbwckpxai> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, 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 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? > > > > Thanks, > > Stefano > >