From: Sean Christopherson <seanjc@google.com>
To: Melody Wang <huibo.wang@amd.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>, KVM <kvm@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
Tom Lendacky <thomas.lendacky@amd.com>,
Paluri PavanKumar <pavankumar.paluri@amd.com>
Subject: Re: [PATCH v5 2/2] KVM: SVM: Provide helpers to set the error code
Date: Tue, 25 Feb 2025 14:32:53 -0800 [thread overview]
Message-ID: <Z75FFZqPLyJgt-4g@google.com> (raw)
In-Reply-To: <20250225213937.2471419-3-huibo.wang@amd.com>
On Tue, Feb 25, 2025, Melody Wang wrote:
> @@ -3675,8 +3673,13 @@ static void snp_complete_psc(struct vcpu_svm *svm, u64 psc_ret)
> svm->sev_es.psc_inflight = 0;
> svm->sev_es.psc_idx = 0;
> svm->sev_es.psc_2m = false;
> - ghcb_set_sw_exit_info_2(svm->sev_es.ghcb, psc_ret);
> -}
> +
> + /*
> + * A value of zero in SW_EXITINFO1 does not guarantee that all operations have
"A value of zero" is largely redundant, and somewhat confusing. There's no '0'
in the below code, so to understand the comment, the reader needs to know that
"no action" is a response code of '0' (and is communicated in SW_EXITINFO1,
though that's much less of a problem).
> + * completed or completed successfully. PSC requests always get a "no action"
> + * response in SW_EXITINFO1, with a PSC-specific return code in SW_EXITINFO2.
Please wrap at ~80. Yes, it's a "soft limit", but preferred KVM style is to
wrap at 80 unless running long makes the code more readable. For a multi-line
comment, I don't see any reason to wrap in the mid-80s.
This is what I ended up with
/*
* PSC requests always get a "no action" response in SW_EXITINFO1, with
* a PSC-specific return code in SW_EXITINFO2 that provides the "real"
* return code. E.g. if the PSC request was interrupted, the need to
* retry is communicated via SW_EXITINFO2, not SW_EXITINFO1.
*/
> + */
> + svm_vmgexit_no_action(svm, psc_ret); }
Malformed change to the closing curly brace.
> case SVM_VMGEXIT_HV_FEATURES:
> - ghcb_set_sw_exit_info_2(svm->sev_es.ghcb, GHCB_HV_FT_SUPPORTED);
> + /* Get hypervisor supported features */
This doesn't add any value. If the logic isn't clear, then GHCB_HV_FT_SUPPORTED
needs to be renamed.
> + svm_vmgexit_success(svm, GHCB_HV_FT_SUPPORTED);
>
> ret = 1;
> break;
next prev parent reply other threads:[~2025-02-25 22:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-25 21:39 [PATCH v5 0/2] KVM: SVM: Make VMGEXIT GHCB exit codes more readable Melody Wang
2025-02-25 21:39 ` [PATCH v5 1/2] KVM: SVM: Convert plain error code numbers to defines Melody Wang
2025-02-25 22:28 ` Sean Christopherson
2025-02-25 21:39 ` [PATCH v5 2/2] KVM: SVM: Provide helpers to set the error code Melody Wang
2025-02-25 22:32 ` Sean Christopherson [this message]
2025-02-25 22:39 ` [PATCH v5 0/2] KVM: SVM: Make VMGEXIT GHCB exit codes more readable Sean Christopherson
2025-02-28 17:06 ` Sean Christopherson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Z75FFZqPLyJgt-4g@google.com \
--to=seanjc@google.com \
--cc=huibo.wang@amd.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pavankumar.paluri@amd.com \
--cc=pbonzini@redhat.com \
--cc=thomas.lendacky@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox