public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Martin Schwidefsky <schwidefsky@de.ibm.com>
To: linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Subject: [patch 08/16] Bogomips calculation for 64 bit.
Date: Tue, 10 Jul 2007 11:29:43 +0200	[thread overview]
Message-ID: <20070710093117.082040828@de.ibm.com> (raw)
In-Reply-To: 20070710092935.896013926@de.ibm.com

[-- Attachment #1: 008-bogomips.diff --]
[-- Type: text/plain, Size: 2550 bytes --]

From: Martin Schwidefsky <schwidefsky@de.ibm.com>

The bogomips calculation triggered via reading from /proc/cpuinfo
can return incorrect values if the qrnnd assembly is called with a
pointer in %r2 with any of the upper 32 bits set.
Fix this by using 64 bit division / remainder operation provided by
gcc instead of calling the assembly.

Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
---

 arch/s390/lib/Makefile         |    4 ++--
 include/asm-s390/sfp-machine.h |    6 +++---
 include/asm-s390/sfp-util.h    |   11 +++++++++++
 3 files changed, 16 insertions(+), 5 deletions(-)

Index: quilt-2.6/arch/s390/lib/Makefile
===================================================================
--- quilt-2.6.orig/arch/s390/lib/Makefile
+++ quilt-2.6/arch/s390/lib/Makefile
@@ -4,7 +4,7 @@
 
 EXTRA_AFLAGS := -traditional
 
-lib-y += delay.o string.o uaccess_std.o uaccess_pt.o qrnnd.o
-obj-$(CONFIG_32BIT) += div64.o
+lib-y += delay.o string.o uaccess_std.o uaccess_pt.o
+obj-$(CONFIG_32BIT) += div64.o qrnnd.o
 lib-$(CONFIG_64BIT) += uaccess_mvcos.o
 lib-$(CONFIG_SMP) += spinlock.o
Index: quilt-2.6/include/asm-s390/sfp-machine.h
===================================================================
--- quilt-2.6.orig/include/asm-s390/sfp-machine.h
+++ quilt-2.6/include/asm-s390/sfp-machine.h
@@ -27,9 +27,9 @@
    
 
 #define _FP_W_TYPE_SIZE		32
-#define _FP_W_TYPE		unsigned long
-#define _FP_WS_TYPE		signed long
-#define _FP_I_TYPE		long
+#define _FP_W_TYPE		unsigned int
+#define _FP_WS_TYPE		signed int
+#define _FP_I_TYPE		int
 
 #define _FP_MUL_MEAT_S(R,X,Y)					\
   _FP_MUL_MEAT_1_wide(_FP_WFRACBITS_S,R,X,Y,umul_ppmm)
Index: quilt-2.6/include/asm-s390/sfp-util.h
===================================================================
--- quilt-2.6.orig/include/asm-s390/sfp-util.h
+++ quilt-2.6/include/asm-s390/sfp-util.h
@@ -51,6 +51,16 @@
 	wl = __wl;					\
 })
 
+#ifdef __s390x__
+#define udiv_qrnnd(q, r, n1, n0, d)			\
+  do { unsigned long __n;				\
+       unsigned int __r, __d;				\
+    __n = ((unsigned long)(n1) << 32) + n0;		\
+    __d = (d);						\
+    (q) = __n / __d;					\
+    (r) = __n % __d;					\
+  } while (0)
+#else
 #define udiv_qrnnd(q, r, n1, n0, d)			\
   do { unsigned int __r;				\
     (q) = __udiv_qrnnd (&__r, (n1), (n0), (d));		\
@@ -58,6 +68,7 @@
   } while (0)
 extern unsigned long __udiv_qrnnd (unsigned int *, unsigned int,
 				   unsigned int , unsigned int);
+#endif
 
 #define UDIV_NEEDS_NORMALIZATION 0
 

-- 
blue skies,
   Martin.

"Reality continues to ruin my life." - Calvin.


  parent reply	other threads:[~2007-07-10  9:31 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-10  9:29 [patch 00/16] First s390 patchset for 2.6.22+ Martin Schwidefsky
2007-07-10  9:29 ` [patch 01/16] vmcp cleanup Martin Schwidefsky
2007-07-10  9:29 ` [patch 02/16] Fixed comment typo Martin Schwidefsky
2007-07-10  9:29 ` [patch 03/16] sclp: introduce some new interfaces Martin Schwidefsky
2007-07-10  9:29 ` [patch 04/16] sclp: Test facility list before executing a service call Martin Schwidefsky
2007-07-10  9:29 ` [patch 05/16] fixed cdl-format detection Martin Schwidefsky
2007-07-10  9:29 ` [patch 06/16] zcore: Fix __user annotation Martin Schwidefsky
2007-07-10  9:29 ` [patch 07/16] smp: Merge smp_count_cpus() and smp_get_save_areas() Martin Schwidefsky
2007-07-10  9:29 ` Martin Schwidefsky [this message]
2007-07-10  9:29 ` [patch 09/16] Program check in diag 210 under 31 bit Martin Schwidefsky
2007-07-10  9:29 ` [patch 10/16] Remove volatile from atomic_t Martin Schwidefsky
2007-07-10  9:29 ` [patch 11/16] dasd: Avoid compile warnings on !CONFIG_DASD_PROFILE Martin Schwidefsky
2007-07-10  9:29 ` [patch 12/16] system call optimization Martin Schwidefsky
2007-07-10  9:29 ` [patch 13/16] zcrypt: fix request timeout handling Martin Schwidefsky
2007-07-10  9:29 ` [patch 14/16] cio: Remove prototype for non-existing function cmf_reset() Martin Schwidefsky
2007-07-10  9:29 ` [patch 15/16] s390: rename CPU_IDLE to S390_CPU_IDLE Martin Schwidefsky
2007-07-10  9:29 ` [patch 16/16] vmlogrdr function annotation Martin Schwidefsky

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=20070710093117.082040828@de.ibm.com \
    --to=schwidefsky@de.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    /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