public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM: selftests: Fix build of rseq test
@ 2023-01-06 19:24 Mark Brown
  2023-01-18 13:37 ` Mark Brown
  0 siblings, 1 reply; 5+ messages in thread
From: Mark Brown @ 2023-01-06 19:24 UTC (permalink / raw)
  To: Mathieu Desnoyers, Paolo Bonzini, Shuah Khan, Peter Zijlstra
  Cc: Oliver Upton, kvm, linux-kselftest, Mark Brown

The KVM rseq test is failing to build in -next due to a commit merged
from the tip tree which adds a wrapper for sys_getcpu() to the rseq
kselftests, conflicting with the wrapper already included in the KVM
selftest:

rseq_test.c:48:13: error: conflicting types for 'sys_getcpu'
   48 | static void sys_getcpu(unsigned *cpu)
          |             ^~~~~~~~~~
In file included from rseq_test.c:23:
../rseq/rseq.c:82:12: note: previous definition of 'sys_getcpu' was here
   82 | static int sys_getcpu(unsigned *cpu, unsigned *node)
          |            ^~~~~~~~~~

Fix this by removing the local wrapper and moving the result check up to
the caller.

Fixes: 99babd04b250 ("selftests/rseq: Implement rseq numa node id field selftest")
Signed-off-by: Mark Brown <broonie@kernel.org>
---
This will need to go via the tip tree due to the breaking change being
there.
---
 tools/testing/selftests/kvm/rseq_test.c | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)

diff --git a/tools/testing/selftests/kvm/rseq_test.c b/tools/testing/selftests/kvm/rseq_test.c
index 3045fdf9bdf5..f74e76d03b7e 100644
--- a/tools/testing/selftests/kvm/rseq_test.c
+++ b/tools/testing/selftests/kvm/rseq_test.c
@@ -41,18 +41,6 @@ static void guest_code(void)
 		GUEST_SYNC(0);
 }
 
-/*
- * We have to perform direct system call for getcpu() because it's
- * not available until glic 2.29.
- */
-static void sys_getcpu(unsigned *cpu)
-{
-	int r;
-
-	r = syscall(__NR_getcpu, cpu, NULL, NULL);
-	TEST_ASSERT(!r, "getcpu failed, errno = %d (%s)", errno, strerror(errno));
-}
-
 static int next_cpu(int cpu)
 {
 	/*
@@ -249,7 +237,9 @@ int main(int argc, char *argv[])
 			 * across the seq_cnt reads.
 			 */
 			smp_rmb();
-			sys_getcpu(&cpu);
+			r = sys_getcpu(&cpu, NULL);
+			TEST_ASSERT(!r, "getcpu failed, errno = %d (%s)",
+				    errno, strerror(errno));
 			rseq_cpu = rseq_current_cpu_raw();
 			smp_rmb();
 		} while (snapshot != atomic_read(&seq_cnt));

---
base-commit: 469a89fd3bb73bb2eea628da2b3e0f695f80b7ce
change-id: 20230106-fix-kvm-rseq-build-41ac58ba1d27

Best regards,
-- 
Mark Brown <broonie@kernel.org>

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

* Re: [PATCH] KVM: selftests: Fix build of rseq test
  2023-01-06 19:24 [PATCH] KVM: selftests: Fix build of rseq test Mark Brown
@ 2023-01-18 13:37 ` Mark Brown
  2023-01-18 14:30   ` Mathieu Desnoyers
  0 siblings, 1 reply; 5+ messages in thread
From: Mark Brown @ 2023-01-18 13:37 UTC (permalink / raw)
  To: Mathieu Desnoyers, Paolo Bonzini, Shuah Khan, Peter Zijlstra
  Cc: Oliver Upton, kvm, linux-kselftest

[-- Attachment #1: Type: text/plain, Size: 827 bytes --]

On Fri, Jan 06, 2023 at 07:24:19PM +0000, Mark Brown wrote:

> The KVM rseq test is failing to build in -next due to a commit merged
> from the tip tree which adds a wrapper for sys_getcpu() to the rseq
> kselftests, conflicting with the wrapper already included in the KVM
> selftest:

Any thoughts on this?  The KVM tests are still failing to build
in -next:

rseq_test.c:48:13: error: conflicting types for ‘sys_getcpu’
   48 | static void sys_getcpu(unsigned *cpu)
      |             ^~~~~~~~~~
In file included from rseq_test.c:23:
../rseq/rseq.c:82:12: note: previous definition of ‘sys_getcpu’ was here
   82 | static int sys_getcpu(unsigned *cpu, unsigned *node)
      |            ^~~~~~~~~~

https://storage.kernelci.org/next/master/next-20230118/arm64/defconfig/gcc-10/logs/kselftest.log

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH] KVM: selftests: Fix build of rseq test
  2023-01-18 13:37 ` Mark Brown
