Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp2518871rdb; Fri, 22 Sep 2023 00:26:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFG3rf1rVnCXT1aLbHPoI3FRfaPokcvSnZ1RK4DkWMIihk7UfeRb/htb9hsF2dtUaFOwjST X-Received: by 2002:a05:6358:94a4:b0:133:291:f9ac with SMTP id i36-20020a05635894a400b001330291f9acmr9718540rwb.25.1695367598713; Fri, 22 Sep 2023 00:26:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695367598; cv=none; d=google.com; s=arc-20160816; b=zuB27MRo1iL6GH2Cqk289zwC9ABvyZOg0qOt9PrHwzSzL30KQVC71zygmvK+hdrjM+ irnUJd01VbxgLkNlHAWIkpStgt9CgGYrPWY26o7tROjJMNoRUIDKmhqRvMWlixmzDXIT CjX/OcSm9JxtV8V8yzaZwGaBSgAiEaaTJcz3pQcxEoyq0/DrQuSLHfQB9K3SBSLgQng0 bdmzQuqNCC1eKHlEjo4NVNRHZ46k6XfVh1ei2EFaR52EWZPwOLuvFJcOxULois1cjMKn m1dCsMCO+iUVv/+vuKm2Pucwvd4kTDUDE3HtJTlyFOCv8AScJrxt7rC7lyUA3mZt79S4 4hag== 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=VKRFydK7gHJIGc1An0jO34UIyrf6X6QxSb8Wda3PFS4=; fh=Sh9g0dzUTBds0Cqus2Jhva0Lkats/uQslinXHKEv8bQ=; b=N+DHRmouOjmYSV94E+LtRvLuUuTPL6FY1fIx/gbbB8UWQQoRg4nLbxF1yY6Z3AJbUQ JoNfPKsRv6kYnDh4qC04cJJHTaVnnwOytjkLGM6o6MGNGqmxQpDDjANwnb3St0Qs617A BnOy9Jt5U95M30qtlkaVWWyvdF+Nhd955fcyFXl3sDAx//kVBmiv8v3ZGtlCiaPWj6YO kQtL+WHrpKwbTvZ0PG6+OimytbLgU8Ai9VIu//FnCkcaa+X3vMbLjG2cWJTv8hQRj95j zIc7qkEsr/7KxkqYyhwEldXDdaHtFDeEfBTqXUhmrnpwXZnVs45TbtmX3mwdzf3M73ta V3YA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=SLqm9b9J; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id eb17-20020a056a004c9100b00690158afc78si3220404pfb.284.2023.09.22.00.26.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 00:26:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=SLqm9b9J; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 8D8AD821A14A; Thu, 21 Sep 2023 20:18:46 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229536AbjIVDSp (ORCPT + 99 others); Thu, 21 Sep 2023 23:18:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229476AbjIVDSo (ORCPT ); Thu, 21 Sep 2023 23:18:44 -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 DC2D7194 for ; Thu, 21 Sep 2023 20:17:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695352671; 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=VKRFydK7gHJIGc1An0jO34UIyrf6X6QxSb8Wda3PFS4=; b=SLqm9b9JeLb5cLUaGKGSDCESjE/sQwdFHMzBCIpS8m6nJaiWBvWuLRunn6sTtQdi2z44sj QRi+tB/VnZXVQcQg1ERfJ822Qf+/7YWeaYIV/XmiyA9IVDklpdTgOdJvKK7PB9VWPCLYMG puz2Ua6xnfVnpPDxLDrqqHyD3nqXE+g= 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-176-_fUxX7PSPvmFtnrBEJN2fQ-1; Thu, 21 Sep 2023 23:17:49 -0400 X-MC-Unique: _fUxX7PSPvmFtnrBEJN2fQ-1 Received: by mail-lj1-f199.google.com with SMTP id 38308e7fff4ca-2c131ddfeb4so15175651fa.0 for ; Thu, 21 Sep 2023 20:17:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695352668; x=1695957468; 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=VKRFydK7gHJIGc1An0jO34UIyrf6X6QxSb8Wda3PFS4=; b=VzYe9eyMh3Spk/p9Z75dF4zOvpprm+//BqhEqSdewx4Ma3XmtD21M7sguTaJuZ6M/W Iw/+A5R3XFi4h7JyTg8CsehIL37FfbVaC9G0fPDSaFO+MUEgoWf8rNIankvoWY1AuaaM iOtMwVbEGwJOuiIiIYxHYtlqJOu9387Bo57VguGOvp3KvmS8ORZ8FjUNAqOhSEtXDn0+ nTFaj8Z9Oei3XG6AzQAgB9ruICyWJvc5pAbg3W8iWVZxBxqUvCyJBdsSCYJVH1wEMaTX 6r2oOJhJcJdxP8ReOrHn59wW0LkP09b7heMqdJRObuZr9mfpjeGyLXh2vQ1Nun7skZJD 5LFA== X-Gm-Message-State: AOJu0YyFPB+7e+Zh2hwW4M2aiyiRSq5s3gHjrXqp/dyqlEj/QnjX0axo qehRr13w0/KmUHMG1G19ow6Mh4k6lXkJSrqYdwAeslwKggGm5747dK9pdWfpDyAq/eSS0v0WCKB ibuvROKxuMu4Q07lYubP2q48QNJWOGFF5+AvPbhv4x9c3LMdncpw= X-Received: by 2002:a05:6512:b21:b0:503:3278:3221 with SMTP id w33-20020a0565120b2100b0050332783221mr7377463lfu.69.1695352667963; Thu, 21 Sep 2023 20:17:47 -0700 (PDT) X-Received: by 2002:a05:6512:b21:b0:503:3278:3221 with SMTP id w33-20020a0565120b2100b0050332783221mr7377433lfu.69.1695352667519; Thu, 21 Sep 2023 20:17:47 -0700 (PDT) MIME-Version: 1.0 References: <20230919114242.2283646-1-Jiqian.Chen@amd.com> <20230919114242.2283646-2-Jiqian.Chen@amd.com> In-Reply-To: From: Jason Wang Date: Fri, 22 Sep 2023 11:17:35 +0800 Message-ID: Subject: Re: [virtio-dev] Re: [VIRTIO PCI PATCH v5 1/1] transport-pci: Add freeze_mode to virtio_pci_common_cfg To: "Chen, Jiqian" Cc: Gerd Hoffmann , "Michael S . Tsirkin" , Xuan Zhuo , David Airlie , Gurchetan Singh , Chia-I Wu , =?UTF-8?B?TWFyYy1BbmRyw6kgTHVyZWF1?= , Robert Beckett , Mikhail Golubev-Ciuchea , Parav Pandit , "virtio-comment@lists.oasis-open.org" , "virtio-dev@lists.oasis-open.org" , "qemu-devel@nongnu.org" , "linux-kernel@vger.kernel.org" , Stefano Stabellini , =?UTF-8?Q?Roger_Pau_Monn=C3=A9?= , "Deucher, Alexander" , "Koenig, Christian" , "Hildebrand, Stewart" , Xenia Ragiadakou , "Huang, Honglei1" , "Zhang, Julia" , "Huang, Ray" 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_BLOCKED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_NONE,URIBL_BLOCKED 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 21 Sep 2023 20:18:46 -0700 (PDT) On Thu, Sep 21, 2023 at 2:28=E2=80=AFPM Chen, Jiqian = wrote: > > Hi Jason, > > On 2023/9/21 12:22, Jason Wang wrote: > > On Tue, Sep 19, 2023 at 7:43=E2=80=AFPM Jiqian Chen wrote: > >> > >> When guest vm does S3, Qemu will reset and clear some things of virtio > >> devices, but guest can't aware that, so that may cause some problems. > >> For excample, Qemu calls virtio_reset->virtio_gpu_gl_reset when guest > >> resume, that function will destroy render resources of virtio-gpu. As > >> a result, after guest resume, the display can't come back and we only > >> saw a black screen. Due to guest can't re-create all the resources, so > >> we need to let Qemu not to destroy them when S3. > >> > >> For above purpose, we need a mechanism that allows guests and QEMU to > >> negotiate their reset behavior. So this patch add a new parameter > >> named freeze_mode to struct virtio_pci_common_cfg. And when guest > >> suspends, it can write freeze_mode to be FREEZE_S3, and then virtio > >> devices can change their reset behavior on Qemu side according to > >> freeze_mode. What's more, freeze_mode can be used for all virtio > >> devices to affect the behavior of Qemu, not just virtio gpu device. > > > > A simple question, why is this issue specific to pci? > I thought you possibly missed the previous version patches. At the beginn= ing, I just wanted to add a new feature flag VIRTIO_GPU_F_FREEZE_S3 for vir= tio-gpu since I encountered virtio-gpu issue during guest S3, so that the g= uest and qemu can negotiate and change the reset behavior during S3. But Pa= rav and Mikhail hoped me can improve the feature to a pci level, then other= virtio devices can also benefit from it. Although I am not sure if expandi= ng its influence is appropriate, I have not received any feedback from othe= rs, so I change it to the pci level and made this version. > If you are interested, please see the previous version: https://lists.oas= is-open.org/archives/virtio-comment/202307/msg00209.html, thank you. This is not a good answer. Let me ask you differently, why don't you see it in other forms of transport like virtio-gpu-mmio? Thanks > > > > > Thanks > > > > > >> > >> Signed-off-by: Jiqian Chen > >> --- > >> transport-pci.tex | 7 +++++++ > >> 1 file changed, 7 insertions(+) > >> > >> diff --git a/transport-pci.tex b/transport-pci.tex > >> index a5c6719..2543536 100644 > >> --- a/transport-pci.tex > >> +++ b/transport-pci.tex > >> @@ -319,6 +319,7 @@ \subsubsection{Common configuration structure layo= ut}\label{sec:Virtio Transport > >> le64 queue_desc; /* read-write */ > >> le64 queue_driver; /* read-write */ > >> le64 queue_device; /* read-write */ > >> + le16 freeze_mode; /* read-write */ > >> le16 queue_notif_config_data; /* read-only for driver */ > >> le16 queue_reset; /* read-write */ > >> > >> @@ -393,6 +394,12 @@ \subsubsection{Common configuration structure lay= out}\label{sec:Virtio Transport > >> \item[\field{queue_device}] > >> The driver writes the physical address of Device Area here. = See section \ref{sec:Basic Facilities of a Virtio Device / Virtqueues}. > >> > >> +\item[\field{freeze_mode}] > >> + The driver writes this to set the freeze mode of virtio pci. > >> + VIRTIO_PCI_FREEZE_MODE_UNFREEZE - virtio-pci is running; > >> + VIRTIO_PCI_FREEZE_MODE_FREEZE_S3 - guest vm is doing S3, and = virtio-pci enters S3 suspension; > >> + Other values are reserved for future use, like S4, etc. > >> + > >> \item[\field{queue_notif_config_data}] > >> This field exists only if VIRTIO_F_NOTIF_CONFIG_DATA has been= negotiated. > >> The driver will use this value when driver sends available bu= ffer > >> -- > >> 2.34.1 > >> > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: virtio-dev-unsubscribe@lists.oasis-open.org > > For additional commands, e-mail: virtio-dev-help@lists.oasis-open.org > > > > -- > Best regards, > Jiqian Chen.