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=-10.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 D5D7DC433E0 for ; Fri, 22 Jan 2021 21:53:24 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 501A423B08 for ; Fri, 22 Jan 2021 21:53:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 501A423B08 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=soleen.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id C40926B000A; Fri, 22 Jan 2021 16:53:23 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BCA8B6B000D; Fri, 22 Jan 2021 16:53:23 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AB7DC6B0010; Fri, 22 Jan 2021 16:53:23 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0238.hostedemail.com [216.40.44.238]) by kanga.kvack.org (Postfix) with ESMTP id 909A86B000A for ; Fri, 22 Jan 2021 16:53:23 -0500 (EST) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 5476AB7B9 for ; Fri, 22 Jan 2021 21:53:23 +0000 (UTC) X-FDA: 77734762686.18.balls86_19152322756f Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin18.hostedemail.com (Postfix) with ESMTP id 32A8610144DA9 for ; Fri, 22 Jan 2021 21:53:23 +0000 (UTC) X-HE-Tag: balls86_19152322756f X-Filterd-Recvd-Size: 7175 Received: from mail-ej1-f48.google.com (mail-ej1-f48.google.com [209.85.218.48]) by imf14.hostedemail.com (Postfix) with ESMTP for ; Fri, 22 Jan 2021 21:53:22 +0000 (UTC) Received: by mail-ej1-f48.google.com with SMTP id a10so9761177ejg.10 for ; Fri, 22 Jan 2021 13:53:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=6CPWITUo+/eP9ETNQd4OsSoK0U6TCxj0r5SMKqUz0Nw=; b=EdKLye9FO1WxidyFZOfPLK+SDmnrcZ6RUgsPQCQcizQz+f1pQmRoWjI3h/HD9HNQJk xUc8FfvxKxkdTuPJzF4hTGYudt4sZbY8KGxX/FbTpxQM9kMoQPPVAHZZUnLLYWv/PIjd +TokG5V34YJrwP6HoCUer03h2aw92ohcxZqoFChAzqFUSBCmCoHmOZN9ZW0PIxinCjO1 Fm2zWrZcuCCaUqiSSeQF6qrJh50IMz4ObnZwgwGzBI2FICSG9teOFwTErb25kndIhdTK zuaMwDuDeeyFNCI2CxZx3QJ+Qc2vQVmJFtfyYdZDBZuoS5NZ40fMrwvImVw71mqD9Oji Y1Ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=6CPWITUo+/eP9ETNQd4OsSoK0U6TCxj0r5SMKqUz0Nw=; b=QzshoFZHwLYf7ED8YmOfSIwoUtHVuz+jyo2rgzCVOn5ycqFz7iHZODBoaCxcU1zsjd SocOvb7hzrsJGIqSiIlfwXj0bgN3qkftsSkh4Et3d9hOYMfbdWZjTrmCBPHs1vIhFY/a ZSWVvdxwOWZlgQN65ml956+XV2iHySiNVjbV+FKxgefpXQJrtnZuPYD8s9R/kuE+kMtv ofx7C7QmDzZeLmu3jzJeIdC+05gZT490bppqfeRrucozsmh9aaiRtsQa9dJMVllL+5zu VE5MNypgGCRLqO60H9qI2lN+NOfzJhIjU+O1FKtTgEOxCR2OwEac5XbHcC8mknqSBLem kkyQ== X-Gm-Message-State: AOAM531Ztzj29Pj+3Sp0E+kv79932HuDBUH1teq476zdoCkvbSy/0M6r VdxXb9LQT9PZ2ACNMVB77am24AHNEZlSaGyEDhRncA== X-Google-Smtp-Source: ABdhPJwRuqlxp1D1eQU4p//nwmF76HmUcMvAFR5HgT61SNcSei74aW4bFuULOnfaN7MlUUFVunC4rCNCl9NBYH1wy9g= X-Received: by 2002:a17:907:20aa:: with SMTP id pw10mr892158ejb.314.1611352401292; Fri, 22 Jan 2021 13:53:21 -0800 (PST) MIME-Version: 1.0 References: <20200326032420.27220-1-pasha.tatashin@soleen.com> <20200326032420.27220-4-pasha.tatashin@soleen.com> In-Reply-To: From: Pavel Tatashin Date: Fri, 22 Jan 2021 16:52:45 -0500 Message-ID: Subject: Re: [PATCH v9 03/18] arm64: trans_pgd: make trans_pgd_map_page generic To: James Morse Cc: James Morris , Sasha Levin , "Eric W. Biederman" , kexec mailing list , LKML , Jonathan Corbet , Catalin Marinas , Will Deacon , Linux ARM , Marc Zyngier , Vladimir Murzin , Matthias Brugger , Bhupesh Sharma , linux-mm , Mark Rutland , steve.capper@arm.com, rfontana@redhat.com, Thomas Gleixner , Selin Dag Content-Type: text/plain; charset="UTF-8" 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: Hi James, I am working on an updated version of this patch series. We had back and forth discussion on the list and off the list about MMU-enabled series. So, I decided to sync the last series I had with the current mainline. Address your last comments (those that I can address), and send it again, so we can take a fresh look. I will reply to some of your comments, as I address them in the synced version of my series. On Wed, Apr 29, 2020 at 1:01 PM James Morse wrote: > > Hi Pavel, > > On 26/03/2020 03:24, Pavel Tatashin wrote: > > kexec is going to use a different allocator, so make > > > trans_pgd_map_page to accept allocator as an argument, and also > > kexec is going to use a different map protection, so also pass > > it via argument. > > This trans_pgd_map_page() used to be create_single_mapping() It creates page tables that > map one page: the relocation code. > > Why do you need a different pgprot? Surely PAGE_KERNEL_EXEC is exactly what you want. For hibernate case yes, but for MMU enabled kexec case, PAGE_KERNEL is used, because it is used to copy data segments. > > diff --git a/arch/arm64/include/asm/trans_pgd.h b/arch/arm64/include/asm/trans_pgd.h > > index 23153c13d1ce..ad5194ad178d 100644 > > --- a/arch/arm64/include/asm/trans_pgd.h > > +++ b/arch/arm64/include/asm/trans_pgd.h > > @@ -12,10 +12,24 @@ > > #include > > #include > > > > +/* > > + * trans_alloc_page > > + * - Allocator that should return exactly one zeroed page, if this > > + * allocator fails, trans_pgd returns -ENOMEM error. > > trans_pgd is what you pass in to trans_pgd_map_page() or trans_pgd_create_copy(). > Do you mean what those functions return? I meant to say trans_pgd_*, but I will change the comment to explicitly say trans_pgd_map_page() and trans_pgd_create_copy() will return -ENOMEM. > > > > + * > > + * trans_alloc_arg > > + * - Passed to trans_alloc_page as an argument > > + */ > > > diff --git a/arch/arm64/kernel/hibernate.c b/arch/arm64/kernel/hibernate.c > > index 3d6f0fd73591..607bb1fbc349 100644 > > --- a/arch/arm64/kernel/hibernate.c > > +++ b/arch/arm64/kernel/hibernate.c > > @@ -195,6 +200,11 @@ static int create_safe_exec_page(void *src_start, size_t length, > > unsigned long dst_addr, > > phys_addr_t *phys_dst_addr) > > { > > + struct trans_pgd_info trans_info = { > > + .trans_alloc_page = hibernate_page_alloc, > > + .trans_alloc_arg = (void *)GFP_ATOMIC, > > + }; > > As you need another copy of this in the next patch, is it worth declaring this globally > and making it const? I think it is alright to have it on the stack instead of permanently using the data section for this. Plus, we will have a different one for the kexec case, so having this globally available will make it strange. > > > > diff --git a/arch/arm64/mm/trans_pgd.c b/arch/arm64/mm/trans_pgd.c > > index d20e48520cef..275a79935d7e 100644 > > --- a/arch/arm64/mm/trans_pgd.c > > +++ b/arch/arm64/mm/trans_pgd.c > > @@ -180,8 +185,18 @@ int trans_pgd_create_copy(pgd_t **dst_pgdp, unsigned long start, > > return rc; > > } > > > > -int trans_pgd_map_page(pgd_t *trans_pgd, void *page, unsigned long dst_addr, > > - pgprot_t pgprot) > > +/* > > + * Add map entry to trans_pgd for a base-size page at PTE level. > > + * info: contains allocator and its argument > > + * trans_pgd: page table in which new map is added. > > + * page: page to be mapped. > > > + * dst_addr: new VA address for the pages > > ~s/pages/page/ > > This thing only maps one page. Sure, I will change that. Thank you, Pasha