Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3722964imu; Mon, 7 Jan 2019 08:18:43 -0800 (PST) X-Google-Smtp-Source: ALg8bN4VTardexe3xlTK6ruOd9QBbjCNRkQ9R6zkTUBMV1AOvgO1J4Xw/d2d+nxdLlxREp1FO5g1 X-Received: by 2002:a63:d157:: with SMTP id c23mr30268426pgj.170.1546877923178; Mon, 07 Jan 2019 08:18:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546877923; cv=none; d=google.com; s=arc-20160816; b=CtIOmJJxRJiD6lt4YCBApqCjNGHE4jGzqHLMxD7ovD5Tg3AyQUTu/Y0pUpv5++gyGY jllOtFvdNmAr7pGcxo+lHXGAyy9hTc7uFyR8I8VxfR1uIWdEFLDoE4L1gca83RXYu8iE lN+Z256CnUT1n2n+N+Q3ixEsjtcA7yyxeajeZ9Ebo7xLYC5Bxp14e1SUakyyA/wn53Kx ST3IyiMM2jmCinBy0V0paRQmA1bY3GRA7II4mv3yHgrl7m4EuY+heHbTPd++uwCY7aY/ 5LrHKTs4fOL/21sWI7x+/SpQKauEhQnoBLy7ydPixqNllxp1b5UQUi6BFLBKv3Y/fuA4 91nQ== 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=5g/kMXrEkbGmhEvNo2Sh1owaQvl+T5K6aqGMJ5Bydtw=; b=LLY8UO4I9CBYtEC6hWoTDgCBSWSMySq+B4sLrJCBlR4b4ghxRJIgDi/w6GupOYfkVc fP5ZrJXYdVdp0NQPn2yWOiaq+AwewXVpWgcHLsHqEcAAgwcw7e2MDfQ7imlA/nU7baDD xNgTmnq9cjUrJmfcJ/BUAlEK057vq+Cfd5DwDxLFBOhXXL77whKtHN3+2uT5dQ/TftHk mcZYj6xgRiKyfIrrd/9tfR4CW9dc2po7gJ0x761jo0ErTrGeuZqth/P2P5v8cRoy+UST ffYkWzePlz+plmb9zT4qWqhOknj5vyZ8nlzc9gEasSdtsUCxsvKl/iaPqjli8er4UDVy Z1TQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="wZiNTU9/"; 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 q64si4347739pga.280.2019.01.07.08.18.27; Mon, 07 Jan 2019 08:18:43 -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="wZiNTU9/"; 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 S1730769AbfAGNCP (ORCPT + 99 others); Mon, 7 Jan 2019 08:02:15 -0500 Received: from mail.kernel.org ([198.145.29.99]:49676 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730756AbfAGNCN (ORCPT ); Mon, 7 Jan 2019 08:02:13 -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 A898C21736; Mon, 7 Jan 2019 13:02:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1546866132; bh=KozZ53BpVdVuO9prhPitEsEpuKSk/NHFsSdcIa3jzcw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wZiNTU9/if+AWJ9cUwk+qCpaM7YGBKz7pTESG4aP3+VTWX8/Ag6Roi4JoS8/S2lWm MGQdvCPG+M1dhfE1OvKDSd9TVDTgZf3Fk6ZvWY+t3LkksTXwDYVXTGuflEzZRhuigD AF7Ieq1pzxO6RjzU8cqE42bZCE+PvQMW3fKTAhjg= 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.14 057/101] x86/mm: Drop usage of __flush_tlb_all() in kernel_physical_mapping_init() Date: Mon, 7 Jan 2019 13:32:45 +0100 Message-Id: <20190107105336.046274395@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190107105330.372621917@linuxfoundation.org> References: <20190107105330.372621917@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.14-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 @@ -574,7 +574,6 @@ phys_pud_init(pud_t *pud_page, unsigned paddr_end, page_size_mask, prot); - __flush_tlb_all(); continue; } /* @@ -617,7 +616,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); @@ -658,7 +656,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; } @@ -670,7 +667,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; } @@ -723,8 +719,6 @@ kernel_physical_mapping_init(unsigned lo if (pgd_changed) sync_global_pgds(vaddr_start, vaddr_end - 1); - __flush_tlb_all(); - return paddr_last; }