LKML Archive on lore.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 06/13] find bit corner case.
Date: Tue, 19 Feb 2008 15:40:53 +0100	[thread overview]
Message-ID: <20080219144504.185987495@de.ibm.com> (raw)
In-Reply-To: <20080219144047.587547541@de.ibm.com>

[-- Attachment #1: 006-bitops.diff --]
[-- Type: text/plain, Size: 1530 bytes --]

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

Fix [ext2_]find_first_[zero_]bit for the corner case of an all clear
or all set bit field by always handling that last word of the bit field
with __ffz_word/__ffs_word.

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

 include/asm-s390/bitops.h |   20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

Index: quilt-2.6/include/asm-s390/bitops.h
===================================================================
--- quilt-2.6.orig/include/asm-s390/bitops.h
+++ quilt-2.6/include/asm-s390/bitops.h
@@ -456,16 +456,18 @@ static inline unsigned long __ffz_word_l
 
 	asm volatile(
 #ifndef __s390x__
-		"	ahi	%1,31\n"
-		"	srl	%1,5\n"
+		"	ahi	%1,-1\n"
+		"	sra	%1,5\n"
+		"	jz	1f\n"
 		"0:	c	%2,0(%0,%3)\n"
 		"	jne	1f\n"
 		"	la	%0,4(%0)\n"
 		"	brct	%1,0b\n"
 		"1:\n"
 #else
-		"	aghi	%1,63\n"
-		"	srlg	%1,%1,6\n"
+		"	aghi	%1,-1\n"
+		"	srag	%1,%1,6\n"
+		"	jz	1f\n"
 		"0:	cg	%2,0(%0,%3)\n"
 		"	jne	1f\n"
 		"	la	%0,8(%0)\n"
@@ -491,16 +493,18 @@ static inline unsigned long __ffs_word_l
 
 	asm volatile(
 #ifndef __s390x__
-		"	ahi	%1,31\n"
-		"	srl	%1,5\n"
+		"	ahi	%1,-1\n"
+		"	sra	%1,5\n"
+		"	jz	1f\n"
 		"0:	c	%2,0(%0,%3)\n"
 		"	jne	1f\n"
 		"	la	%0,4(%0)\n"
 		"	brct	%1,0b\n"
 		"1:\n"
 #else
-		"	aghi	%1,63\n"
-		"	srlg	%1,%1,6\n"
+		"	aghi	%1,-1\n"
+		"	srag	%1,%1,6\n"
+		"	jz	1f\n"
 		"0:	cg	%2,0(%0,%3)\n"
 		"	jne	1f\n"
 		"	la	%0,8(%0)\n"

-- 
blue skies,
   Martin.

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


  parent reply	other threads:[~2008-02-19 14:47 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-19 14:40 [patch 00/13] s390 bux fixes for 2.6.25-rc2 Martin Schwidefsky
2008-02-19 14:40 ` [patch 01/13] cio: Remember to initialize recovery_lock Martin Schwidefsky
2008-02-19 14:40 ` [patch 02/13] cio: Do timed recovery on workqueue Martin Schwidefsky
2008-02-19 14:40 ` [patch 03/13] Let NR_CPUS default to 32/64 on s390/s390x Martin Schwidefsky
2008-02-19 14:40 ` [patch 04/13] Make sure enabled wait psw is loaded in default_idle Martin Schwidefsky
2008-02-19 14:40 ` [patch 05/13] dasd: fix locking in __dasd_device_process_final_queue Martin Schwidefsky
2008-02-19 14:40 ` Martin Schwidefsky [this message]
2008-02-19 14:40 ` [patch 07/13] Initialize per cpu lowcores on cpu hotplug Martin Schwidefsky
2008-02-19 15:13   ` Bastian Blank
2008-02-19 15:38     ` Heiko Carstens
2008-02-19 15:41       ` Heiko Carstens
2008-02-19 18:44         ` Segher Boessenkool
2008-02-20  9:45           ` Heiko Carstens
2008-02-20 10:09             ` Bastian Blank
2008-02-20 10:24               ` Heiko Carstens
2008-02-19 14:40 ` [patch 08/13] qdio: fix qdio_activate timeout handling Martin Schwidefsky
2008-02-19 14:40 ` [patch 09/13] etr: fix compile error on !SMP Martin Schwidefsky
2008-02-19 14:40 ` [patch 10/13] sclp: clean up send/receive naming scheme Martin Schwidefsky
2008-02-19 14:40 ` [patch 11/13] dcss: Fix Unlikely(x) != y Martin Schwidefsky
2008-02-19 14:40 ` [patch 12/13] Fix futex_atomic_cmpxchg_std inline assembly Martin Schwidefsky
2008-02-19 14:41 ` [patch 13/13] qdio: FCP/SCSI write I/O stagnates on LPAR 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=20080219144504.185987495@de.ibm.com \
    --to=schwidefsky@de.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --subject='Re: [patch 06/13] find bit corner case.' \
    /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

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).