Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp728474rwd; Thu, 8 Jun 2023 07:04:14 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4bHHoJMsD80I+E3zi953LYv2JhmO5H15sDD2eyjxHL38Cs6My0suVG2XjCXak+BXmpcKKC X-Received: by 2002:a05:6a20:9185:b0:10e:2fd5:510d with SMTP id v5-20020a056a20918500b0010e2fd5510dmr4411667pzd.11.1686233054188; Thu, 08 Jun 2023 07:04:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686233054; cv=none; d=google.com; s=arc-20160816; b=wABdu2d4G78ENP3HTXe7sBnlmp6ROmDPkFvXNygMkaiFZn/U+pgHlxi9Uvfzv6Ltxc gQ5ggguaOXDrhMvD+PxlNVSiEKcIewNl74OAvvgxUkfzySiGjaBwRRW8StrAWQuuYfe5 k4dvALOP4yeZTwo32wBFNjkMaDk8tw0k4Yjn6bsPqp3KTQLE3KjfYAMij95aC/vOB2Wm VHJXOIsO5Mzl4J1ikyyqQGDILm5/w6T4/xkc0ChV3KIB50DvGG4Q5sgA4DCN06XO+q1X cQgSjRNqvt0JRIBiNtVM7rCCnmOmuQO3v2Dn1e117iPjD4QjSTeqZXCIlvtUSWpbGQmp KWMg== 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=73nshEeWhw2n5gdRpaAAi9lUSo+UIEZBfmddmf0WSo8=; b=xLvAulUORTmLcSCjvQ7Ctb27lmzG2IQK5bKkdpukD9stWq8nyKIm+zOXFW0mVmloj7 Ng5dWEddxjHRT7Z7kXQLvEVt1mVgabt/bevtOuiyNNR60xjK7uQXI1/d25Y8HHGCdt/d q0hIdsu1W5p1sy5VUc5jV9RgThsTAN6vfH7+XzQT2qBojBm6HA+f6IPM0Bs/hklovzQQ loDcnk1byfIMWygM/on7Xpi2gzLv/rWizCxC807CRDUFKP0velTCPNj3nOzidarCukxF 99714sYtKjl6VdCN9Zy9FV7UhakHLnBIKCa/ywGot+wHDfmV24SwWzQ6ukcOH7k+3rw1 bb5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=QW7DacbZ; 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 w184-20020a6382c1000000b0053f19be2174si1004314pgd.791.2023.06.08.07.03.49; Thu, 08 Jun 2023 07:04: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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=QW7DacbZ; 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 S236430AbjFHNrW (ORCPT + 99 others); Thu, 8 Jun 2023 09:47:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235625AbjFHNrU (ORCPT ); Thu, 8 Jun 2023 09:47:20 -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 38A2A1FD6 for ; Thu, 8 Jun 2023 06:46:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686231996; 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=73nshEeWhw2n5gdRpaAAi9lUSo+UIEZBfmddmf0WSo8=; b=QW7DacbZLKltZ0A87clNL628uRPcUz25ngxSTalGoe4kh7W4hThrZprVZLTvrIdxlZUHY6 a8WjDEgQNGAeZG5Aqw4qqIt77yKZeliVZY+QfZ89uZI3X7orHm3cTBfUL6At2rRJmZIQVB srdwxCfB446gOJaEpjTBRohRdZOixrs= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-484-CFvb6UQhNViOW_dtRlNrbA-1; Thu, 08 Jun 2023 09:46:35 -0400 X-MC-Unique: CFvb6UQhNViOW_dtRlNrbA-1 Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-30ade645c59so254258f8f.2 for ; Thu, 08 Jun 2023 06:46:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686231994; x=1688823994; 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=73nshEeWhw2n5gdRpaAAi9lUSo+UIEZBfmddmf0WSo8=; b=bnjcilHr8BMgIMzsz3cUK7AzKLfnGxOWcq2h0nklKr5a9w05y8uYYbC8TzxLen6u+m z5Gaks8EGznPvXIeQaqHc4uGaggUA5nlu6e3TvpwnstN7bKCzr6Udi++HRB3hJ3Lniss BQUbzsTyds2hqSafWKoBGnfmbP6pj3RuV2ZkXwm2eBwnKR1ogbukMaD6DrUOOSAbIQl4 e8ilbejCdCitzKDMnMqSx/RkYhJHaraca5Jx38fO4catJUlBxIyvxMxJJjs79s9UCXjV hj2P1XpopjAWcaqe9RvRDkg8g3KXIQxkBkuGttKx6HDeCCyBeGlVNyDoYhRexmPn9mJa XL6A== X-Gm-Message-State: AC+VfDzkX5Q6P7G99sCWP3nR2BFG+u2gRZy+FnhvsrrZ6SDr8Nvep6aM 4SQ0FNSltsv90CY3JbnJHRBROn6Xaug4RDjC4S9bJc6o/+G0SEkDA8KGVJ/g7U2V5XjwKim77Cn EFXIgxI8ImQLcVN3DujNV9oA5 X-Received: by 2002:adf:f547:0:b0:309:38af:91c6 with SMTP id j7-20020adff547000000b0030938af91c6mr7519235wrp.68.1686231994185; Thu, 08 Jun 2023 06:46:34 -0700 (PDT) X-Received: by 2002:adf:f547:0:b0:309:38af:91c6 with SMTP id j7-20020adff547000000b0030938af91c6mr7519218wrp.68.1686231993887; Thu, 08 Jun 2023 06:46:33 -0700 (PDT) Received: from redhat.com ([2.55.41.2]) by smtp.gmail.com with ESMTPSA id i1-20020adfefc1000000b0030647449730sm1671162wrp.74.2023.06.08.06.46.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Jun 2023 06:46:33 -0700 (PDT) Date: Thu, 8 Jun 2023 09:46:28 -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: <20230608094528-mutt-send-email-mst@kernel.org> 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> 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=-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=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 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). > > Thanks I am less concerned about stable, and much more concerned about the future. Assume we add a new ring format. It will be silently passed to vhost-vdpa and things break again. This is why I think we need an allowlist in vhost-vdpa. > > > > Thanks, > > Stefano > >