linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Paul Mackerras <paulus@ozlabs.org>
To: Matthew Wilcox <mawilcox@microsoft.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	linux-kernel@vger.kernel.org,
	"linuxppc-dev@ozlabs.org" <linuxppc-dev@ozlabs.org>,
	"linux-s390@vger.kernel.org" <linux-s390@vger.kernel.org>
Subject: Re: [PATCH] bitmap: Fix optimization of bitmap_set/clear for big-endian machines
Date: Wed, 25 Oct 2017 19:46:02 +1100	[thread overview]
Message-ID: <20171025084602.GC25140@fergus.ozlabs.ibm.com> (raw)
In-Reply-To: <MWHPR21MB08455F1374F717DBA20B7798CB440@MWHPR21MB0845.namprd21.prod.outlook.com>

On Wed, Oct 25, 2017 at 07:39:48AM +0000, Matthew Wilcox wrote:
> Hang on, don't tell me you found this by inspection.  Are you not running the bitmap testcase, enabled by CONFIG_TEST_BITMAP?  Either that should be producing an error, or there's a missing test case, or your inspection is wrong ...

I did find it by inspection.  I was looking for a version of the
bitmap_* API that does little-endian style bitmaps on all systems, and
the inline bitmap_set() does that in the case where it calls memset,
but not in the case where it calls __bitmap_set.

I'll fire up a big-endian system tomorrow when I get to work to run
the test case.  (PPC64 is almost entirely little-endian these days as
far as the IBM POWER systems are concerned.)

In any case, it's pretty clearly wrong as it is.  On a big-endian
64-bit system, bitmap_set(p, 56, 16) should set bytes 0 and 15 to
0xff, and there's no way a single memset can do that.

Paul.

(and yes, I stuffed up the address for lkml)

  reply	other threads:[~2017-10-25  8:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-25  6:57 [PATCH] bitmap: Fix optimization of bitmap_set/clear for big-endian machines Paul Mackerras
2017-10-25  7:39 ` Matthew Wilcox
2017-10-25  8:46   ` Paul Mackerras [this message]
2017-10-25  9:11     ` Matthew Wilcox
2017-10-25 10:30     ` Michael Ellerman

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=20171025084602.GC25140@fergus.ozlabs.ibm.com \
    --to=paulus@ozlabs.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=mawilcox@microsoft.com \
    --cc=torvalds@linux-foundation.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;
as well as URLs for NNTP newsgroup(s).