From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932390AbdJYIqM (ORCPT ); Wed, 25 Oct 2017 04:46:12 -0400 Received: from ozlabs.org ([103.22.144.67]:40435 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932217AbdJYIqJ (ORCPT ); Wed, 25 Oct 2017 04:46:09 -0400 Date: Wed, 25 Oct 2017 19:46:02 +1100 From: Paul Mackerras To: Matthew Wilcox Cc: Linus Torvalds , linux-kernel@vger.kernel.org, "linuxppc-dev@ozlabs.org" , "linux-s390@vger.kernel.org" Subject: Re: [PATCH] bitmap: Fix optimization of bitmap_set/clear for big-endian machines Message-ID: <20171025084602.GC25140@fergus.ozlabs.ibm.com> References: <20171025065726.GA25140@fergus.ozlabs.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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)