[{"id":2936343,"web_url":"http://patchwork.ozlabs.org/comment/2936343/","msgid":"<226ab2d4-0b3f-3a18-bed4-be5d278d2069@redhat.com>","list_archive_url":null,"date":"2022-07-21T03:39:17","subject":"Re: [PATCH v12 02/40] virtio: struct virtio_config_ops add callbacks\n for queue_reset","submitter":{"id":5225,"url":"http://patchwork.ozlabs.org/api/people/5225/","name":"Jason Wang","email":"jasowang@redhat.com"},"content":"在 2022/7/20 11:03, Xuan Zhuo 写道:\n> reset can be divided into the following four steps (example):\n>   1. transport: notify the device to reset the queue\n>   2. vring:     recycle the buffer submitted\n>   3. vring:     reset/resize the vring (may re-alloc)\n>   4. transport: mmap vring to device, and enable the queue\n>\n> In order to support queue reset, add two callbacks in struct\n> virtio_config_ops to implement steps 1 and 4.\n>\n> Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>\n\n\nAcked-by: Jason Wang <jasowang@redhat.com>\n\n\n> ---\n>   include/linux/virtio_config.h | 14 ++++++++++++++\n>   1 file changed, 14 insertions(+)\n>\n> diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h\n> index b47c2e7ed0ee..36ec7be1f480 100644\n> --- a/include/linux/virtio_config.h\n> +++ b/include/linux/virtio_config.h\n> @@ -78,6 +78,18 @@ struct virtio_shm_region {\n>    * @set_vq_affinity: set the affinity for a virtqueue (optional).\n>    * @get_vq_affinity: get the affinity for a virtqueue (optional).\n>    * @get_shm_region: get a shared memory region based on the index.\n> + * @disable_vq_and_reset: reset a queue individually (optional).\n> + *\tvq: the virtqueue\n> + *\tReturns 0 on success or error status\n> + *\tdisable_vq_and_reset will guarantee that the callbacks are disabled and\n> + *\tsynchronized.\n> + *\tExcept for the callback, the caller should guarantee that the vring is\n> + *\tnot accessed by any functions of virtqueue.\n> + * @enable_vq_after_reset: enable a reset queue\n> + *\tvq: the virtqueue\n> + *\tReturns 0 on success or error status\n> + *\tIf disable_vq_and_reset is set, then enable_vq_after_reset must also be\n> + *\tset.\n>    */\n>   typedef void vq_callback_t(struct virtqueue *);\n>   struct virtio_config_ops {\n> @@ -104,6 +116,8 @@ struct virtio_config_ops {\n>   \t\t\tint index);\n>   \tbool (*get_shm_region)(struct virtio_device *vdev,\n>   \t\t\t       struct virtio_shm_region *region, u8 id);\n> +\tint (*disable_vq_and_reset)(struct virtqueue *vq);\n> +\tint (*enable_vq_after_reset)(struct virtqueue *vq);\n>   };\n>   \n>   /* If driver didn't advertise the feature, it will never appear. */","headers":{"Return-Path":"\n <linux-um-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["bilbo.ozlabs.org;\n\tdkim=pass (2048-bit key;\n secure) header.d=lists.infradead.org header.i=@lists.infradead.org\n header.a=rsa-sha256 header.s=bombadil.20210309 header.b=q+shZ6/n;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=PzjjwtQA;\n\tdkim-atps=neutral","ozlabs.org;\n spf=none (no SPF record) smtp.mailfrom=lists.infradead.org\n (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org;\n envelope-from=linux-um-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org;\n receiver=<UNKNOWN>)","relay.mimecast.com;\n\tauth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jasowang@redhat.com"],"Received":["from bombadil.infradead.org (bombadil.infradead.org\n [IPv6:2607:7c80:54:3::133])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n\t(No client certificate requested)\n\tby bilbo.ozlabs.org (Postfix) with ESMTPS id 4LpJGq10Dgz9sFk\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 21 Jul 2022 13:39:47 +1000 (AEST)","from localhost ([::1] helo=bombadil.infradead.org)\n\tby bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux))\n\tid 1oEN2H-00Fp8T-0A; Thu, 21 Jul 2022 03:39:37 +0000","from us-smtp-delivery-124.mimecast.com ([170.10.129.124])\n\tby bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux))\n\tid 1oEN2E-00Fp3I-Aa\n\tfor linux-um@lists.infradead.org; Thu, 21 Jul 2022 03:39:35 +0000","from mail-pj1-f70.google.com (mail-pj1-f70.google.com\n [209.85.216.70]) by relay.mimecast.com with ESMTP with STARTTLS\n (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id\n us-mta-193-Zf3sBbdBOHey_V4eOHQLSA-1; Wed, 20 Jul 2022 23:39:32 -0400","by mail-pj1-f70.google.com with SMTP id\n r13-20020a17090a454d00b001f04dfc6195so195913pjm.2\n        for <linux-um@lists.infradead.org>;\n Wed, 20 Jul 2022 20:39:31 -0700 (PDT)","from [10.72.12.47] ([209.132.188.80])\n        by smtp.gmail.com with ESMTPSA id\n v12-20020aa799cc000000b00528f9597fb3sm401825pfi.197.2022.07.20.20.39.20\n        (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);\n        Wed, 20 Jul 2022 20:39:30 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n\td=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type:\n\tContent-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive:\n\tList-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To:Subject:\n\tMIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description:\n\tResent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:\n\tList-Owner; bh=z8BMp7fUqdTmvUphUsVCDIyWNHUS6mjmfHPY6y0CrOs=; b=q+shZ6/nDpX7Yj\n\tcFuzVpZ5mPcnNT2O6QmaMSm1bNa2h+KzozOxJfCouEqv3pHQyxDStGiXOS1+AxnvDmKYWbg8GI74A\n\t4ah9MC1gQw9xmQSJGMk9opOsPGupqv8tiCfj00XuOZNwvnPTs17+gyZtZ5rD3z/+oV9noSbtEHXg7\n\thDaQ0EnjTMkorz2Fl+dYTkab7NFe28xj4ZcK66V28Oe0jF1K2jYY5zdPsnXykKp5vxYuUozcOQUpf\n\tNW3Wa5vG6e/YVezYVpMMeDnhVjw5TbGGNe7sl3p/eFlX8gZgIYAl2pY1hDqVoiejeICPxRt2Mi8Te\n\tgucpNtmr2sjJkUpFrOEA==;","v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1658374773;\n\th=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n\t to:to:cc:cc:mime-version:mime-version:content-type:content-type:\n\t content-transfer-encoding:content-transfer-encoding:\n\t in-reply-to:in-reply-to:references:references;\n\tbh=/J4B4qcC/O6PCOtnZhz1fVwUIt6mfKVcFfx+S26Hn1w=;\n\tb=PzjjwtQAOq2sS3wdzhV1HjWPBaASbS944qdfw8GTnGcyK1lIYmzfa9pzKF3iML09NBH7tU\n\tnxY+JW+u++S1IylLlRz2TiZrDsONOsfN2JEqW7fRj8hFB1dkoaft/PqcxrlZXG8/63VDID\n\tT8G6cGT+91j1gCJbopZdVO7BIIcWBh0="],"X-MC-Unique":"Zf3sBbdBOHey_V4eOHQLSA-1","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=1e100.net; s=20210112;\n        h=x-gm-message-state:message-id:date:mime-version:user-agent:subject\n         :content-language:to:cc:references:from:in-reply-to\n         :content-transfer-encoding;\n        bh=/J4B4qcC/O6PCOtnZhz1fVwUIt6mfKVcFfx+S26Hn1w=;\n        b=ZnXpgVTuYTv85bbU6hSQWRbkcnVNk3oqtUaz5+pTeD2vXNutThbx95S+PcgVk8eL9T\n         HBxthA0uNtoHt/8emTCnud2UNty5gCeG9XI5gwvn36zwnQvarlcIyQC8+TvTYBYC+AVz\n         E2coywzkY3oUbh55PajlIzSgrLPk8fwg19S99+mg4+k7hVH02mn+OxLoCgAn4iWRTEz/\n         fXbNOcg6+QazXRmI6WOmdi8pyEqmj7yyiwyGsRy8TOHbn3wsBh4vjB4Ure1YaNy1/JxQ\n         qGfZx8zUPI5P/BXq2nUei94nQ1y8E7TjSN8i+AE0Omf2oRZUt0JG//GYteOjwhjIS+15\n         0xwA==","X-Gm-Message-State":"AJIora9TRZuY063fU6XpXmq2x6UdRrSykjpo/16vK4YVFlrZOL7ha/bQ\n\tcSJzADfyciJS3pycAjOb3f5acIphvCQOY/58/4AeB2bv/8IHJDkK/ZYN4rbpP9L06BXc592x+ov\n\tdzsuozdLNPMp+YNcW7cnDZD4j","X-Received":["by 2002:a17:902:6943:b0:16c:ba81:1842 with SMTP id\n k3-20020a170902694300b0016cba811842mr34513135plt.24.1658374770934;\n        Wed, 20 Jul 2022 20:39:30 -0700 (PDT)","by 2002:a17:902:6943:b0:16c:ba81:1842 with SMTP id\n k3-20020a170902694300b0016cba811842mr34513102plt.24.1658374770599;\n        Wed, 20 Jul 2022 20:39:30 -0700 (PDT)"],"X-Google-Smtp-Source":"\n AGRyM1u1VrQwD/Z1oboj3J8gyT4oRNKMLENwwF8aDJAS3C/huxjXfcUqUKDMCERwkdW74rqe0+fCQA==","Message-ID":"<226ab2d4-0b3f-3a18-bed4-be5d278d2069@redhat.com>","Date":"Thu, 21 Jul 2022 11:39:17 +0800","MIME-Version":"1.0","User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0)\n Gecko/20100101 Thunderbird/91.11.0","Subject":"Re: [PATCH v12 02/40] virtio: struct virtio_config_ops add callbacks\n for queue_reset","To":"Xuan Zhuo <xuanzhuo@linux.alibaba.com>,\n virtualization@lists.linux-foundation.org","Cc":"Richard Weinberger <richard@nod.at>,\n Anton Ivanov <anton.ivanov@cambridgegreys.com>,\n Johannes Berg <johannes@sipsolutions.net>,\n \"Michael S. Tsirkin\" <mst@redhat.com>, \"David S. Miller\"\n <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>,\n Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,\n Hans de Goede <hdegoede@redhat.com>, Mark Gross <markgross@kernel.org>,\n Vadim Pasternak <vadimp@nvidia.com>,\n Bjorn Andersson <bjorn.andersson@linaro.org>,\n Mathieu Poirier <mathieu.poirier@linaro.org>,\n Cornelia Huck <cohuck@redhat.com>, Halil Pasic <pasic@linux.ibm.com>,\n Eric Farman <farman@linux.ibm.com>, Heiko Carstens <hca@linux.ibm.com>,\n Vasily Gorbik <gor@linux.ibm.com>, Alexander Gordeev\n <agordeev@linux.ibm.com>, Christian Borntraeger <borntraeger@linux.ibm.com>,\n Sven Schnelle <svens@linux.ibm.com>, Alexei Starovoitov <ast@kernel.org>,\n Daniel Borkmann <daniel@iogearbox.net>,\n Jesper Dangaard Brouer <hawk@kernel.org>,\n John Fastabend <john.fastabend@gmail.com>,\n Vincent Whitchurch <vincent.whitchurch@axis.com>,\n linux-um@lists.infradead.org, netdev@vger.kernel.org,\n platform-driver-x86@vger.kernel.org, linux-remoteproc@vger.kernel.org,\n linux-s390@vger.kernel.org, kvm@vger.kernel.org, bpf@vger.kernel.org,\n kangjie.xu@linux.alibaba.com","References":"<20220720030436.79520-1-xuanzhuo@linux.alibaba.com>\n <20220720030436.79520-3-xuanzhuo@linux.alibaba.com>","From":"Jason Wang <jasowang@redhat.com>","In-Reply-To":"<20220720030436.79520-3-xuanzhuo@linux.alibaba.com>","X-Mimecast-Spam-Score":"0","X-Mimecast-Originator":"redhat.com","Content-Language":"en-US","X-CRM114-Version":"20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 ","X-CRM114-CacheID":"sfid-20220720_203934_467477_B7201F9C ","X-CRM114-Status":"GOOD (  19.74  )","X-Spam-Score":"-1.6 (-)","X-Spam-Report":"=?unknown-8bit?q?Spam_detection_software=2C_running_on_the_sy?=\n\t=?unknown-8bit?q?stem_=22bombadil=2Einfradead=2Eorg=22=2C?=\n\t=?unknown-8bit?q?_has_NOT_identified_this_incoming_email_as_spam=2E__The_ori?=\n\t=?unknown-8bit?q?ginal?=\n\t=?unknown-8bit?q?_message_has_been_attached_to_this_so_you_can_view_it_or_la?=\n\t=?unknown-8bit?q?bel?=\n\t=?unknown-8bit?q?_similar_future_email=2E__If_you_have_any_questions=2C_see?=\n\t=?unknown-8bit?q?_the_administrator_of_that_system_for_details=2E?=\n\t=?unknown-8bit?q?_?=\n\t=?unknown-8bit?q?_Content_preview=3A__=E5=9C=A8_2022/7/20_11=3A03=2C_Xuan_Zh?=\n\t=?unknown-8bit?q?uo_=E5=86=99=E9=81=93=3A_=3E_reset_can_be_divided?=\n\t=?unknown-8bit?q?_into_the_following_four_steps_=28example=29=3A_=3E_1=2E_tr?=\n\t=?unknown-8bit?q?ansport=3A_notify_the_device?=\n\t=?unknown-8bit?q?_to_reset_the_queue_=3E_2=2E_vring=3A_recycle_the_buffer_su?=\n\t=?unknown-8bit?q?bmitted_=3E_3_=5B=2E=2E=2E=5D_?=\n\t=?unknown-8bit?q?_?=\n\t=?unknown-8bit?q?_Content_analysis_details=3A___=28-1=2E6_points=2C_5=2E0_re?=\n\t=?unknown-8bit?q?quired=29?=\n\t=?unknown-8bit?q?_?=\n\t=?unknown-8bit?q?_pts_rule_name______________description?=\n\t=?unknown-8bit?q?_----_----------------------_------------------------------?=\n\t=?unknown-8bit?q?--------------------?=\n\t=?unknown-8bit?q?_-0=2E7_RCVD=5FIN=5FDNSWL=5FLOW______RBL=3A_Sender_listed_a?=\n\t=?unknown-8bit?q?t_https=3A//www=2Ednswl=2Eorg/=2C?=\n\t=?unknown-8bit?q?_low_trust?=\n\t=?unknown-8bit?q?_=5B170=2E10=2E129=2E124_listed_in_list=2Ednswl=2Eorg=5D?=\n\t=?unknown-8bit?q?_0=2E0_SPF=5FHELO=5FNONE__________SPF=3A_HELO_does_not_publ?=\n\t=?unknown-8bit?q?ish_an_SPF_Record?=\n\t=?unknown-8bit?q?_0=2E0_SPF=5FNONE_______________SPF=3A_sender_does_not_publ?=\n\t=?unknown-8bit?q?ish_an_SPF_Record?=\n\t=?unknown-8bit?q?_-0=2E1_DKIM=5FVALID=5FAU__________Message_has_a_valid_DKIM?=\n\t=?unknown-8bit?q?_or_DK_signature_from?=\n\t=?unknown-8bit?q?_author=27s_domain?=\n\t=?unknown-8bit?q?_-0=2E1_DKIM=5FVALID_____________Message_has_at_least_one_v?=\n\t=?unknown-8bit?q?alid_DKIM_or_DK_signature?=\n\t=?unknown-8bit?q?_0=2E1_DKIM=5FSIGNED____________Message_has_a_DKIM_or_DK_si?=\n\t=?unknown-8bit?q?gnature=2C_not_necessarily?=\n\t=?unknown-8bit?q?_valid?=\n\t=?unknown-8bit?q?_-0=2E1_DKIM=5FVALID=5FEF__________Message_has_a_valid_DKIM?=\n\t=?unknown-8bit?q?_or_DK_signature_from?=\n\t=?unknown-8bit?q?_envelope-from_domain?=\n\t=?unknown-8bit?q?_-0=2E5_NICE=5FREPLY=5FA___________Looks_like_a_legit_reply?=\n\t=?unknown-8bit?q?_=28A=29?=\n\t=?unknown-8bit?q?_-0=2E2_DKIMWL=5FWL=5FHIGH_________DKIMwl=2Eorg_-_High_trus?=\n\t=?unknown-8bit?q?t_sender?=","X-BeenThere":"linux-um@lists.infradead.org","X-Mailman-Version":"2.1.34","Precedence":"list","List-Id":"<linux-um.lists.infradead.org>","List-Unsubscribe":"<http://lists.infradead.org/mailman/options/linux-um>,\n <mailto:linux-um-request@lists.infradead.org?subject=unsubscribe>","List-Archive":"<http://lists.infradead.org/pipermail/linux-um/>","List-Post":"<mailto:linux-um@lists.infradead.org>","List-Help":"<mailto:linux-um-request@lists.infradead.org?subject=help>","List-Subscribe":"<http://lists.infradead.org/mailman/listinfo/linux-um>,\n <mailto:linux-um-request@lists.infradead.org?subject=subscribe>","Content-Transfer-Encoding":"base64","Content-Type":"text/plain; charset=\"utf-8\"; Format=\"flowed\"","Sender":"\"linux-um\" <linux-um-bounces@lists.infradead.org>","Errors-To":"linux-um-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org"}}]