From: Ian Campbell Subject: Re: [PATCH] xen: fix alignment for bitops Date: Tue, 15 Apr 2014 10:15:50 +0100 Message-ID: <1397553350.24638.19.camel@kazak.uk.xensource.com> References: <1397508202-16249-1-git-send-email-murzin.v@gmail.com> <534CFD520200007800008CF1@nat28.tlf.novell.com> <534D0EB30200007800008D8B@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WZzTP-0004AQ-EX for xen-devel@lists.xenproject.org; Tue, 15 Apr 2014 09:16:11 +0000 In-Reply-To: <534D0EB30200007800008D8B@nat28.tlf.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich Cc: xen-devel@lists.xenproject.org, Vladimir Murzin , boris.ostrovsky@oracle.com, david.vrabel@citrix.com List-Id: xen-devel@lists.xenproject.org On Tue, 2014-04-15 at 09:49 +0100, Jan Beulich wrote: > >>> On 15.04.14 at 10:29, wrote: > > On Tue, Apr 15, 2014 at 8:35 AM, Jan Beulich wrote: > >> only place you'd need to alter - we simply assume bitops on 32-bit > >> aligned quantities to work. > >> > > > > You do, but reality seems to be different, apart from arm64 looks like > > ppc64 has the same alignment requirement, I'm not aware about other > > 64-bit implementations... but, is it really possible to convince all > > these people to change the implementation? I guess the answer would be > > "use unsigned long", or like that :) > > That's no the point. The point is that if the arch has such > requirements, the arch-specific bitmap manipulation functions > should be written such that generic code works with the present > assumptions. In this case the interface which arch-specific code has contracted to expose to the generic code is: extern unsigned long find_first_bit(const unsigned long *addr, ... i.e. the bitmask is unsigned long (and this is the case for the majority of archs in Linux AFAICS, include asm-generic, note that this differs to Xen which IIRC uses void * here) So it is reasonable IMHO for the Linux arch code to except to be passed something which obeys the alignment rules for an unsigned long. I'm not convinced by the use of __aligned here -- I think it would be better to just use unsigned long. Ian.