On Tue, Nov 12, 2024, Tom Lendacky wrote: > On 11/12/24 13:33, Dionna Amalie Glaze wrote: > >>> diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c > >>> index cea41b8cdabe4..d7cef84750b33 100644 > >>> --- a/arch/x86/kvm/svm/sev.c > >>> +++ b/arch/x86/kvm/svm/sev.c > >>> @@ -89,7 +89,7 @@ static unsigned int nr_asids; > >>> static unsigned long *sev_asid_bitmap; > >>> static unsigned long *sev_reclaim_asid_bitmap; > >>> > >>> -static int snp_decommission_context(struct kvm *kvm); > >>> +static int kvm_decommission_snp_context(struct kvm *kvm); > >> > >> Why the name change? It seems like it just makes the patch a bit harder > >> to follow since there are two things going on. > >> > > > > KVM and ccp both seem to like to name their functions starting with > > sev_ or snp_, and it's particularly hard to determine provenance. > > > > snp_decommision_context and sev_snp_guest_decommission... which is > > from where? It's weird to me. > > I guess I don't see the problem, a quick git grep -w of the name will > show you where each is. Its a static function in the file, so if > anything just changing/shortening the name to decommission_snp_context() Eh, that creates just as many problems as it solves, because it mucks up the namespace and leads to discontinuity between the decommission helper and things like snp_launch_update_vmsa() and snp_launch_finish(). I agree that there isn't a strong need to fixup static symbols. That said, I do think drivers/crypto/ccp/sev-dev.c in particular needs a different namespace, and needs to use it consistently, to make it somewhat obvious that it's (almost) all about the PSP/ASP. But IMO, an even bigger mess in that area is the lack of consistency in the APIs themselves. E.g. this code where KVM uses sev_do_cmd() directly for SNP, but bounces through a wrapper for !SNP. Eww. wbinvd_on_all_cpus(); if (sev_snp_enabled) ret = sev_do_cmd(SEV_CMD_SNP_DF_FLUSH, NULL, &error); else ret = sev_guest_df_flush(&error); up_write(&sev_deactivate_lock); And then KVM has snp_page_reclaim(), but the PSP/ASP driver has snp_reclaim_pages(). So if we want to start renaming things, I vote to go a step further and clean up the APIs, e.g. with a goal of eliminating sev_do_cmd(), and possibly of making the majority of the PSP-defined structures in include/linux/psp-sev.h "private" to the PSP/ASP driver. > would be better (especially since nothing in the svm directory should > have a name that starts with kvm_). +1 to not using "kvm_". KVM often uses "kvm_" to differentiate globally visible symbols from local (static) symbols. I.e. prepending "kvm_" just trades one confusing name for another.