Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3513650imu; Mon, 7 Jan 2019 04:54:30 -0800 (PST) X-Google-Smtp-Source: ALg8bN4W/ukNJWmY1s+p+iu0sC46icgNnEwtq7tyYXU6Dffd6lkjSM5A4P6CQCS/f0e1uhMIiu9u X-Received: by 2002:aa7:8758:: with SMTP id g24mr61783893pfo.250.1546865670318; Mon, 07 Jan 2019 04:54:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546865670; cv=none; d=google.com; s=arc-20160816; b=ZG6yuadoS+02iG3skbgeEc5r2jO9DHyOKDV242+MMo2nkQ6EKa2I0Ht7nRO/ULqjHQ Eeb2kzoOsgp0LZ5l96JceJuhRYn4hei3vgHuJ5IIbcWjBMdV7QkyjvyI/hztfNgltXqG GOzJUGD5z++RFJYG7ng7Op4atoK12bUN0MhVw87fs0CGLwCoR6X+WecaJmtbC3j+v6FH g2pRSCYTAiRKrqJNqfpYHa7A2mbs2id9FZvqWOw/6WjqSlKqm2zm/vMLUNsQGRP0Sze+ w6lrDlThh+dMpo8PsTxubIgh5/kIOazL78X3JLo/XNqFT0zhgrArz/xV5UYMwxvOtm/V Eq1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=MzUOJV8n0k7ypo7SD2ZI+Ly+aFv3dUGU1zkYitoIRFU=; b=f4AthVpJkzoXoZpUhOhhwp0gggef5YrBbwBRNn2pKi+nSELNmb+ReiNL531qD0wnA1 MByNlXH2NCYua1guFYMQuUX/G735p0FZpKYH5u/Qv7bP14k8OWkJz1CY4f7I3biK4pOI WHlXw2zdzCkHA6JH6GdLAkMmZob7r+ODMyJlaAPTpwzsDQvBepQMbOAo8hvaQDI4RbT8 fDhe1TP6DGDOG0Uuo26EVt/IW9gKTwaBnbjiS0QaU9lnVowh4r9e5VdCVX8y7gV4OPvi 0/PesR1pSmSBMYRvdHOycR33/40MK+TTVohV8QIsWj7MwssKZEkTNcj5SbYHm36YilFg hlRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=HmVY2Qg3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e8si25680110pgn.325.2019.01.07.04.54.15; Mon, 07 Jan 2019 04:54:30 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=HmVY2Qg3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729576AbfAGMwZ (ORCPT + 99 others); Mon, 7 Jan 2019 07:52:25 -0500 Received: from mail.kernel.org ([198.145.29.99]:42076 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727705AbfAGMwX (ORCPT ); Mon, 7 Jan 2019 07:52:23 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5D30F20665; Mon, 7 Jan 2019 12:52:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1546865542; bh=ZFgYfEtqbvDy4Mc8K6VQgVrluXWZwTSSCzTWmrWEL5c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HmVY2Qg3DqJ5hy8MO701TMOl5w0nYvnMhugs7AtngOQdXSF1GkklpU0eHEfCnzvwO Xt8LJX9YV50rIT6LdnvzRfbmNvRB5EFTOPWxfxWw+5QGw9f2ImEZyz+Upj9z5E+GMP uJq1FsUN9dhE14gIQzQUwVrYj3MA0rSj6ZtOXobs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dave Hansen , Andy Lutomirski , Dan Williams , "Peter Zijlstra (Intel)" , "Kirill A. Shutemov" , Borislav Petkov , "H. Peter Anvin" , Linus Torvalds , Rik van Riel , Sebastian Andrzej Siewior , Thomas Gleixner , dave.hansen@intel.com, Ingo Molnar Subject: [PATCH 4.19 091/170] x86/mm: Drop usage of __flush_tlb_all() in kernel_physical_mapping_init() Date: Mon, 7 Jan 2019 13:31:58 +0100 Message-Id: <20190107104503.802806010@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190107104452.953560660@linuxfoundation.org> References: <20190107104452.953560660@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dan Williams commit ba6f508d0ec4adb09f0a939af6d5e19cdfa8667d upstream. Commit: f77084d96355 "x86/mm/pat: Disable preemption around __flush_tlb_all()" addressed a case where __flush_tlb_all() is called without preemption being disabled. It also left a warning to catch other cases where preemption is not disabled. That warning triggers for the memory hotplug path which is also used for persistent memory enabling: WARNING: CPU: 35 PID: 911 at ./arch/x86/include/asm/tlbflush.h:460 RIP: 0010:__flush_tlb_all+0x1b/0x3a [..] Call Trace: phys_pud_init+0x29c/0x2bb kernel_physical_mapping_init+0xfc/0x219 init_memory_mapping+0x1a5/0x3b0 arch_add_memory+0x2c/0x50 devm_memremap_pages+0x3aa/0x610 pmem_attach_disk+0x585/0x700 [nd_pmem] Andy wondered why a path that can sleep was using __flush_tlb_all() [1] and Dave confirmed the expectation for TLB flush is for modifying / invalidating existing PTE entries, but not initial population [2]. Drop the usage of __flush_tlb_all() in phys_{p4d,pud,pmd}_init() on the expectation that this path is only ever populating empty entries for the linear map. Note, at linear map teardown time there is a call to the all-cpu flush_tlb_all() to invalidate the removed mappings. [1]: https://lkml.kernel.org/r/9DFD717D-857D-493D-A606-B635D72BAC21@amacapital.net [2]: https://lkml.kernel.org/r/749919a4-cdb1-48a3-adb4-adb81a5fa0b5@intel.com [ mingo: Minor readability edits. ] Suggested-by: Dave Hansen Reported-by: Andy Lutomirski Signed-off-by: Dan Williams Acked-by: Peter Zijlstra (Intel) Acked-by: Kirill A. Shutemov Cc: Cc: Borislav Petkov Cc: H. Peter Anvin Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Rik van Riel Cc: Sebastian Andrzej Siewior Cc: Thomas Gleixner Cc: dave.hansen@intel.com Fixes: f77084d96355 ("x86/mm/pat: Disable preemption around __flush_tlb_all()") Link: http://lkml.kernel.org/r/154395944713.32119.15611079023837132638.stgit@dwillia2-desk3.amr.corp.intel.com Signed-off-by: Ingo Molnar Signed-off-by: Greg Kroah-Hartman --- arch/x86/mm/init_64.c | 6 ------ 1 file changed, 6 deletions(-) --- a/arch/x86/mm/init_64.c +++ b/arch/x86/mm/init_64.c @@ -585,7 +585,6 @@ phys_pud_init(pud_t *pud_page, unsigned paddr_end, page_size_mask, prot); - __flush_tlb_all(); continue; } /* @@ -628,7 +627,6 @@ phys_pud_init(pud_t *pud_page, unsigned pud_populate(&init_mm, pud, pmd); spin_unlock(&init_mm.page_table_lock); } - __flush_tlb_all(); update_page_count(PG_LEVEL_1G, pages); @@ -669,7 +667,6 @@ phys_p4d_init(p4d_t *p4d_page, unsigned paddr_last = phys_pud_init(pud, paddr, paddr_end, page_size_mask); - __flush_tlb_all(); continue; } @@ -681,7 +678,6 @@ phys_p4d_init(p4d_t *p4d_page, unsigned p4d_populate(&init_mm, p4d, pud); spin_unlock(&init_mm.page_table_lock); } - __flush_tlb_all(); return paddr_last; } @@ -734,8 +730,6 @@ kernel_physical_mapping_init(unsigned lo if (pgd_changed) sync_global_pgds(vaddr_start, vaddr_end - 1); - __flush_tlb_all(); - return paddr_last; }