Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp1109723pxb; Sat, 17 Apr 2021 06:59:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzxJ+2EykWosk7LwsQXBfD4e+Sd/JWweODsNc2e/EOhKOXOkiy5wrWrIKPH73m7xJY4UbAY X-Received: by 2002:a17:906:cf8f:: with SMTP id um15mr13058881ejb.547.1618667949068; Sat, 17 Apr 2021 06:59:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618667949; cv=none; d=google.com; s=arc-20160816; b=x/9O7fgnIvJZJdRjxvpNcSKszRONh6OAeHTc47rB+WZvAif0F1GcicqB4gQKVkCvYy D/fglSA3bI9kE2NvQ6K9wPJ9vtyokCXwvFLsINL4FCCza6OItHJWBm76m58Y6j+DMnm3 vYYrGjirJ1pTQBMy8wrVMszLPyRVvSpMTi7NGXQmQRvBxKwLVWxb8E9YgekqUgFmCuh/ VI69tAa3tqX55bH3xvyBzKyF+vEP9iwoOdQLEJXK65Vqz41REYMuGxNHzVn1A3TZDWf+ RdbHkMFjhQ1MSABzONEr4WXxeI0xwspcsMZHSLK+EqmArbvEWtRJBS+iOXQZI/MCiFnk itzQ== 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=xqgFJlR+jU3BMFPCC8NQxTzbFxfigD7vTUNnUGq4vIY=; b=rULRuq5+8+XTPhjjzLgEhOB9EssKAAT6M185Kk0SYV+xxH+DDALaFxoxe1PfoAc5Uy HL3YGrXO6n9MYIW8+DUIpLeOlhuz1LXxW+g5gfS19RU+i3oCavdaAqXzQCzh1n4bHDxJ +yUo1wN1naQAmeh3450TZgxqwQ4q2HkblE3DtlsTqwe/WiCVEEGgJETlXSZ2k8g77VOC ULTBhoLVJCE6hRlYqYxniZ6RbPfvUezJDU9PuOk92PHyobpPWqk7xP52tZhbgXia8pzy B3et59JIFHUFNnNgC4dScZqF4D8fPAGaGadkr3JmWr+yDvfwpyW88mD0t3O3hvCHhZV7 uEag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=SZN1IHMP; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p14si7148282ejf.582.2021.04.17.06.58.45; Sat, 17 Apr 2021 06:59:09 -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=@infradead.org header.s=casper.20170209 header.b=SZN1IHMP; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236488AbhDQN5y (ORCPT + 99 others); Sat, 17 Apr 2021 09:57:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236058AbhDQN5x (ORCPT ); Sat, 17 Apr 2021 09:57:53 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5156AC061574; Sat, 17 Apr 2021 06:57:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; 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=xqgFJlR+jU3BMFPCC8NQxTzbFxfigD7vTUNnUGq4vIY=; b=SZN1IHMPzUuDEQpeH8U5/v7rff H6wrF1LIVDWRSRtlMXzSRwuAre+050GPjLA2iogcsGTXqqfEDGxaC4rXfUbOM25eg0E50CHt5+SJL 1DjWYV0FM+08rQ1DpvQpoRCUX1YJJPp0dedZYxJ9aY2NaXbG+K3aifWyE0y411QrrJCRsyswU33Sa YbZV2+Q8TcIZK7v5N7lFZg8nXNefltcXpFfCGcJzW2rxXoRzVgIZbtuchtRjCKjJct4ZvMbIHXCjN otbSGYMAGgTgXFZOZWNCv3haV2wRKBJOwIRzHCU6S+6H0uqypx9YY5LVvS6Yy/6PQ424wGJ7CYdGm 5eCR6yHQ==; Received: from willy by casper.infradead.org with local (Exim 4.94 #2 (Red Hat Linux)) id 1lXlRC-00BJyr-Q7; Sat, 17 Apr 2021 13:56:47 +0000 Date: Sat, 17 Apr 2021 14:56:42 +0100 From: Matthew Wilcox To: Arnd Bergmann Cc: Jesper Dangaard Brouer , Grygorii Strashko , "netdev@vger.kernel.org" , Ilias Apalodimas , "linux-kernel@vger.kernel.org" , "linux-mips@vger.kernel.org" , "linux-mm@kvack.org" , David Laight , Matteo Croce , "linuxppc-dev@lists.ozlabs.org" , Christoph Hellwig , "linux-arm-kernel@lists.infradead.org" Subject: Re: [PATCH 1/1] mm: Fix struct page layout on 32-bit systems Message-ID: <20210417135642.GR2531743@casper.infradead.org> References: <20210411103318.GC2531743@casper.infradead.org> <20210412011532.GG2531743@casper.infradead.org> <20210414101044.19da09df@carbon> <20210414115052.GS2531743@casper.infradead.org> <20210414211322.3799afd4@carbon> <20210414213556.GY2531743@casper.infradead.org> <20210415200832.32796445@carbon> <20210416152755.GL2531743@casper.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Apr 17, 2021 at 12:31:37PM +0200, Arnd Bergmann wrote: > On Fri, Apr 16, 2021 at 5:27 PM Matthew Wilcox wrote: > > diff --git a/include/net/page_pool.h b/include/net/page_pool.h > > index b5b195305346..db7c7020746a 100644 > > --- a/include/net/page_pool.h > > +++ b/include/net/page_pool.h > > @@ -198,7 +198,17 @@ static inline void page_pool_recycle_direct(struct page_pool *pool, > > > > static inline dma_addr_t page_pool_get_dma_addr(struct page *page) > > { > > - return page->dma_addr; > > + dma_addr_t ret = page->dma_addr[0]; > > + if (sizeof(dma_addr_t) > sizeof(unsigned long)) > > + ret |= (dma_addr_t)page->dma_addr[1] << 32; > > + return ret; > > +} > > Have you considered using a PFN type address here? I suspect you > can prove that shifting the DMA address by PAGE_BITS would > make it fit into an 'unsigned long' on all 32-bit architectures with > 64-bit dma_addr_t. This requires that page->dma_addr to be > page aligned, as well as fit into 44 bits. I recently went through the > maximum address space per architecture to define a > MAX_POSSIBLE_PHYSMEM_BITS, and none of them have more than > 40 here, presumably the same is true for dma address space. I wouldn't like to make that assumption. I've come across IOMMUs (maybe on parisc? powerpc?) that like to encode fun information in the top few bits. So we could get it down to 52 bits, but I don't think we can get all the way down to 32 bits. Also, we need to keep the bottom bit clear for PageTail, so that further constrains us. Anyway, I like the "two unsigned longs" approach I posted yesterday, but thanks for the suggestion.