linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] virtio-ringtest: more enablement
@ 2016-09-19 15:06 Cornelia Huck
  2016-09-19 15:06 ` [PATCH 1/2] tools/virtio/ringtest: fix run-on-all.sh for offline cpus Cornelia Huck
  2016-09-19 15:06 ` [PATCH 2/2] tools/virtio/ringtest: tweaks for s390 Cornelia Huck
  0 siblings, 2 replies; 3+ messages in thread
From: Cornelia Huck @ 2016-09-19 15:06 UTC (permalink / raw)
  To: mst; +Cc: pasic, virtualization, linux-kernel, Cornelia Huck

Hi Michael,

here are two patches by Halil so that we can get ringtest going on
our platform as well.

Question: Do you have an idea on how realistic the timings are
supposed to be? The s390 path is, well, 'tweak me'...

Halil Pasic (2):
  tools/virtio/ringtest: fix run-on-all.sh for offline cpus
  tools/virtio/ringtest: tweaks for s390

 tools/virtio/ringtest/main.h        | 12 ++++++++++++
 tools/virtio/ringtest/run-on-all.sh |  5 +++--
 2 files changed, 15 insertions(+), 2 deletions(-)

-- 
2.8.4

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

* [PATCH 1/2] tools/virtio/ringtest: fix run-on-all.sh for offline cpus
  2016-09-19 15:06 [PATCH 0/2] virtio-ringtest: more enablement Cornelia Huck
@ 2016-09-19 15:06 ` Cornelia Huck
  2016-09-19 15:06 ` [PATCH 2/2] tools/virtio/ringtest: tweaks for s390 Cornelia Huck
  1 sibling, 0 replies; 3+ messages in thread
From: Cornelia Huck @ 2016-09-19 15:06 UTC (permalink / raw)
  To: mst; +Cc: pasic, virtualization, linux-kernel, Cornelia Huck

From: Halil Pasic <pasic@linux.vnet.ibm.com>

Since ef1b144d ("tools/virtio/ringtest: fix run-on-all.sh to work
without /dev/cpu") run-on-all.sh uses seq 0 $HOST_AFFINITY as the list
of ids of the CPUs to run the command on (assuming ids of online CPUs
are consecutive and start from 0), where $HOST_AFFINITY is the highest
CPU id in the system previously determined using lscpu.  This can fail
on systems with offline CPUs.

Instead let's use lscpu to determine the list of online CPUs.

Signed-off-by: Halil Pasic <pasic@linux.vnet.ibm.com>
Fixes: ef1b144d ("tools/virtio/ringtest: fix run-on-all.sh to work without
/dev/cpu")
Reviewed-by: Sascha Silbe <silbe@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
---
 tools/virtio/ringtest/run-on-all.sh | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/virtio/ringtest/run-on-all.sh b/tools/virtio/ringtest/run-on-all.sh
index 2e69ca8..29b0d39 100755
--- a/tools/virtio/ringtest/run-on-all.sh
+++ b/tools/virtio/ringtest/run-on-all.sh
@@ -1,12 +1,13 @@
 #!/bin/sh
 
+CPUS_ONLINE=$(lscpu --online -p=cpu|grep -v -e '#')
 #use last CPU for host. Why not the first?
 #many devices tend to use cpu0 by default so
 #it tends to be busier
-HOST_AFFINITY=$(lscpu -p=cpu | tail -1)
+HOST_AFFINITY=$(echo "${CPUS_ONLINE}"|tail -n 1)
 
 #run command on all cpus
-for cpu in $(seq 0 $HOST_AFFINITY)
+for cpu in $CPUS_ONLINE
 do
 	#Don't run guest and host on same CPU
 	#It actually works ok if using signalling
-- 
2.8.4

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

* [PATCH 2/2] tools/virtio/ringtest: tweaks for s390
  2016-09-19 15:06 [PATCH 0/2] virtio-ringtest: more enablement Cornelia Huck
  2016-09-19 15:06 ` [PATCH 1/2] tools/virtio/ringtest: fix run-on-all.sh for offline cpus Cornelia Huck
@ 2016-09-19 15:06 ` Cornelia Huck
  1 sibling, 0 replies; 3+ messages in thread
From: Cornelia Huck @ 2016-09-19 15:06 UTC (permalink / raw)
  To: mst; +Cc: pasic, virtualization, linux-kernel, Cornelia Huck

From: Halil Pasic <pasic@linux.vnet.ibm.com>

Make ringtest work on s390 too.

Signed-off-by: Halil Pasic <pasic@linux.vnet.ibm.com>
Acked-by: Sascha Silbe <silbe@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
---
 tools/virtio/ringtest/main.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/tools/virtio/ringtest/main.h b/tools/virtio/ringtest/main.h
index 16917ac..7806b7b 100644
--- a/tools/virtio/ringtest/main.h
+++ b/tools/virtio/ringtest/main.h
@@ -26,6 +26,16 @@ static inline void wait_cycles(unsigned long long cycles)
 #define VMEXIT_CYCLES 500
 #define VMENTRY_CYCLES 500
 
+#elif defined(__s390x__)
+static inline void wait_cycles(unsigned long long cycles)
+{
+	asm volatile("0: brctg %0,0b" : : "d" (cycles));
+}
+
+/* tweak me */
+#define VMEXIT_CYCLES 200
+#define VMENTRY_CYCLES 200
+
 #else
 static inline void wait_cycles(unsigned long long cycles)
 {
@@ -81,6 +91,8 @@ extern unsigned ring_size;
 /* Is there a portable way to do this? */
 #if defined(__x86_64__) || defined(__i386__)
 #define cpu_relax() asm ("rep; nop" ::: "memory")
+#elif defined(__s390x__)
+#define cpu_relax() barrier()
 #else
 #define cpu_relax() assert(0)
 #endif
-- 
2.8.4

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

end of thread, other threads:[~2016-09-19 15:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-19 15:06 [PATCH 0/2] virtio-ringtest: more enablement Cornelia Huck
2016-09-19 15:06 ` [PATCH 1/2] tools/virtio/ringtest: fix run-on-all.sh for offline cpus Cornelia Huck
2016-09-19 15:06 ` [PATCH 2/2] tools/virtio/ringtest: tweaks for s390 Cornelia Huck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).