Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp24807pxb; Wed, 14 Apr 2021 08:36:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyNBdRhxqN/V8/pfgH3Ckimyf4+Hy8QBQGc45n6Z3ln0dN9WLZrHN3FFIyKd3NkokLibjyl X-Received: by 2002:a17:906:dc92:: with SMTP id cs18mr4581756ejc.27.1618414591462; Wed, 14 Apr 2021 08:36:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618414591; cv=none; d=google.com; s=arc-20160816; b=nKdeiiEYsyX9Ck5raxhfg43h3ZxM7SfRaeeImOizIOffQtY7z9laWc04YmArsfLErg TAL9ngS4dhVfiGAwGjwMvs1H7+7vn5Mn3GdWQ7mtK8cwIvEHNYuMAiEIVut4e7XIC3/G ki1JbNfh1RVUhtTYm/iECrAEgum8Jco6WHhxHjWwJ7awIEYRAwpCTmpRSGpeLhWIxiQj v08erjPjidK/M6McLw3AP3C6Pz5pmUzzOL0P2vlguqEUhClE+J+Gztr0ltq8U6tjryi+ YggOrQq1nn0YsqW/oV59E9/qHkA/WgKStHZhJFNC2cNpoSaUe9RsccdTV+vSiFtTtH2Z 6nMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=hx2ElfME/z8t2NqHuq0is1lt5Hwbga3+EmXPk/bu8jE=; b=rnCDY5tq0Z4KYtwO6XVje5nrMYMkpjWVukTJ2BLFg0RBFnlZBzNJT9rSEqZ7v7YYtu DnVFnBCK0D1DW+iIXpqDhGVLIMZ/45Ho91s4vFtuvwfEOmnAQx8E0aaINVY02uc6nhCt tENvzEM7YElg9Y1yoghwinHlO1Wm6+RAyq1sBqE+Rg/rHRDbRETwTwgEfx/LVxk568Mz g2b7DijDK8I9UjUb0gUCDAUoBfYbvKQZD/DeqO1ogvk2i4q6zjHQ/Gr0d5upKHRuQvxY hkRxglOX+zOyjm0SKjRWg0IO9NF2+68x+xy5xT+YIL4VAuvbPBfBVzUTVdjb51z2LWI2 O9qQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DWo11BYU; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gw24si12521070ejb.508.2021.04.14.08.36.06; Wed, 14 Apr 2021 08:36:31 -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; dkim=pass header.i=@linaro.org header.s=google header.b=DWo11BYU; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233562AbhDNL4b (ORCPT + 99 others); Wed, 14 Apr 2021 07:56:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233008AbhDNL4a (ORCPT ); Wed, 14 Apr 2021 07:56:30 -0400 Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B91D3C061756 for ; Wed, 14 Apr 2021 04:56:06 -0700 (PDT) Received: by mail-ed1-x529.google.com with SMTP id d21so3231565edv.9 for ; Wed, 14 Apr 2021 04:56:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=hx2ElfME/z8t2NqHuq0is1lt5Hwbga3+EmXPk/bu8jE=; b=DWo11BYUP8M2RRCHuP8NVoIUVaZdHxvf5gQUYMCSsF+3FuNm57QzXEZcai5Rz0tOOo SbjF++30ZWPKeE5ll0FuVJdbnC6en6luhn4Srsw0nzGczA/5kOLisn07OBSuyU4dZxRn VA64IxWARI5+cNZO1Gpuzf/roH+cBpRBVTJdejQt5W9JrR4IlCALwHfffinSr2UyHkil qxsEo35IATHxRBKkw2RZFaVCbU++Ou4BlBSalUywvyrmHI7vFrB5bXCM1E5ca49UqJsq uPEylfZj+pQ5RnNAzRX75L24L3VACUzpB9eOBEiA/pU28RYTNcsgrRrzCb+ZaVdCccSG HZEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=hx2ElfME/z8t2NqHuq0is1lt5Hwbga3+EmXPk/bu8jE=; b=lJ7EzyiS8RcqZrFfT6sGjsSxkjB3SAaMfvW709x13khupsLmX+Oy+8+lNcgxHWPMKP M5dGH4+xT5xJIpD2KIyOwSSXOpqEv9XjsKM5OLn8r2XHSE2hFuNYY/VhEB6xPy0dVgc5 gTxGLFE9pZZsvFOR7bHNBtCmma6X4pB3EUUNl2xpiqWCJYJlWop7Eq/k1RS88S75RqEX wGH2zFoMUlkmRT8suz6Kq1DZYjMXwYMcPY1PYiqsAsVgRW1moOF6ozpiv0/e9gVJxRos FKnxu5xC6ueh09Od8L3nrKdiD23Dy2LGlHJG3v1O2StQJtJQ0KIq2lrkOYZLFSiUbdC9 E7NA== X-Gm-Message-State: AOAM531NiuaulxdSbAfs5fzke8Q+2MK8fMG7mKLXZwnA/8F8fFNxwCjd xDZw42ZDXqTQgmPNgncKO2Dbdw== X-Received: by 2002:a05:6402:1051:: with SMTP id e17mr40827551edu.42.1618401365504; Wed, 14 Apr 2021 04:56:05 -0700 (PDT) Received: from apalos.home (ppp-94-65-92-88.home.otenet.gr. [94.65.92.88]) by smtp.gmail.com with ESMTPSA id z4sm11158884edb.97.2021.04.14.04.56.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Apr 2021 04:56:05 -0700 (PDT) Date: Wed, 14 Apr 2021 14:56:02 +0300 From: Ilias Apalodimas To: Matthew Wilcox Cc: Jesper Dangaard Brouer , 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, Matteo Croce , Grygorii Strashko , Arnd Bergmann , Christoph Hellwig Subject: Re: [PATCH 1/1] mm: Fix struct page layout on 32-bit systems Message-ID: 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210414115052.GS2531743@casper.infradead.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 14, 2021 at 12:50:52PM +0100, Matthew Wilcox wrote: > On Wed, Apr 14, 2021 at 10:10:44AM +0200, Jesper Dangaard Brouer wrote: > > Yes, indeed! - And very frustrating. It's keeping me up at night. > > I'm dreaming about 32 vs 64 bit data structures. My fitbit stats tell > > me that I don't sleep well with these kind of dreams ;-) > > Then you're going to love this ... even with the latest patch, there's > still a problem. Because dma_addr_t is still 64-bit aligned _as a type_, > that forces the union to be 64-bit aligned (as we already knew and worked > around), but what I'd forgotten is that forces the entirety of struct > page to be 64-bit aligned. Which means ... > > /* size: 40, cachelines: 1, members: 4 */ > /* padding: 4 */ > /* forced alignments: 1 */ > /* last cacheline: 40 bytes */ > } __attribute__((__aligned__(8))); > > .. that we still have a hole! It's just moved from being at offset 4 > to being at offset 36. > > > That said, I think we need to have a quicker fix for the immediate > > issue with 64-bit bit dma_addr on 32-bit arch and the misalignment hole > > it leaves[3] in struct page. In[3] you mention ppc32, does it only > > happens on certain 32-bit archs? > > AFAICT it happens on mips32, ppc32, arm32 and arc. It doesn't happen > on x86-32 because dma_addr_t is 32-bit aligned. > > 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'm seriously considering removing page_pool's support for doing/keeping > > DMA-mappings on 32-bit arch's. AFAIK only a single driver use this. > > ... if you're going to do that, then we don't need to do this. FWIW I already proposed that to Matthew in private a few days ago... II am not even sure the AM572x has that support. I'd much prefer getting rid of it as well, instead of overcomplicating the struct for a device noone is going to need. Cheers /Ilias