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=DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_NEOMUTT 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 51FD0C04AB5 for ; Mon, 3 Jun 2019 21:41:48 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 1555B26C8F for ; Mon, 3 Jun 2019 21:41:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ZhjvtbnK"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="scIwGBKI" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1555B26C8F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-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=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:Reply-To:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version: References:Message-ID:Subject:To:From:Date:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=QnNHrWGbvz3FEhtWIM9E1HVmglx9vyQQ2+WYgC8X5ek=; b=ZhjvtbnKN4QrIe mYmxICaqC/25ZrZWU5irRb71ZgdqDOxhSgu2x3DHMm+EKXBlPgu/ygqt8YtbBAkpot4tuxB94PxOV OKrRZcU1+o5tmkrAZOj/XW4ggnKTupOYeHo4vU6KhHt+bviY/7j28FV4pp7/Gz1BWyniI9PxvfRbn FowwZsUaCFPLo6YfyJ/Fb3Dd/EOZbhPORON8HNsnGJgBifQJCc9Uz9CV5ojFLEKhNhCLyB80io3BO TLP/8hbbe8lx9JW2uc1sTlsltL96z6dFUtWFwCgRArsH+CSHA6ACfmquO3GdKinSCkP/03PI4ZfA2 /9LOng6hM4mg31TFIbvQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hXui9-0003gI-GA; Mon, 03 Jun 2019 21:41:45 +0000 Received: from mail-ed1-x543.google.com ([2a00:1450:4864:20::543]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hXui6-0003eq-Br for linux-arm-kernel@lists.infradead.org; Mon, 03 Jun 2019 21:41:43 +0000 Received: by mail-ed1-x543.google.com with SMTP id x25so16695278eds.8 for ; Mon, 03 Jun 2019 14:41:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:reply-to:references:mime-version :content-disposition:in-reply-to:user-agent; bh=yhLYhpx5r94UcNbu2SZQmZBVQeUmPq6PVimIkeEn7pk=; b=scIwGBKI357lkVXW52kw03XCI4+Ae6ho42noCT0DWTtPRkLPw37gVYJBmgatjte/fr txxL6xswgG2bwv4dcBi9ilccueJ2EbcEKZtiqgVr0w/zR7p00TQxQ68X081DlJksiVJp bQq/Q6WuN9RqstqJonmfHCKtiFMA7q9w/UyTa+NDl7ayqnpxpJkR/MsE/cnrEjpN5UnF pDmYt0I6nf0M8NtJy0pn3MNogc07CPwCXpJcmFU/YcoTOESdyv+YzC8Zd1MT32D8/vBb qcdBZinoMMfM8+8dbAMFVV623Db3nfb+VmQu9rZFXZf1rykogdgYpXDWtPbozhqhF8So ROsg== 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:reply-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=yhLYhpx5r94UcNbu2SZQmZBVQeUmPq6PVimIkeEn7pk=; b=jlZKEvKhP82fDxY6m0WAf9OJayBDUbkbMJjuQm9GgR+z11lEz4WLDDWcB4MiLZb5G5 Fol0Yhii23PaJe1dVKROTLfKIV45baGJbE506u4Cu9MnoaAkUxXCnW3l3Zmid6BHBv5O cCosdHWajnPr1UsLWskazj519ywvRAY7mEW3VkPEqELOcttiTuCyG9hM9t9cnpahWCj0 Ghl0ckYAI5L2er/bkLjhZFY2Ipk+I/1Bye7SE0F//yysev+Csy5T8wMWS7J2dqgvqk2W 1ChjjrR+lzEaqXFk0CeUwoTKaczfQSawhhcmGkmk/kcWVXh3ef5LTRuF9JGAHc/z6xho griw== X-Gm-Message-State: APjAAAUAaSfQ2lQFsfx5dT83mbX4P8zAPVuji8KtfYqJPtXSTfWPE7OO 2j8kZbCn5TXf10xOgPkf080= X-Google-Smtp-Source: APXvYqwCMUWcithGJqx45+EgRmxCCI6sjYqisr91FRxovWqn6/a/0IS0IDUQUvDAHCpQkkCQxu0u/A== X-Received: by 2002:a17:907:20d0:: with SMTP id qq16mr14587748ejb.244.1559598100632; Mon, 03 Jun 2019 14:41:40 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id e45sm4208929edb.12.2019.06.03.14.41.39 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 03 Jun 2019 14:41:39 -0700 (PDT) Date: Mon, 3 Jun 2019 21:41:39 +0000 From: Wei Yang To: David Hildenbrand Subject: Re: [PATCH v3 04/11] arm64/mm: Add temporary arch_remove_memory() implementation Message-ID: <20190603214139.mercn5hol2yyfl2s@master> References: <20190527111152.16324-1-david@redhat.com> <20190527111152.16324-5-david@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20190527111152.16324-5-david@redhat.com> User-Agent: NeoMutt/20170113 (1.7.2) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190603_144142_400684_22E275FD X-CRM114-Status: GOOD ( 14.52 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Wei Yang Cc: Mark Rutland , linux-s390@vger.kernel.org, linux-ia64@vger.kernel.org, Yu Zhao , Anshuman Khandual , linux-sh@vger.kernel.org, Catalin Marinas , Ard Biesheuvel , Will Deacon , linux-kernel@vger.kernel.org, Wei Yang , Jun Yao , linux-mm@kvack.org, Chintan Pandya , Igor Mammedov , akpm@linux-foundation.org, Mike Rapoport , linuxppc-dev@lists.ozlabs.org, Dan Williams , linux-arm-kernel@lists.infradead.org, Robin Murphy Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, May 27, 2019 at 01:11:45PM +0200, David Hildenbrand wrote: >A proper arch_remove_memory() implementation is on its way, which also >cleanly removes page tables in arch_add_memory() in case something goes >wrong. Would this be better to understand? removes page tables created in arch_add_memory > >As we want to use arch_remove_memory() in case something goes wrong >during memory hotplug after arch_add_memory() finished, let's add >a temporary hack that is sufficient enough until we get a proper >implementation that cleans up page table entries. > >We will remove CONFIG_MEMORY_HOTREMOVE around this code in follow up >patches. > >Cc: Catalin Marinas >Cc: Will Deacon >Cc: Mark Rutland >Cc: Andrew Morton >Cc: Ard Biesheuvel >Cc: Chintan Pandya >Cc: Mike Rapoport >Cc: Jun Yao >Cc: Yu Zhao >Cc: Robin Murphy >Cc: Anshuman Khandual >Signed-off-by: David Hildenbrand >--- > arch/arm64/mm/mmu.c | 19 +++++++++++++++++++ > 1 file changed, 19 insertions(+) > >diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c >index a1bfc4413982..e569a543c384 100644 >--- a/arch/arm64/mm/mmu.c >+++ b/arch/arm64/mm/mmu.c >@@ -1084,4 +1084,23 @@ int arch_add_memory(int nid, u64 start, u64 size, > return __add_pages(nid, start >> PAGE_SHIFT, size >> PAGE_SHIFT, > restrictions); > } >+#ifdef CONFIG_MEMORY_HOTREMOVE >+void arch_remove_memory(int nid, u64 start, u64 size, >+ struct vmem_altmap *altmap) >+{ >+ unsigned long start_pfn = start >> PAGE_SHIFT; >+ unsigned long nr_pages = size >> PAGE_SHIFT; >+ struct zone *zone; >+ >+ /* >+ * FIXME: Cleanup page tables (also in arch_add_memory() in case >+ * adding fails). Until then, this function should only be used >+ * during memory hotplug (adding memory), not for memory >+ * unplug. ARCH_ENABLE_MEMORY_HOTREMOVE must not be >+ * unlocked yet. >+ */ >+ zone = page_zone(pfn_to_page(start_pfn)); Compared with arch_remove_memory in x86. If altmap is not NULL, zone will be retrieved from page related to altmap. Not sure why this is not the same? >+ __remove_pages(zone, start_pfn, nr_pages, altmap); >+} >+#endif > #endif >-- >2.20.1 -- Wei Yang Help you, Help me _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel