From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BAEB9C433B4 for ; Wed, 14 Apr 2021 11:58:05 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2135F6112F for ; Wed, 14 Apr 2021 11:58:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2135F6112F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=6GlsSFGpt480BHWz+B/lXdemX1+mohWS8glH7u0T198=; b=CUvlM/YXuycA7izzmNUqUzn8h VsnxDOUABujpmFImCsuLkhmKj+emBCbQqD/i4qEFFjTPDLR/RnwtC2UKVvzCuom/TR61I5Q0kVTpN 92hivkU+pNXbTR/KZIRAZZkvC8c6BTCGSF9qoIhYdyy7U3fO/nyrsdQjkmLQQWjrcEIgZb32RbCRV 4tyj+fSNEyQnCfhA02YwYsIHDcG/1N+siZnAoHsmuoxr/q7YXJp8gIy3VsjXGJ6ChVODKOyANGYzM FTWR1/j79zSFWT66g2pNT+gOnrgqQc42lWUm28qrvuLT6q7mgQ5B6DsGUgIEqa7MbLqelR8RKjn7R mNOreCWDQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lWe80-00CW2q-5v; Wed, 14 Apr 2021 11:56:16 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lWe7u-00CW26-KF for linux-arm-kernel@desiato.infradead.org; Wed, 14 Apr 2021 11:56:10 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=hx2ElfME/z8t2NqHuq0is1lt5Hwbga3+EmXPk/bu8jE=; b=d81WMX990C9QoaSzO5nj4FY7k2 yCvYKa+ewPESRlAI7Rvf/cxldhdTX9AxBMK+GecuUuzQlg+M2shffSSC7FegiGSXQ5TTwxRX61yhQ F9r4xERtsZ5Lnl+P6IqQ9CYMNUF1AQPLqXvG54al4I+tIucZUWPmD0F7ZFVnMttICcbuqUxhSxBy/ 2bckp88puD866wO8FwbYz58uWdMkt1jDTdg2evmB9/3qA09VNJl7wZ+cGW4ou7NrLJb2VyXWcyqN9 32NXoJJLITxLFSuWyISfRRwNmuNwiaB1F0rWYQ02ZBmKVoV8LU1EhXnUYBD/TbJ2wvQbdHSP++Dus tCRtyLAA==; Received: from mail-ed1-x535.google.com ([2a00:1450:4864:20::535]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lWe7r-007jJW-RK for linux-arm-kernel@lists.infradead.org; Wed, 14 Apr 2021 11:56:09 +0000 Received: by mail-ed1-x535.google.com with SMTP id bx20so22195940edb.12 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=iNAn1fzbe/nI3OzThnNEXghyNYUuoSCKCS7N3QCfG/mfrhbFr7nznlz0VsOjMl0kBo /scIsg6fF10l3LSPot6KgN6PMypUEge4J/72vn+Pa08Z06TbsRBj7gqpsvEZNNwxqrap ANVyhyYMaMo31FUcVPrZ23yu6Dj/cKTWOH4bPawR79vRf8yRQ+W978Rbnolq3AYoapRW 5Vq/LS3UKqJ9zM17aIh2Fl1SxRK0XsPTmOUA4DLhwfEjS5mQM/xfa36olm0uK+VH07EK AMQJXPmPSsKDz6yHW1TAw/IE3E62BOGdZ3pFoaEcg7JcPfRU3rXbEutaR7tnrcqGWKKg BlbA== X-Gm-Message-State: AOAM532SXGzblUkkaipwV9+wJWMEFuUWvwuaJ8RmzqGtW2RA1ra7Kw1Z pRcOks9djcuAytovxRcLSlQq0A== X-Google-Smtp-Source: ABdhPJw6QJVw35RGBrDVlA3MmikqiMsQbKDlIXm2vu0RmVXh/7v7wkWwJa8DqtuBoq9uM+i77OTQzQ== 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-Disposition: inline In-Reply-To: <20210414115052.GS2531743@casper.infradead.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210414_045607_937781_5F7160C2 X-CRM114-Status: GOOD ( 26.62 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel