Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp426282rwd; Thu, 8 Jun 2023 02:44:53 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ57pFhuY3oUfLXb3l7sfqE4paSpHnTLYvFb5/3TN9vrSZQq+DLb6r+jDd0a9hvwqIVs/H3R X-Received: by 2002:a05:6a00:1686:b0:63d:47c8:856e with SMTP id k6-20020a056a00168600b0063d47c8856emr11663133pfc.2.1686217493415; Thu, 08 Jun 2023 02:44:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686217493; cv=none; d=google.com; s=arc-20160816; b=m0WEQJ8OtysNmTibGizQ0Ic3yA/wiopkjNqsi/7A8ueyC/6sHfg+8/dw0CEMCRaBQO a/GbbzUCx1UAN9MA7yjBDPWWg+VkLelxnk+IYl5ykVETC6TJAgoC2U5Mn+vtAvsYCqn/ 2aQuCeHkx/FIpd3fmb2tdPPpvkMfjHSXDzZ3EdiJiGCVijKfPVqXOMfCtyiSMREj0Mqs sy7FU1i3w5T4eHyd92I3rrTgfqIkE7EHZoESAf5PP5aLZYWrdSskeoIGI27+4asSMF1q UNbvNVjrGKT0GU73UKbOlybzS68hDP7tcZd//yi0T64DRtL/iNGC9OMGPQlGXptBDBvl coOw== 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=C7hoCCHwyZ78t8MhfigepGi6we5dYHokO9yNVTkJZRY=; b=n4PujUQkyQIyL1+0OoSBjcNejWhDx28KNSkhaZAcPQe8n/+3wXbAPdI8YUcDPxhWs5 xCfpMUfJr0nTkqNAwI/T9s9aJjKgh8DsaexLiEeoURBR1xQD2IIVDPAZsGf/A34RSV29 EB7cvcFpBcQGSvZlmH7BqvTofBTJuUT8t5AH0/eai7nDuCSvvDzz5MCasio5GKUzGtz5 YzeytVtpie1s/SCjGZjJ6oqfObP6RRMJ4LOltIFZ7S2O4QA/gvsgWnnjCwiApbKkOLC2 MhF/KmDHCUCAWF1xtqgUIcn5I+eT781BkGYNceROAMXcgxQNzDLkkLgMSJ28cM/IDnPu LyMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Zf4b3AvS; 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 a2-20020aa79702000000b00660679b5120si586792pfg.216.2023.06.08.02.44.41; Thu, 08 Jun 2023 02:44:53 -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=Zf4b3AvS; 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 S235944AbjFHJcg (ORCPT + 99 others); Thu, 8 Jun 2023 05:32:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235851AbjFHJby (ORCPT ); Thu, 8 Jun 2023 05:31: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 9A3BF30D6 for ; Thu, 8 Jun 2023 02:30:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686216612; 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=C7hoCCHwyZ78t8MhfigepGi6we5dYHokO9yNVTkJZRY=; b=Zf4b3AvSO0spHfFARSKfqYld3v6wIYr8JMmvSqBpmWvScZdVB5otvriYQyGBcy7JIHJXEY Gs+SyvLLfo5g79x1pQnSdMK6VtjQGExkA0EN9iKMNwHLYz3+lmRT8r1U/1icO4axiW3AP0 40C3P4W0A38YCidiGbuTzVbuLP+J28Y= Received: from mail-lj1-f199.google.com (mail-lj1-f199.google.com [209.85.208.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-628-CzqmV2rIPcCl9YD2vDuchQ-1; Thu, 08 Jun 2023 05:30:11 -0400 X-MC-Unique: CzqmV2rIPcCl9YD2vDuchQ-1 Received: by mail-lj1-f199.google.com with SMTP id 38308e7fff4ca-2b05b5a8c19so1932781fa.3 for ; Thu, 08 Jun 2023 02:30:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686216609; x=1688808609; 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=C7hoCCHwyZ78t8MhfigepGi6we5dYHokO9yNVTkJZRY=; b=TmDKKJv042IE+los1isnoLd4U7VWpNisY0Ufd8BSyS94hoKZs0ehNGgvPmNNkZGPRu tXJ1VNPKU6VhN+riItDwaQzFORnmBhDrinv2A3hiIPVzvYFOoLFVP2Rnazv97DTfr8zL j5JGRHrWWC0A7USZZIq0sj+KZiPLEXb1nreBpNtGUh6YdvG9wAN/Y5LliNreOaVMXfG1 7+wCAQP0aNmw3xfXnhTOo8OBKnKLb+/iHL+Rm0Y5rfluvHiVkxbys+c9LRcZhtid+xzz Yr0nao7ghrOl6LFdMS6Td9HDEIZGc28pMuN6erxbuEGrBSEhz1eJoA2oQqt1fFsf4teK Tfxw== X-Gm-Message-State: AC+VfDzA4koH0pQ4APJN79/j4L9nsT8AnKBWDe3z6MTQuvjKgd18hprn ElLtl4p4f6EhzZEPSaOhwXZnaZtQHfJwOHHhWs7xlkL9u7mxr1bNP6K0ESn58jpqtFha++e/QqH TTsdE9w4YaIN/GWO9VqZ0/TRNl/h1xoJ66zJFhi+H X-Received: by 2002:a2e:7c01:0:b0:2b0:45ff:7952 with SMTP id x1-20020a2e7c01000000b002b045ff7952mr2937341ljc.46.1686216609603; Thu, 08 Jun 2023 02:30:09 -0700 (PDT) X-Received: by 2002:a2e:7c01:0:b0:2b0:45ff:7952 with SMTP id x1-20020a2e7c01000000b002b045ff7952mr2937333ljc.46.1686216609317; Thu, 08 Jun 2023 02:30:09 -0700 (PDT) MIME-Version: 1.0 References: <32ejjuvhvcicv7wjuetkv34qtlpa657n4zlow4eq3fsi2twozk@iqnd2t5tw2an> <20230606085643-mutt-send-email-mst@kernel.org> <20230607054246-mutt-send-email-mst@kernel.org> <20230608020111-mutt-send-email-mst@kernel.org> <5giudxjp6siucr4l3i4tggrh2dpqiqhhihmdd34w3mq2pm5dlo@mrqpbwckpxai> In-Reply-To: From: Jason Wang Date: Thu, 8 Jun 2023 17:29:58 +0800 Message-ID: Subject: Re: [PATCH] vhost-vdpa: filter VIRTIO_F_RING_PACKED feature To: Stefano Garzarella Cc: "Michael S. Tsirkin" , 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, 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 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 how > >> >> > > > > to support? > >> >> > > > > >> >> > > > It looks like we had it, but we took it out (by the way, we w= ere > >> >> > > > enabling packed even though we didn't support it): > >> >> > > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linu= x.git/commit/?id=3D6234f80574d7569444d8718355fa2838e92b158b > >> >> > > > > >> >> > > > The only problem I see is that for each new feature we have t= o modify > >> >> > > > the kernel. > >> >> > > > Could we have new features that don't require handling by vho= st-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. Fo= r example, > >> >> > > >> >> > 1) If some kernel version that is packed is not supported via > >> >> > set_vq_state, parents should not advertise PACKED features in thi= s > >> >> > case. > >> >> > 2) If the kernel has support packed set_vq_state(), but it's emul= ated > >> >> > 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 pare= nts. > >> >> > > >> >> > 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-shan= non.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 wel= l > >2) if it uses SET_VRING_BASE/GET_VRING_BASE. it might fail or break sile= ntly > > > >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 > > Thanks, > Stefano >