From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1B2BFC43334 for ; Tue, 28 Jun 2022 06:12:36 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 892594148F; Tue, 28 Jun 2022 06:12:36 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 892594148F Authentication-Results: smtp4.osuosl.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=XuQ4kKG/ X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id rwwoQbjroX69; Tue, 28 Jun 2022 06:12:35 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp4.osuosl.org (Postfix) with ESMTPS id 8AE89411C6; Tue, 28 Jun 2022 06:12:34 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 8AE89411C6 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 6D6A8C0039; Tue, 28 Jun 2022 06:12:34 +0000 (UTC) Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 47A75C002D for ; Tue, 28 Jun 2022 06:12:32 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 136074027A for ; Tue, 28 Jun 2022 06:12:32 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 136074027A Authentication-Results: smtp2.osuosl.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=XuQ4kKG/ X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id CyEY-0VXj7qO for ; Tue, 28 Jun 2022 06:12:31 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org C6F7440227 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by smtp2.osuosl.org (Postfix) with ESMTPS id C6F7440227 for ; Tue, 28 Jun 2022 06:12:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1656396749; 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: in-reply-to:in-reply-to:references:references; bh=Dx6dQM49vWdX9cmVmNPYk3K9FV6smpCQ8wm7kLXU688=; b=XuQ4kKG/370vVVzu3jpk5qNUts07UCgP7V2ua9SZ0gsk2PBgaw15XgQr9rz9EAi+pKfhw5 EgTEUU2oT4NbNcZFy0rg9eS08Cr9vACOEh0r/3HIobCroNsPfV5fQTn4Sl0GyiK1SMyvCT MW86/h1qG9EUymsWGoPIn3IgsjGDnxs= Received: from mail-lf1-f69.google.com (mail-lf1-f69.google.com [209.85.167.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-126-8yb4z_SRNTKdKgAQ-UtHvA-1; Tue, 28 Jun 2022 02:12:26 -0400 X-MC-Unique: 8yb4z_SRNTKdKgAQ-UtHvA-1 Received: by mail-lf1-f69.google.com with SMTP id cf10-20020a056512280a00b0047f5a295656so5774885lfb.15 for ; Mon, 27 Jun 2022 23:12:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Dx6dQM49vWdX9cmVmNPYk3K9FV6smpCQ8wm7kLXU688=; b=gqsHWArKwM7QDDbkjNLO1Iw6VYEiAmJURQwO8/rVfbOn7BUykEaoNAkRuGNlD1RRBw vK1JMiur+4Hgef2iDQUTjAXs/228sa3J/ybooW9QjukyO8uPxD/bL3bPARanQiOPsgcK ctG2U6CDAfJJ7jynvpvx8kHeofMwETMYw4rCgBwAuoPv6ZEElo+15TJIiqmw2/JuTPuZ afEh4nHTdHVhYrfAw1SpkSpTTGRWk4WinzETJSq9BqK3Yd8r0yPtjQoHpt0BtFHe8x+P 0drg5+rbLPIVRKp0rerCEBkkXQnfU+2PbEyRZIRl/ekjqGRDhnmqcj+iV0s1/n5eg7mc KzLA== X-Gm-Message-State: AJIora8AkTP+cCOpaK0mCUiccfHg6aNVvhqsuPvdJZi3fjV8jmfsIUQ+ cH28QdAgAFCQu5a43FNYWvbU8i+zWdA0vxX3TC08hoGFIX+r1XM5VlZDVeMejnx6qwU6ESq+syM m8Vou8HiYOOcfzEZcldFEmhEjpK+QbXEJ7AQYrvAlIoyxlvF8wdvNBBKyNw== X-Received: by 2002:a05:6512:13a5:b0:47d:c1d9:dea8 with SMTP id p37-20020a05651213a500b0047dc1d9dea8mr10373853lfa.442.1656396744834; Mon, 27 Jun 2022 23:12:24 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sXN+QfgdhlGQk/CZZ9irUZ7rpfge9ShgLuLje1BX5ivPuK52DeT/MuedO9nPEXy/Kb7bkkyZVCwlmvRGeNCLg= X-Received: by 2002:a05:6512:13a5:b0:47d:c1d9:dea8 with SMTP id p37-20020a05651213a500b0047dc1d9dea8mr10373832lfa.442.1656396744537; Mon, 27 Jun 2022 23:12:24 -0700 (PDT) MIME-Version: 1.0 References: <20220624025817-mutt-send-email-mst@kernel.org> <20220627023841-mutt-send-email-mst@kernel.org> <20220627034733-mutt-send-email-mst@kernel.org> <20220627074723-mutt-send-email-mst@kernel.org> <20220628014309-mutt-send-email-mst@kernel.org> <20220628020832-mutt-send-email-mst@kernel.org> In-Reply-To: <20220628020832-mutt-send-email-mst@kernel.org> From: Jason Wang Date: Tue, 28 Jun 2022 14:12:13 +0800 Message-ID: Subject: Re: [PATCH v10 25/41] virtio_pci: struct virtio_pci_common_cfg add queue_notify_data To: "Michael S. Tsirkin" Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jasowang@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Cc: Vadim Pasternak , linux-remoteproc@vger.kernel.org, Alexei Starovoitov , virtualization , Eric Dumazet , Alexander Gordeev , kangjie.xu@linux.alibaba.com, Anton Ivanov , kvm , Daniel Borkmann , Richard Weinberger , Vincent Whitchurch , John Fastabend , Halil Pasic , Jakub Kicinski , platform-driver-x86@vger.kernel.org, Eric Farman , Jesper Dangaard Brouer , Vasily Gorbik , linux-s390@vger.kernel.org, Heiko Carstens , linux-um@lists.infradead.org, Mark Gross , Hans de Goede , Bjorn Andersson , "open list:XDP \(eXpress Data Path\)" , Paolo Abeni , Mathieu Poirier , netdev , Cornelia Huck , Sven Schnelle , Johannes Berg , "David S. Miller" X-BeenThere: virtualization@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux virtualization List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: virtualization-bounces@lists.linux-foundation.org Sender: "Virtualization" On Tue, Jun 28, 2022 at 2:10 PM Michael S. Tsirkin wrote: > > On Tue, Jun 28, 2022 at 02:07:28PM +0800, Jason Wang wrote: > > On Tue, Jun 28, 2022 at 1:46 PM Michael S. Tsirkin wrote: > > > > > > On Tue, Jun 28, 2022 at 11:50:37AM +0800, Jason Wang wrote: > > > > On Mon, Jun 27, 2022 at 7:53 PM Michael S. Tsirkin wrote: > > > > > > > > > > On Mon, Jun 27, 2022 at 04:14:20PM +0800, Jason Wang wrote: > > > > > > On Mon, Jun 27, 2022 at 3:58 PM Michael S. Tsirkin wrote: > > > > > > > > > > > > > > On Mon, Jun 27, 2022 at 03:45:30PM +0800, Jason Wang wrote: > > > > > > > > On Mon, Jun 27, 2022 at 2:39 PM Michael S. Tsirkin wrote: > > > > > > > > > > > > > > > > > > On Mon, Jun 27, 2022 at 10:30:42AM +0800, Jason Wang wrote: > > > > > > > > > > On Fri, Jun 24, 2022 at 2:59 PM Michael S. Tsirkin wrote: > > > > > > > > > > > > > > > > > > > > > > On Fri, Jun 24, 2022 at 10:56:05AM +0800, Xuan Zhuo wrote: > > > > > > > > > > > > Add queue_notify_data in struct virtio_pci_common_cfg, which comes from > > > > > > > > > > > > here https://github.com/oasis-tcs/virtio-spec/issues/89 > > > > > > > > > > > > > > > > > > > > > > > > For not breaks uABI, add a new struct virtio_pci_common_cfg_notify. > > > > > > > > > > > > > > > > > > > > > > What exactly is meant by not breaking uABI? > > > > > > > > > > > Users are supposed to be prepared for struct size to change ... no? > > > > > > > > > > > > > > > > > > > > Not sure, any doc for this? > > > > > > > > > > > > > > > > > > > > Thanks > > > > > > > > > > > > > > > > > > > > > > > > > > > Well we have this: > > > > > > > > > > > > > > > > > > The drivers SHOULD only map part of configuration structure > > > > > > > > > large enough for device operation. The drivers MUST handle > > > > > > > > > an unexpectedly large \field{length}, but MAY check that \field{length} > > > > > > > > > is large enough for device operation. > > > > > > > > > > > > > > > > Yes, but that's the device/driver interface. What's done here is the > > > > > > > > userspace/kernel. > > > > > > > > > > > > > > > > Userspace may break if it uses e.g sizeof(struct virtio_pci_common_cfg)? > > > > > > > > > > > > > > > > Thanks > > > > > > > > > > > > > > Hmm I guess there's risk... but then how are we going to maintain this > > > > > > > going forward? Add a new struct on any change? > > > > > > > > > > > > This is the way we have used it for the past 5 or more years. I don't > > > > > > see why this must be handled in the vq reset feature. > > > > > > > > > > > > >Can we at least > > > > > > > prevent this going forward somehow? > > > > > > > > > > > > Like have some padding? > > > > > > > > > > > > Thanks > > > > > > > > > > Maybe - this is what QEMU does ... > > > > > > > > Do you want this to be addressed in this series (it's already very huge anyhow)? > > > > > > > > Thanks > > > > > > Let's come up with a solution at least. QEMU does not seem to need the struct. > > > > If we want to implement it in Qemu we need that: > > > > https://github.com/fengidri/qemu/commit/39b79335cb55144d11a3b01f93d46cc73342c6bb > > > > > Let's just put > > > it in virtio_pci_modern.h for now then? > > > > Does this mean userspace needs to define the struct by their own > > instead of depending on the uapi in the future? > > > > Thanks > > > $ git grep 'struct virtio_pci_common_cfg' > include/standard-headers/linux/virtio_pci.h:struct virtio_pci_common_cfg { > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, device_feature)); > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, device_feature)); > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, guest_feature)); > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, guest_feature)); > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, queue_select), > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, queue_size)); > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, queue_desc_lo), > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, queue_desc_hi), > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, queue_avail_lo), > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, queue_avail_hi), > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, queue_used_lo), > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, queue_used_hi), > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, queue_enable), 1); > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, msix_config), entry); > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, queue_msix_vector), > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, > > > The only user of the struct is libqos and it just wants > the offsets so can use macros just as well. Yes, so this way should be fine. Thanks > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Since I want to add queue_reset after queue_notify_data, I submitted > > > > > > > > > > > > this patch first. > > > > > > > > > > > > > > > > > > > > > > > > Signed-off-by: Xuan Zhuo > > > > > > > > > > > > Acked-by: Jason Wang > > > > > > > > > > > > --- > > > > > > > > > > > > include/uapi/linux/virtio_pci.h | 7 +++++++ > > > > > > > > > > > > 1 file changed, 7 insertions(+) > > > > > > > > > > > > > > > > > > > > > > > > diff --git a/include/uapi/linux/virtio_pci.h b/include/uapi/linux/virtio_pci.h > > > > > > > > > > > > index 3a86f36d7e3d..22bec9bd0dfc 100644 > > > > > > > > > > > > --- a/include/uapi/linux/virtio_pci.h > > > > > > > > > > > > +++ b/include/uapi/linux/virtio_pci.h > > > > > > > > > > > > @@ -166,6 +166,13 @@ struct virtio_pci_common_cfg { > > > > > > > > > > > > __le32 queue_used_hi; /* read-write */ > > > > > > > > > > > > }; > > > > > > > > > > > > > > > > > > > > > > > > +struct virtio_pci_common_cfg_notify { > > > > > > > > > > > > + struct virtio_pci_common_cfg cfg; > > > > > > > > > > > > + > > > > > > > > > > > > + __le16 queue_notify_data; /* read-write */ > > > > > > > > > > > > + __le16 padding; > > > > > > > > > > > > +}; > > > > > > > > > > > > + > > > > > > > > > > > > /* Fields in VIRTIO_PCI_CAP_PCI_CFG: */ > > > > > > > > > > > > struct virtio_pci_cfg_cap { > > > > > > > > > > > > struct virtio_pci_cap cap; > > > > > > > > > > > > -- > > > > > > > > > > > > 2.31.0 > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 172D0C433EF for ; Tue, 28 Jun 2022 06:13:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343514AbiF1GNN (ORCPT ); Tue, 28 Jun 2022 02:13:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245490AbiF1GMa (ORCPT ); Tue, 28 Jun 2022 02:12:30 -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 ESMTP id F1F882610A for ; Mon, 27 Jun 2022 23:12:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1656396748; 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: in-reply-to:in-reply-to:references:references; bh=Dx6dQM49vWdX9cmVmNPYk3K9FV6smpCQ8wm7kLXU688=; b=dKEaPyWtbnBXm29muTFnCoEgXGlmd00ZkTQyJG84/bEwP8SnFuI+wHlRv/BBBxm/gC7SGc IQ+G62Y0G45VU75DFsda7EKaVkJ1x79Akm6CbBprqxB2qUNf25nM8xPgW1cmADnggtaPDN 8lLm0yeWMAybd0fxXTExnLzrcJcJytE= Received: from mail-lf1-f71.google.com (mail-lf1-f71.google.com [209.85.167.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-126-oWPKY6DENBqHyraiArHr-g-1; Tue, 28 Jun 2022 02:12:26 -0400 X-MC-Unique: oWPKY6DENBqHyraiArHr-g-1 Received: by mail-lf1-f71.google.com with SMTP id p36-20020a05651213a400b004779d806c13so5764090lfa.10 for ; Mon, 27 Jun 2022 23:12:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Dx6dQM49vWdX9cmVmNPYk3K9FV6smpCQ8wm7kLXU688=; b=C8AnvHEGZEW5fsswSRkWnabd3+J6rOUmPFVNPSbC845/XXRg+p2odn35KllFjuA8X3 Ma8wkq9zr12iTpZ2V9RA5Ivu3xv5LMuLMkLVo3YJDEZWPUY3PP5THLxZK+4qOqnORlU1 pDNp4ja6mHqh3boxayHFfCFa1cV66/1lHNyJIGrAcev6ZrBFZYGA/bDcsc1nD6K2IAU4 xAYiCP933q+EEBO4lLn9neOdzYwlxQT1Mj2yPXh4oLpfWcDa3eOpeI7+Jv2CByw7GRkA tmeCkWCDQmqEOw/u2DQDsqBxGHe8tAWapvulTQnbecIRt2GxIep49TNbOeHQyjJCeoqP L13w== X-Gm-Message-State: AJIora/5cgLXiBOKJKZo+OP8kgZZrScpB+Zf0n3DGuNfd0X12h9Ac/VS /V09Ncj4fPFFPyHYZzWo4pzYMbKBvjGzulux2g8+dKtb4Bu6PIOnUvos7XiXX71BwGR+yCIOmka X6QnozIwe4ePsltiacPhNnpYRagES5+6A39uYBCQ6jiwPUg== X-Received: by 2002:a05:6512:13a5:b0:47d:c1d9:dea8 with SMTP id p37-20020a05651213a500b0047dc1d9dea8mr10373844lfa.442.1656396744828; Mon, 27 Jun 2022 23:12:24 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sXN+QfgdhlGQk/CZZ9irUZ7rpfge9ShgLuLje1BX5ivPuK52DeT/MuedO9nPEXy/Kb7bkkyZVCwlmvRGeNCLg= X-Received: by 2002:a05:6512:13a5:b0:47d:c1d9:dea8 with SMTP id p37-20020a05651213a500b0047dc1d9dea8mr10373832lfa.442.1656396744537; Mon, 27 Jun 2022 23:12:24 -0700 (PDT) MIME-Version: 1.0 References: <20220624025817-mutt-send-email-mst@kernel.org> <20220627023841-mutt-send-email-mst@kernel.org> <20220627034733-mutt-send-email-mst@kernel.org> <20220627074723-mutt-send-email-mst@kernel.org> <20220628014309-mutt-send-email-mst@kernel.org> <20220628020832-mutt-send-email-mst@kernel.org> In-Reply-To: <20220628020832-mutt-send-email-mst@kernel.org> From: Jason Wang Date: Tue, 28 Jun 2022 14:12:13 +0800 Message-ID: Subject: Re: [PATCH v10 25/41] virtio_pci: struct virtio_pci_common_cfg add queue_notify_data To: "Michael S. Tsirkin" Cc: Xuan Zhuo , virtualization , Richard Weinberger , Anton Ivanov , Johannes Berg , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Hans de Goede , Mark Gross , Vadim Pasternak , Bjorn Andersson , Mathieu Poirier , Cornelia Huck , Halil Pasic , Eric Farman , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , Vincent Whitchurch , linux-um@lists.infradead.org, netdev , platform-driver-x86@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-s390@vger.kernel.org, kvm , "open list:XDP (eXpress Data Path)" , kangjie.xu@linux.alibaba.com Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org On Tue, Jun 28, 2022 at 2:10 PM Michael S. Tsirkin wrote: > > On Tue, Jun 28, 2022 at 02:07:28PM +0800, Jason Wang wrote: > > On Tue, Jun 28, 2022 at 1:46 PM Michael S. Tsirkin wrote: > > > > > > On Tue, Jun 28, 2022 at 11:50:37AM +0800, Jason Wang wrote: > > > > On Mon, Jun 27, 2022 at 7:53 PM Michael S. Tsirkin wrote: > > > > > > > > > > On Mon, Jun 27, 2022 at 04:14:20PM +0800, Jason Wang wrote: > > > > > > On Mon, Jun 27, 2022 at 3:58 PM Michael S. Tsirkin wrote: > > > > > > > > > > > > > > On Mon, Jun 27, 2022 at 03:45:30PM +0800, Jason Wang wrote: > > > > > > > > On Mon, Jun 27, 2022 at 2:39 PM Michael S. Tsirkin wrote: > > > > > > > > > > > > > > > > > > On Mon, Jun 27, 2022 at 10:30:42AM +0800, Jason Wang wrote: > > > > > > > > > > On Fri, Jun 24, 2022 at 2:59 PM Michael S. Tsirkin wrote: > > > > > > > > > > > > > > > > > > > > > > On Fri, Jun 24, 2022 at 10:56:05AM +0800, Xuan Zhuo wrote: > > > > > > > > > > > > Add queue_notify_data in struct virtio_pci_common_cfg, which comes from > > > > > > > > > > > > here https://github.com/oasis-tcs/virtio-spec/issues/89 > > > > > > > > > > > > > > > > > > > > > > > > For not breaks uABI, add a new struct virtio_pci_common_cfg_notify. > > > > > > > > > > > > > > > > > > > > > > What exactly is meant by not breaking uABI? > > > > > > > > > > > Users are supposed to be prepared for struct size to change ... no? > > > > > > > > > > > > > > > > > > > > Not sure, any doc for this? > > > > > > > > > > > > > > > > > > > > Thanks > > > > > > > > > > > > > > > > > > > > > > > > > > > Well we have this: > > > > > > > > > > > > > > > > > > The drivers SHOULD only map part of configuration structure > > > > > > > > > large enough for device operation. The drivers MUST handle > > > > > > > > > an unexpectedly large \field{length}, but MAY check that \field{length} > > > > > > > > > is large enough for device operation. > > > > > > > > > > > > > > > > Yes, but that's the device/driver interface. What's done here is the > > > > > > > > userspace/kernel. > > > > > > > > > > > > > > > > Userspace may break if it uses e.g sizeof(struct virtio_pci_common_cfg)? > > > > > > > > > > > > > > > > Thanks > > > > > > > > > > > > > > Hmm I guess there's risk... but then how are we going to maintain this > > > > > > > going forward? Add a new struct on any change? > > > > > > > > > > > > This is the way we have used it for the past 5 or more years. I don't > > > > > > see why this must be handled in the vq reset feature. > > > > > > > > > > > > >Can we at least > > > > > > > prevent this going forward somehow? > > > > > > > > > > > > Like have some padding? > > > > > > > > > > > > Thanks > > > > > > > > > > Maybe - this is what QEMU does ... > > > > > > > > Do you want this to be addressed in this series (it's already very huge anyhow)? > > > > > > > > Thanks > > > > > > Let's come up with a solution at least. QEMU does not seem to need the struct. > > > > If we want to implement it in Qemu we need that: > > > > https://github.com/fengidri/qemu/commit/39b79335cb55144d11a3b01f93d46cc73342c6bb > > > > > Let's just put > > > it in virtio_pci_modern.h for now then? > > > > Does this mean userspace needs to define the struct by their own > > instead of depending on the uapi in the future? > > > > Thanks > > > $ git grep 'struct virtio_pci_common_cfg' > include/standard-headers/linux/virtio_pci.h:struct virtio_pci_common_cfg { > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, device_feature)); > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, device_feature)); > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, guest_feature)); > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, guest_feature)); > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, queue_select), > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, queue_size)); > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, queue_desc_lo), > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, queue_desc_hi), > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, queue_avail_lo), > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, queue_avail_hi), > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, queue_used_lo), > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, queue_used_hi), > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, queue_enable), 1); > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, msix_config), entry); > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, queue_msix_vector), > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, > > > The only user of the struct is libqos and it just wants > the offsets so can use macros just as well. Yes, so this way should be fine. Thanks > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Since I want to add queue_reset after queue_notify_data, I submitted > > > > > > > > > > > > this patch first. > > > > > > > > > > > > > > > > > > > > > > > > Signed-off-by: Xuan Zhuo > > > > > > > > > > > > Acked-by: Jason Wang > > > > > > > > > > > > --- > > > > > > > > > > > > include/uapi/linux/virtio_pci.h | 7 +++++++ > > > > > > > > > > > > 1 file changed, 7 insertions(+) > > > > > > > > > > > > > > > > > > > > > > > > diff --git a/include/uapi/linux/virtio_pci.h b/include/uapi/linux/virtio_pci.h > > > > > > > > > > > > index 3a86f36d7e3d..22bec9bd0dfc 100644 > > > > > > > > > > > > --- a/include/uapi/linux/virtio_pci.h > > > > > > > > > > > > +++ b/include/uapi/linux/virtio_pci.h > > > > > > > > > > > > @@ -166,6 +166,13 @@ struct virtio_pci_common_cfg { > > > > > > > > > > > > __le32 queue_used_hi; /* read-write */ > > > > > > > > > > > > }; > > > > > > > > > > > > > > > > > > > > > > > > +struct virtio_pci_common_cfg_notify { > > > > > > > > > > > > + struct virtio_pci_common_cfg cfg; > > > > > > > > > > > > + > > > > > > > > > > > > + __le16 queue_notify_data; /* read-write */ > > > > > > > > > > > > + __le16 padding; > > > > > > > > > > > > +}; > > > > > > > > > > > > + > > > > > > > > > > > > /* Fields in VIRTIO_PCI_CAP_PCI_CFG: */ > > > > > > > > > > > > struct virtio_pci_cfg_cap { > > > > > > > > > > > > struct virtio_pci_cap cap; > > > > > > > > > > > > -- > > > > > > > > > > > > 2.31.0 > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o64Sd-004cNn-31 for linux-um@lists.infradead.org; Tue, 28 Jun 2022 06:12:36 +0000 Received: by mail-lf1-f72.google.com with SMTP id v5-20020a05651203a500b0047faf076d1dso5716745lfp.8 for ; Mon, 27 Jun 2022 23:12:26 -0700 (PDT) MIME-Version: 1.0 References: <20220624025817-mutt-send-email-mst@kernel.org> <20220627023841-mutt-send-email-mst@kernel.org> <20220627034733-mutt-send-email-mst@kernel.org> <20220627074723-mutt-send-email-mst@kernel.org> <20220628014309-mutt-send-email-mst@kernel.org> <20220628020832-mutt-send-email-mst@kernel.org> In-Reply-To: <20220628020832-mutt-send-email-mst@kernel.org> From: Jason Wang Date: Tue, 28 Jun 2022 14:12:13 +0800 Message-ID: Subject: Re: [PATCH v10 25/41] virtio_pci: struct virtio_pci_common_cfg add queue_notify_data List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-um" Errors-To: linux-um-bounces+geert=linux-m68k.org@lists.infradead.org To: "Michael S. Tsirkin" Cc: Xuan Zhuo , virtualization , Richard Weinberger , Anton Ivanov , Johannes Berg , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Hans de Goede , Mark Gross , Vadim Pasternak , Bjorn Andersson , Mathieu Poirier , Cornelia Huck , Halil Pasic , Eric Farman , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , Vincent Whitchurch , linux-um@lists.infradead.org, netdev , platform-driver-x86@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-s390@vger.kernel.org, kvm , "open list:XDP (eXpress Data Path)" , kangjie.xu@linux.alibaba.com On Tue, Jun 28, 2022 at 2:10 PM Michael S. Tsirkin wrote: > > On Tue, Jun 28, 2022 at 02:07:28PM +0800, Jason Wang wrote: > > On Tue, Jun 28, 2022 at 1:46 PM Michael S. Tsirkin wrote: > > > > > > On Tue, Jun 28, 2022 at 11:50:37AM +0800, Jason Wang wrote: > > > > On Mon, Jun 27, 2022 at 7:53 PM Michael S. Tsirkin wrote: > > > > > > > > > > On Mon, Jun 27, 2022 at 04:14:20PM +0800, Jason Wang wrote: > > > > > > On Mon, Jun 27, 2022 at 3:58 PM Michael S. Tsirkin wrote: > > > > > > > > > > > > > > On Mon, Jun 27, 2022 at 03:45:30PM +0800, Jason Wang wrote: > > > > > > > > On Mon, Jun 27, 2022 at 2:39 PM Michael S. Tsirkin wrote: > > > > > > > > > > > > > > > > > > On Mon, Jun 27, 2022 at 10:30:42AM +0800, Jason Wang wrote: > > > > > > > > > > On Fri, Jun 24, 2022 at 2:59 PM Michael S. Tsirkin wrote: > > > > > > > > > > > > > > > > > > > > > > On Fri, Jun 24, 2022 at 10:56:05AM +0800, Xuan Zhuo wrote: > > > > > > > > > > > > Add queue_notify_data in struct virtio_pci_common_cfg, which comes from > > > > > > > > > > > > here https://github.com/oasis-tcs/virtio-spec/issues/89 > > > > > > > > > > > > > > > > > > > > > > > > For not breaks uABI, add a new struct virtio_pci_common_cfg_notify. > > > > > > > > > > > > > > > > > > > > > > What exactly is meant by not breaking uABI? > > > > > > > > > > > Users are supposed to be prepared for struct size to change ... no? > > > > > > > > > > > > > > > > > > > > Not sure, any doc for this? > > > > > > > > > > > > > > > > > > > > Thanks > > > > > > > > > > > > > > > > > > > > > > > > > > > Well we have this: > > > > > > > > > > > > > > > > > > The drivers SHOULD only map part of configuration structure > > > > > > > > > large enough for device operation. The drivers MUST handle > > > > > > > > > an unexpectedly large \field{length}, but MAY check that \field{length} > > > > > > > > > is large enough for device operation. > > > > > > > > > > > > > > > > Yes, but that's the device/driver interface. What's done here is the > > > > > > > > userspace/kernel. > > > > > > > > > > > > > > > > Userspace may break if it uses e.g sizeof(struct virtio_pci_common_cfg)? > > > > > > > > > > > > > > > > Thanks > > > > > > > > > > > > > > Hmm I guess there's risk... but then how are we going to maintain this > > > > > > > going forward? Add a new struct on any change? > > > > > > > > > > > > This is the way we have used it for the past 5 or more years. I don't > > > > > > see why this must be handled in the vq reset feature. > > > > > > > > > > > > >Can we at least > > > > > > > prevent this going forward somehow? > > > > > > > > > > > > Like have some padding? > > > > > > > > > > > > Thanks > > > > > > > > > > Maybe - this is what QEMU does ... > > > > > > > > Do you want this to be addressed in this series (it's already very huge anyhow)? > > > > > > > > Thanks > > > > > > Let's come up with a solution at least. QEMU does not seem to need the struct. > > > > If we want to implement it in Qemu we need that: > > > > https://github.com/fengidri/qemu/commit/39b79335cb55144d11a3b01f93d46cc73342c6bb > > > > > Let's just put > > > it in virtio_pci_modern.h for now then? > > > > Does this mean userspace needs to define the struct by their own > > instead of depending on the uapi in the future? > > > > Thanks > > > $ git grep 'struct virtio_pci_common_cfg' > include/standard-headers/linux/virtio_pci.h:struct virtio_pci_common_cfg { > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, device_feature)); > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, device_feature)); > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, guest_feature)); > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, guest_feature)); > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, queue_select), > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, queue_size)); > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, queue_desc_lo), > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, queue_desc_hi), > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, queue_avail_lo), > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, queue_avail_hi), > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, queue_used_lo), > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, queue_used_hi), > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, queue_enable), 1); > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, msix_config), entry); > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, queue_msix_vector), > tests/qtest/libqos/virtio-pci-modern.c: offsetof(struct virtio_pci_common_cfg, > > > The only user of the struct is libqos and it just wants > the offsets so can use macros just as well. Yes, so this way should be fine. Thanks > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Since I want to add queue_reset after queue_notify_data, I submitted > > > > > > > > > > > > this patch first. > > > > > > > > > > > > > > > > > > > > > > > > Signed-off-by: Xuan Zhuo > > > > > > > > > > > > Acked-by: Jason Wang > > > > > > > > > > > > --- > > > > > > > > > > > > include/uapi/linux/virtio_pci.h | 7 +++++++ > > > > > > > > > > > > 1 file changed, 7 insertions(+) > > > > > > > > > > > > > > > > > > > > > > > > diff --git a/include/uapi/linux/virtio_pci.h b/include/uapi/linux/virtio_pci.h > > > > > > > > > > > > index 3a86f36d7e3d..22bec9bd0dfc 100644 > > > > > > > > > > > > --- a/include/uapi/linux/virtio_pci.h > > > > > > > > > > > > +++ b/include/uapi/linux/virtio_pci.h > > > > > > > > > > > > @@ -166,6 +166,13 @@ struct virtio_pci_common_cfg { > > > > > > > > > > > > __le32 queue_used_hi; /* read-write */ > > > > > > > > > > > > }; > > > > > > > > > > > > > > > > > > > > > > > > +struct virtio_pci_common_cfg_notify { > > > > > > > > > > > > + struct virtio_pci_common_cfg cfg; > > > > > > > > > > > > + > > > > > > > > > > > > + __le16 queue_notify_data; /* read-write */ > > > > > > > > > > > > + __le16 padding; > > > > > > > > > > > > +}; > > > > > > > > > > > > + > > > > > > > > > > > > /* Fields in VIRTIO_PCI_CAP_PCI_CFG: */ > > > > > > > > > > > > struct virtio_pci_cfg_cap { > > > > > > > > > > > > struct virtio_pci_cap cap; > > > > > > > > > > > > -- > > > > > > > > > > > > 2.31.0 > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > _______________________________________________ linux-um mailing list linux-um@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-um