Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757349AbbGUA0c (ORCPT ); Mon, 20 Jul 2015 20:26:32 -0400 Received: from bh-25.webhostbox.net ([208.91.199.152]:40962 "EHLO bh-25.webhostbox.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754373AbbGUA0b (ORCPT ); Mon, 20 Jul 2015 20:26:31 -0400 Message-ID: <55AD91A8.8060800@roeck-us.net> Date: Mon, 20 Jul 2015 17:26:16 -0700 From: Guenter Roeck User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Andrew Morton , Rasmus Villemoes CC: Sowmini Varadhan , linux-kernel@vger.kernel.org, benh@kernel.crashing.org, davem@davemloft.net Subject: Re: [PATCH] iommu-common: Do not use 64 bit constant 0xffffffffffffffffl for computing align_mask References: <20150719121653.GA30645@oracle.com> <20150719152724.GB3729@roeck-us.net> <874mkzevz4.fsf@rasmusvillemoes.dk> <55AC55AD.6070608@roeck-us.net> <87oaj6ogox.fsf@rasmusvillemoes.dk> <20150720162800.734632f4e05ffae173cff527@linux-foundation.org> In-Reply-To: <20150720162800.734632f4e05ffae173cff527@linux-foundation.org> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Authenticated_sender: linux@roeck-us.net X-OutGoing-Spam-Status: No, score=-1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - bh-25.webhostbox.net X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - roeck-us.net X-Get-Message-Sender-Via: bh-25.webhostbox.net: authenticated_id: linux@roeck-us.net X-Source: X-Source-Args: X-Source-Dir: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1150 Lines: 34 On 07/20/2015 04:28 PM, Andrew Morton wrote: > On Mon, 20 Jul 2015 19:57:18 +0200 Rasmus Villemoes wrote: > >> On Mon, Jul 20 2015, Guenter Roeck wrote: >> >>> So either case ~0l appears to be wrong; it should be ~0ul. >> >> Yes, right-shifting -1 of any type is probably always wrong, as it will >> always give -1 again. > > Not for unsigned types. > > The kernel uses "-1UL" and "-1ULL" quite a lot - it's a convenient way > of saying "all ones, regardless of size". Also, assigning plain old > "-1" to an unsigned variable will make that variable all-ones > regardless of size. > > In this case I expect we could do > > align_mask = -1UL >> (64 - align_order); > -1ul works, at least on x86 (32 and 64 bit). > but I don't know about that 64. Maybe it should be BITS_PER_LONG? > I think that is going to be in the next version of the patch. Guenter -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/