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=-3.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no 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 D27BFC433E2 for ; Tue, 14 Jul 2020 11:06:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A9D6A221FC for ; Tue, 14 Jul 2020 11:06:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="glRGH8Of" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726944AbgGNLGn (ORCPT ); Tue, 14 Jul 2020 07:06:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726252AbgGNLGm (ORCPT ); Tue, 14 Jul 2020 07:06:42 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C1A6C061755 for ; Tue, 14 Jul 2020 04:06:42 -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=7jndsVP9Agsh8Uleq86Hg05NfnxHBPcz1QZjPDkyQeY=; b=glRGH8OfBplt8LdPh0C09MXBox 9QMDN8dcRfKdyzkWiCer/cLemNCt9biis8i10hyLiiQ50KqcQrG7nFcgfddyjodcRma0NkyHjIhcy 108bwPXkG938piF+WDxiwmWcIUgTmt97wHkpGUvao81c1RjC0cWrRkjy3fa34k6oeGoKjjeNG6yIT BrOBFxLtvXTwtjOHDifYsaXNGi+X6rhs1FgxV7aoGZThTJQzpG6tpajK9eG9SbupY55nqmx29be9m 2txdp+eUAxq3xzaCw7KYH+29NNLsV4nsOhUjEAphiv+PWRhEFwhuRQd/fK/U4G/T/w3ww7zYSNlct Dn7/k6Cg==; Received: from hch by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1jvIkv-0006HL-TA; Tue, 14 Jul 2020 11:05:49 +0000 Date: Tue, 14 Jul 2020 12:05:49 +0100 From: Christoph Hellwig To: Arnd Bergmann Cc: Christoph Hellwig , Palmer Dabbelt , Nick Kossifidis , Mark Rutland , Gregory Fong , Peter Zijlstra , Catalin Marinas , Linus Walleij , Palmer Dabbelt , Brendan Higgins , Marco Elver , Alexander Potapenko , Krzysztof Kozlowski , Mauro Carvalho Chehab , Will Deacon , Ingo Molnar , Uwe Kleine-K??nig , AKASHI Takahiro , "Paul E. McKenney" , Masahiro Yamada , Russell King - ARM Linux , Matthew Wilcox , Mike Rapoport , Bartosz Golaszewski , Android Kernel Team , Petr Mladek , zaslonko@linux.ibm.com, Kees Cook , Mark Brown , "Vaittinen, Matti" , Ben Dooks , Dan Williams , Linux ARM , David Gow , Randy Dunlap , Nick Desaulniers , "linux-kernel@vger.kernel.org" , Masami Hiramatsu , Ard Biesheuvel , Andrew Morton , David Miller Subject: Re: [PATCH 1/3] lib: Add a generic copy_oldmem_page() Message-ID: <20200714110549.GA22613@infradead.org> References: <20200711035544.2832154-1-palmer@dabbelt.com> <20200711035544.2832154-2-palmer@dabbelt.com> <20200713130632.GA29945@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 13, 2020 at 03:39:17PM +0200, Arnd Bergmann wrote: > On Mon, Jul 13, 2020 at 3:07 PM Christoph Hellwig wrote: > > On Fri, Jul 10, 2020 at 08:55:42PM -0700, Palmer Dabbelt wrote: > > > +ssize_t copy_oldmem_page(unsigned long pfn, char *buf, > > > + size_t csize, unsigned long offset, > > > + int userbuf) > > > +{ > > > + void *vaddr; > > > + > > > + if (!csize) > > > + return 0; > > > + > > > + vaddr = memremap(__pfn_to_phys(pfn), PAGE_SIZE, MEMREMAP_WB); > > > + if (!vaddr) > > > + return -ENOMEM; > > > > Doing a memremap for every page is very inefficient. Also I don't see > > why you'd want to even do that. All memory is in the direct mapping > > for RISC-V. For other architecture that support highmem kmap_atomic_pfn > > would do the job, which is what I'd use in a generic version. > > I would expect the 'oldmem' data to not have a 'struct page', which would > be a problem at least for the generic implementation of kmap_atomic_pfn() Why do you expect it to not have a struct page?