@ 2023-01-18 14:30   ` Mathieu Desnoyers
  2023-01-18 14:44     ` Mark Brown
  0 siblings, 1 reply; 5+ messages in thread
From: Mathieu Desnoyers @ 2023-01-18 14:30 UTC (permalink / raw)
  To: Mark Brown, Paolo Bonzini, Shuah Khan, Peter Zijlstra
  Cc: Oliver Upton, kvm, linux-kselftest

On 2023-01-18 08:37, Mark Brown wrote:
> On Fri, Jan 06, 2023 at 07:24:19PM +0000, Mark Brown wrote:
> 
>> The KVM rseq test is failing to build in -next due to a commit merged
>> from the tip tree which adds a wrapper for sys_getcpu() to the rseq
>> kselftests, conflicting with the wrapper already included in the KVM
>> selftest:
> 
> Any thoughts on this?  The KVM tests are still failing to build
> in -next:

I'm OK with the fix you submitted in this email thread. Should it be 
routed through -tip ?

Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>

Thanks,

Mathieu

> 
> rseq_test.c:48:13: error: conflicting types for ‘sys_getcpu’
>     48 | static void sys_getcpu(unsigned *cpu)
>        |             ^~~~~~~~~~
> In file included from rseq_test.c:23:
> ../rseq/rseq.c:82:12: note: previous definition of ‘sys_getcpu’ was here
>     82 | static int sys_getcpu(unsigned *cpu, unsigned *node)
>        |            ^~~~~~~~~~
> 
> https://storage.kernelci.org/next/master/next-20230118/arm64/defconfig/gcc-10/logs/kselftest.log

-- 
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com


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

* Re: [PATCH] KVM: selftests: Fix build of rseq test
  2023-01-18 14:30   ` Mathieu Desnoyers
@ 2023-01-18 14:44     ` Mark Brown
  2023-01-18 14:46       ` Mathieu Desnoyers
  0 siblings, 1 reply; 5+ messages in thread
From: Mark Brown @ 2023-01-18 14:44 UTC (permalink / raw)
  To: Mathieu Desnoyers
  Cc: Paolo Bonzini, Shuah Khan, Peter Zijlstra, Oliver Upton, kvm,
	linux-kselftest

[-- Attachment #1: Type: text/plain, Size: 750 bytes --]

On Wed, Jan 18, 2023 at 09:30:01AM -0500, Mathieu Desnoyers wrote:
> On 2023-01-18 08:37, Mark Brown wrote:
> > On Fri, Jan 06, 2023 at 07:24:19PM +0000, Mark Brown wrote:

> > > The KVM rseq test is failing to build in -next due to a commit merged
> > > from the tip tree which adds a wrapper for sys_getcpu() to the rseq
> > > kselftests, conflicting with the wrapper already included in the KVM
> > > selftest:

> > Any thoughts on this?  The KVM tests are still failing to build
> > in -next:

> I'm OK with the fix you submitted in this email thread. Should it be routed
> through -tip ?

I think so, it'll need to go along with the patch that introduced
the new wrapper.

> Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>

Thanks.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH] KVM: selftests: Fix build of rseq test
  2023-01-18 14:44     ` Mark Brown
@ 2023-01-18 14:46       ` Mathieu Desnoyers
  0 siblings, 0 replies; 5+ messages in thread
From: Mathieu Desnoyers @ 2023-01-18 14:46 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: Paolo Bonzini, Shuah Khan, Oliver Upton, kvm, linux-kselftest,
	Mark Brown

On 2023-01-18 09:44, Mark Brown wrote:
> On Wed, Jan 18, 2023 at 09:30:01AM -0500, Mathieu Desnoyers wrote:
>> On 2023-01-18 08:37, Mark Brown wrote:
>>> On Fri, Jan 06, 2023 at 07:24:19PM +0000, Mark Brown wrote:
> 
>>>> The KVM rseq test is failing to build in -next due to a commit merged
>>>> from the tip tree which adds a wrapper for sys_getcpu() to the rseq
>>>> kselftests, conflicting with the wrapper already included in the KVM
>>>> selftest:
> 
>>> Any thoughts on this?  The KVM tests are still failing to build
>>> in -next:
> 
>> I'm OK with the fix you submitted in this email thread. Should it be routed
>> through -tip ?
> 
> I think so, it'll need to go along with the patch that introduced
> the new wrapper.
> 
>> Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>

Peter, can you pick up this patch through tip ?

https://lore.kernel.org/r/20230106-fix-kvm-rseq-build-v1-1-b704d9831d02@kernel.org

Thanks,

Mathieu

> 
> Thanks.

-- 
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com


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

end of thread, other threads:[~2023-01-18 14:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-06 19:24 [PATCH] KVM: selftests: Fix build of rseq test Mark Brown
2023-01-18 13:37 ` Mark Brown
2023-01-18 14:30   ` Mathieu Desnoyers
2023-01-18 14:44     ` Mark Brown
2023-01-18 14:46       ` Mathieu Desnoyers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox