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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6E214C46467 for ; Tue, 10 Jan 2023 18:15:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D53B18E0002; Tue, 10 Jan 2023 13:15:41 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D03F18E0001; Tue, 10 Jan 2023 13:15:41 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BCBAE8E0002; Tue, 10 Jan 2023 13:15:41 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id A91A78E0001 for ; Tue, 10 Jan 2023 13:15:41 -0500 (EST) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 7AD571A111F for ; Tue, 10 Jan 2023 18:15:41 +0000 (UTC) X-FDA: 80339692482.28.AFB63A1 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf16.hostedemail.com (Postfix) with ESMTP id 11CCD18001C for ; Tue, 10 Jan 2023 18:15:38 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b="Ixq/CIyv"; spf=none (imf16.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1673374540; a=rsa-sha256; cv=none; b=CWSEXObJ6sRrYEvhGqmWtRGtwnDGBBYdLr/BxxuWqWdYZey0rA4DhmO17dKj2Ki6dlQjq6 O4hhIjHz2ZpTOhk2yhasmDp/gjG/zMBaa39lQkI73Vmh7V7mTR5APY2R9Nkbq8HRO12W/R MO2QfJcW5z1sff0USbrOmQK9CTwWGkI= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b="Ixq/CIyv"; spf=none (imf16.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1673374540; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=MdbdlmiuJNQCX/3+KpwhOIUbZ8WZP/ZzBLy4PzTanL0=; b=EPNAjUVqvmVneGJpWKK4vk3MwPn1fY5ecXrdl6yBlcAbwH+AlYCGE+sIcymz8OTmWatnhH kJPfyZQ0lAkWYF5GOBy6HjxYKBpra72jT4abvs+G5k241DjII92btcRrMWTQkoIHeU4r3x m8atFYVtp1KUrP2wP9hxCHJiqi0xUrg= 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=MdbdlmiuJNQCX/3+KpwhOIUbZ8WZP/ZzBLy4PzTanL0=; b=Ixq/CIyv/IEWQN4WI0sODkxeot GgM/isjKrkPkbIi3MKouB+5Ki5pj3kMMEzkYQnOQAa5whJwqWO330oSoyFI1nm6WqJZOnEgN4UH2y gHsJiSoeOoBnLdO99xQkTs/xn2hguVOSakuu3ga2gI8zXreHmuWuoiiiOJVRQnESdgxUxxvFPF7ym xYLVYKkxGXJiWr3VPUSwV8VOZfwNqCe/t5tFl8qWynJ+2pvz3x4K7N5pCdjQnNa895XLwlC7v2lAS BC05VoTOUIcGsHvNxnuHiNvmM/f8y6RLBh9CC8bNotYldOJnxuyeFrCseO3nUR5KTYlSJA7rLhlZE zXp1ixDA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1pFJ9y-003Qmw-Tm; Tue, 10 Jan 2023 18:15:43 +0000 Date: Tue, 10 Jan 2023 18:15:42 +0000 From: Matthew Wilcox To: Ilias Apalodimas Cc: Jesper Dangaard Brouer , netdev@vger.kernel.org, linux-mm@kvack.org, Shakeel Butt Subject: Re: [PATCH v2 03/24] page_pool: Add netmem_set_dma_addr() and netmem_get_dma_addr() Message-ID: References: <20230105214631.3939268-1-willy@infradead.org> <20230105214631.3939268-4-willy@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 11CCD18001C X-Stat-Signature: 3bg9xfuzyh4cuj4hi5oq4wwnzfn5hkzt X-HE-Tag: 1673374538-402188 X-HE-Meta: U2FsdGVkX19R5lcs2ME9A35KRI+SUHCAx4mzTpE5DPyUDHdYjZF7mNnPQNDVJgnoMxv8sgJaKTyaXEAHdvQ8hJvoYhwOyFAC7UjDHJa1bG4IXxl1taGrjlzPgLDnQ2HA87pVTYtjiD89IiOL/0hlm5DTUK7QjAVoY7EVVUS2C+8cPx9vuDOe1QevrKhxKakBFU+FwLaAXpMVPn3c+9NW4FMs/9BD3QT6Qb+VChP8bJpKi7C7C72wRBFQc6RUafprYpfswZjU6pnxrA5fq3lmK7ZgZOef7XD5oy6OfH8jgxnpMxIqJeW8vpGY4I9nxABneKD8d3hr8EhoYyZ4LJGV1FtBh1gVpbo7RBBX44OTfi2NRMSvNLcpo988LX+9RDCPTajCoE1CLJCK8esjmVsiHdGtzlWnkiJQPujmL9X2lkPOYUKruZIHVGr+83sEznSEkp9uV72vSktfk0hZK/qI1A3pCCvMz3LizCCoCOx0NIUUBYDvVeDOCN/nYSVSRqP91ZG+gfpmBPFpvvpuMDoxh5+TcIcsoXy5MZ1y2hktcrC9pV77EkWd+7aomLZVSdxbYeyYvlNbCQIeb5eimGbAOF/59/9LhY6tPS5Zg6Miz8fvxgw7J9VWA05SKTyC3c/+nOZoVUVnCFGQilK0yEQpPycE5IkUXmfcs+DclKzc8VX9PMlqkdNm7zi4SmxO4tvq4lQDqgOb5rv/B9Dh3r7pVtimdUZFjNUUWXiqID58X/SQImHaWZqdRSgWgEE1q0k8B/Y4/hIekWWMy7YLTxGH41tWPpx82jMKHn6JeL7EV72vaypHZALN33B8A5QQWl0M3iBFd+7Z7NRZWrF5dBZIA1+KnzELFqwcUmlIXNgmXzsAMGSlJVw6nNDjdh/I51WSz7h2sSB05xdB/qLM0fzhlQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, Jan 09, 2023 at 07:30:30PM +0200, Ilias Apalodimas wrote: > Hi Matthew Hey Ilias. Thanks for all the review! > > -static inline dma_addr_t page_pool_get_dma_addr(struct page *page) > > +static inline dma_addr_t netmem_get_dma_addr(struct netmem *nmem) > > Ideally, we'd like to avoid having people call these directly and use > the page_pool_(get|set)_dma_addr wrappers. Can we add a comment in > v3? I don't think this is what we want. Currently drivers call page_pool_get_dma_addr() on pages that are presumably from the page pool, but the compiler isn't going to help them out if they just get the struct page from somewhere random. They'll get garbage and presumably crash. By returning a netmem pointer from page_pool, we help drivers ensure that they're only passing around memory that was actually allocated from the page_pool and so they won't get garbage if they pass it to netmem_get_dma_addr(). The page_pool_get_dma_addr() wrapper is a temporary measure until we have all the drivers converted to use netmem alone. Does that all make sense, or have I misunderstood what you wanted from a comment?