Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp114446pxb; Wed, 14 Apr 2021 10:40:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwmDpk+IMZO1EjhEi8aLidMvJviaId6DBbYRrvNpDLoetWUZbiry02AplzDY1yMv6nVOydQ X-Received: by 2002:a17:906:f1d0:: with SMTP id gx16mr35254ejb.340.1618422046757; Wed, 14 Apr 2021 10:40:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618422046; cv=none; d=google.com; s=arc-20160816; b=iSClxEQy3aulFm8qIwkdzu8158YTWkV9xrADwKxZsmLDQYplQz/PEWsEdJUwpKD53m 9NJShyZxRrQwvRGHAiB67rN2WBQLRaFkgbAJYB7nAV0LINxgzitGMD659Ww1EOPa/NBS DJmRb6tPMeJVJB23Kw0kLs3EKUyyfWJADr+16gp/bQRYEHh9DUX+dBUSZjO2rxLHUrl7 mAoPXJ629RZ9TvUHk4QwUX/l8h81zoNT2Gy6exlanWk194IOMbHZXwHs9CNhV9YGKFuF Jb/XVI4Cm//ns3jpqJDkyh6uZsSn6zeCDQnZNZtK9S9uSPcDed+m8V2kmqlNhnHJy7EG hvLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :mime-version:accept-language:in-reply-to:references:message-id:date :thread-index:thread-topic:subject:cc:to:from; bh=57LXJZkHXrs81hopzSpWtcxghca/wCOL7UPWsxIB3ss=; b=vEI9PnDE7u7gSN6Ne5rAczSWOYwlWi5JI1UCMaz8Twxcwfq2C/OKnE8Amg4xzF2nHR 09aRILTM13GLhl8vxaq6QCGf5S0+yUyiPfWIYTReIsaDhxoFoe+s25dD4BUPaHAq7+NR DAx68gO8iFz72phATc+TP4i2PjvliDzvu2L8au9FbKaB7HKGTgVMEMY+3cCsoXWr+GDn C7606y1CZCUc35TBkPtBTwIhFTMJSCtRht4ivUOe9Bv0h8+HGVBgFFF7p3Lf16xtKXEN vwZmdExjVhxHxliYC5gl0nFQtIoS2mPiZhib/o0qw/dlG8lwb9xGa7VhfSmu07EAPoRm qgfg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l27si166097edc.374.2021.04.14.10.39.57; Wed, 14 Apr 2021 10:40:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352523AbhDNPxU convert rfc822-to-8bit (ORCPT + 99 others); Wed, 14 Apr 2021 11:53:20 -0400 Received: from eu-smtp-delivery-151.mimecast.com ([185.58.86.151]:43801 "EHLO eu-smtp-delivery-151.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347303AbhDNPwp (ORCPT ); Wed, 14 Apr 2021 11:52:45 -0400 Received: from AcuMS.aculab.com (156.67.243.121 [156.67.243.121]) (Using TLS) by relay.mimecast.com with ESMTP id uk-mta-15-m9cXnC2KMlaJybEViQCuIg-1; Wed, 14 Apr 2021 16:52:18 +0100 X-MC-Unique: m9cXnC2KMlaJybEViQCuIg-1 Received: from AcuMS.Aculab.com (fd9f:af1c:a25b:0:994c:f5c2:35d6:9b65) by AcuMS.aculab.com (fd9f:af1c:a25b:0:994c:f5c2:35d6:9b65) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 14 Apr 2021 16:52:16 +0100 Received: from AcuMS.Aculab.com ([fe80::994c:f5c2:35d6:9b65]) by AcuMS.aculab.com ([fe80::994c:f5c2:35d6:9b65%12]) with mapi id 15.00.1497.012; Wed, 14 Apr 2021 16:52:16 +0100 From: David Laight To: 'Matthew Wilcox' , Jesper Dangaard Brouer CC: "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" , "netdev@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" , "linux-arm-kernel@lists.infradead.org" , "linux-mips@vger.kernel.org" , Ilias Apalodimas , Matteo Croce , Grygorii Strashko , Arnd Bergmann , "Christoph Hellwig" Subject: RE: [PATCH 1/1] mm: Fix struct page layout on 32-bit systems Thread-Topic: [PATCH 1/1] mm: Fix struct page layout on 32-bit systems Thread-Index: AQHXMSRrwdfrgigLI0exh4xFUSZq9Kq0J1eg Date: Wed, 14 Apr 2021 15:52:16 +0000 Message-ID: <7f6cee3dcf1749fbb7b54eaf129141e7@AcuMS.aculab.com> References: <20210410205246.507048-1-willy@infradead.org> <20210410205246.507048-2-willy@infradead.org> <20210411114307.5087f958@carbon> <20210411103318.GC2531743@casper.infradead.org> <20210412011532.GG2531743@casper.infradead.org> <20210414101044.19da09df@carbon> <20210414115052.GS2531743@casper.infradead.org> In-Reply-To: <20210414115052.GS2531743@casper.infradead.org> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=C51A453 smtp.mailfrom=david.laight@aculab.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > Doing this fixes it: > > +++ b/include/linux/types.h > @@ -140,7 +140,7 @@ typedef u64 blkcnt_t; > * so they don't care about the size of the actual bus addresses. > */ > #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT > -typedef u64 dma_addr_t; > +typedef u64 __attribute__((aligned(sizeof(void *)))) dma_addr_t; > #else > typedef u32 dma_addr_t; > #endif I hate __packed so much I've been checking what it does! If you add __packed to the dma_addr_t field inside the union then gcc (at least) removes the pad from before it, but also 'remembers' the alignment that is enforced by other members of the structure. So you don't need the extra aligned(sizeof (void *)) since that is implicit. So in this case __packed probably has no side effects. (Unless a 32bit arch has instructions for a 64bit read that must not be on an 8n+4 boundary and the address is taken). It also doesn't affect 64bit - since the previous field forces 64bit alignment. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)