All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM: selftests: Clean up misnomers in xen_shinfo_test
@ 2023-02-06 20:24 Michal Luczaj
  2023-02-08  2:07 ` Sean Christopherson
  0 siblings, 1 reply; 3+ messages in thread
From: Michal Luczaj @ 2023-02-06 20:24 UTC (permalink / raw)
  To: kvm; +Cc: pbonzini, shuah, seanjc, dwmw, Michal Luczaj

As discussed[*], relabel the poorly named structs to align with the
current KVM nomenclature.

Old names are a leftover from before commit 52491a38b2c2 ("KVM:
Initialize gfn_to_pfn_cache locks in dedicated helper"), which i.a.
introduced kvm_gpc_init() and renamed kvm_gfn_to_pfn_cache_init()/
_destroy() to kvm_gpc_activate()/_deactivate(). Partly in an effort
to avoid implying that the cache really is destroyed/freed.

While at it, get rid of #define GPA_INVALID, which being used as a GFN,
is not only misnamed, but also unnecessarily reinvents a UAPI constant.

No functional change intended.

[*] https://lore.kernel.org/r/Y5yZ6CFkEMBqyJ6v@google.com

Signed-off-by: Michal Luczaj <mhal@rbox.co>
---
 .../testing/selftests/kvm/x86_64/xen_shinfo_test.c  | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/tools/testing/selftests/kvm/x86_64/xen_shinfo_test.c b/tools/testing/selftests/kvm/x86_64/xen_shinfo_test.c
index 6a838df69174..fd39a15d6970 100644
--- a/tools/testing/selftests/kvm/x86_64/xen_shinfo_test.c
+++ b/tools/testing/selftests/kvm/x86_64/xen_shinfo_test.c
@@ -19,9 +19,6 @@
 
 #include <sys/eventfd.h>
 
-/* Defined in include/linux/kvm_types.h */
-#define GPA_INVALID		(~(ulong)0)
-
 #define SHINFO_REGION_GVA	0xc0000000ULL
 #define SHINFO_REGION_GPA	0xc0000000ULL
 #define SHINFO_REGION_SLOT	10
@@ -412,19 +409,19 @@ static void *juggle_shinfo_state(void *arg)
 {
 	struct kvm_vm *vm = (struct kvm_vm *)arg;
 
-	struct kvm_xen_hvm_attr cache_init = {
+	struct kvm_xen_hvm_attr cache_activate = {
 		.type = KVM_XEN_ATTR_TYPE_SHARED_INFO,
 		.u.shared_info.gfn = SHINFO_REGION_GPA / PAGE_SIZE
 	};
 
-	struct kvm_xen_hvm_attr cache_destroy = {
+	struct kvm_xen_hvm_attr cache_deactivate = {
 		.type = KVM_XEN_ATTR_TYPE_SHARED_INFO,
-		.u.shared_info.gfn = GPA_INVALID
+		.u.shared_info.gfn = KVM_XEN_INVALID_GFN
 	};
 
 	for (;;) {
-		__vm_ioctl(vm, KVM_XEN_HVM_SET_ATTR, &cache_init);
-		__vm_ioctl(vm, KVM_XEN_HVM_SET_ATTR, &cache_destroy);
+		__vm_ioctl(vm, KVM_XEN_HVM_SET_ATTR, &cache_activate);
+		__vm_ioctl(vm, KVM_XEN_HVM_SET_ATTR, &cache_deactivate);
 		pthread_testcancel();
 	}
 
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] KVM: selftests: Clean up misnomers in xen_shinfo_test
  2023-02-06 20:24 [PATCH] KVM: selftests: Clean up misnomers in xen_shinfo_test Michal Luczaj
@ 2023-02-08  2:07 ` Sean Christopherson
  2023-02-08 14:46   ` Sean Christopherson
  0 siblings, 1 reply; 3+ messages in thread
From: Sean Christopherson @ 2023-02-08  2:07 UTC (permalink / raw)
  To: Sean Christopherson, kvm, Michal Luczaj; +Cc: pbonzini, shuah, dwmw

On Mon, 06 Feb 2023 21:24:30 +0100, Michal Luczaj wrote:
> As discussed[*], relabel the poorly named structs to align with the
> current KVM nomenclature.
> 
> Old names are a leftover from before commit 52491a38b2c2 ("KVM:
> Initialize gfn_to_pfn_cache locks in dedicated helper"), which i.a.
> introduced kvm_gpc_init() and renamed kvm_gfn_to_pfn_cache_init()/
> _destroy() to kvm_gpc_activate()/_deactivate(). Partly in an effort
> to avoid implying that the cache really is destroyed/freed.
> 
> [...]

Applied to kvm-x86 selftests, thanks!

[1/1] KVM: selftests: Clean up misnomers in xen_shinfo_test
      https://github.com/kvm-x86/linux/commit/5c483f92ea7c

--
https://github.com/kvm-x86/linux/tree/next
https://github.com/kvm-x86/linux/tree/fixes

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] KVM: selftests: Clean up misnomers in xen_shinfo_test
  2023-02-08  2:07 ` Sean Christopherson
@ 2023-02-08 14:46   ` Sean Christopherson
  0 siblings, 0 replies; 3+ messages in thread
From: Sean Christopherson @ 2023-02-08 14:46 UTC (permalink / raw)
  To: kvm, Michal Luczaj; +Cc: pbonzini, shuah, dwmw

On Wed, Feb 08, 2023, Sean Christopherson wrote:
> On Mon, 06 Feb 2023 21:24:30 +0100, Michal Luczaj wrote:
> > As discussed[*], relabel the poorly named structs to align with the
> > current KVM nomenclature.
> > 
> > Old names are a leftover from before commit 52491a38b2c2 ("KVM:
> > Initialize gfn_to_pfn_cache locks in dedicated helper"), which i.a.
> > introduced kvm_gpc_init() and renamed kvm_gfn_to_pfn_cache_init()/
> > _destroy() to kvm_gpc_activate()/_deactivate(). Partly in an effort
> > to avoid implying that the cache really is destroyed/freed.
> > 
> > [...]
> 
> Applied to kvm-x86 selftests, thanks!
> 
> [1/1] KVM: selftests: Clean up misnomers in xen_shinfo_test
>       https://github.com/kvm-x86/linux/commit/5c483f92ea7c

I force pushed to selftests because of a goof on my end, new SHA-1 is:

  https://github.com/kvm-x86/linux/commit/6c77ae716d54

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-02-08 14:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-06 20:24 [PATCH] KVM: selftests: Clean up misnomers in xen_shinfo_test Michal Luczaj
2023-02-08  2:07 ` Sean Christopherson
2023-02-08 14:46   ` Sean Christopherson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.