Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3140624imm; Fri, 20 Jul 2018 10:50:08 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeL/YG5eVz/yOXVRxlJ9IC30Mqrx3AWlIUPvxProH67Eff8KTInCesoijdVOL+AhLk5WuqW X-Received: by 2002:a17:902:7798:: with SMTP id o24-v6mr3062844pll.165.1532109008554; Fri, 20 Jul 2018 10:50:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532109008; cv=none; d=google.com; s=arc-20160816; b=E3DqWIbIKSoYFDRlCh9QUw0CvkbXSdiUFDKdr77VJ7TR2nq7ZK3wK9qrjjwOE0ioc6 YxZJkn/wq09CXe+Boky+DaWMTEh+vz96gs8jyPIfx4Qa8uy6041nDYlk4N3PJqRRW1Qe gxK3044YHEDti4Rn919pdrsR7roIiyXGewZXe0I2DPDZsPkUeaUAMtnSu9YpfkVpsXWg NnyEmPmWFnjVdp0TL2+UaKieCSIxEv1gs6nAHwIP1JbiSV23ENJstT9RECvl1KjGrE79 ZdDwCbL8iUsGm5tiRBimcDLTTziT9d0C1QFwi6tW6/SHXA8Siw5xBk6UVoc5WR2PZ2BN ZazQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=pqiaBONWejVXpbQID4IPVbkteKp9pWdVQYTe5hiljPo=; b=YW1znVCPGxzvV1oNDD63f3ZBuqNixVYh4PFfLiHa2SwKEvWcDtW1IM6J/GojTMOUrM ma61pQTAw77vX0ndzY6mK3xqiu18QZqFwJJ/H/6hKy9cy11KF3GeQ7EujYKbtumG71I2 xaYwML26zsxri51F2j87IHHuAsDvTzG9/WeGubR5DI+DpvQsUMDntSac+/VrDHol1giU d/GAdvj548FkEUvZ2LsMptffrS051E+uMqowveFgsXOVW42v/cCkAkspMYQ/c2q3yjAx lR6CfOFWCzBpHMKXcdnqP23/Fn9weZSJTY/6XX4+ENfeIkqI0a/lTTckZpsMxpbFZWQC Dtrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@8bytes.org header.s=mail-1 header.b=ThGLCYxo; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b78-v6si2464978pfk.342.2018.07.20.10.49.49; Fri, 20 Jul 2018 10:50:08 -0700 (PDT) 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=fail (test mode) header.i=@8bytes.org header.s=mail-1 header.b=ThGLCYxo; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388451AbeGTSiH (ORCPT + 99 others); Fri, 20 Jul 2018 14:38:07 -0400 Received: from 8bytes.org ([81.169.241.247]:38372 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388126AbeGTSiH (ORCPT ); Fri, 20 Jul 2018 14:38:07 -0400 Received: by theia.8bytes.org (Postfix, from userid 1000) id 5F13A450; Fri, 20 Jul 2018 19:48:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=8bytes.org; s=mail-1; t=1532108926; bh=85PPMjOMK5DOxznIfBJl+ArmoPBZQJXSuXzoGltc1Fw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ThGLCYxoEck0Z+Xro96+rPC2t1h3F0z3dSacDbzK5HeRwPTtU08f4OsV/hqF6Avui 6uRk1L9APGnYsUgJ7x/xjiMMqPZOo+t8fRcLr9A1SeZdWg2Q8/1rb9y3WoL+RgItpg MZKMx8t9SPnC4/AGHIA7VTQtW+nSgx1OupDipsBkdkgAMTyl+bLpugCO58amAu2Dn9 ds/iGFeVfvVYL3m7JfXWBOgL8FX3qNA5k016LJf1I4pFWnRCHBeWiVKJZknUoSFhnT LbKY2bFOGBmJ9cDzC3gb8iGQ+/0no3kxKyRcct8af8OOq7TcfRhR8ZSm2q0p8fh4Wm IOLMLUwGyr/9w== Date: Fri, 20 Jul 2018 19:48:46 +0200 From: Joerg Roedel To: Andy Lutomirski Cc: Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" , X86 ML , LKML , Linux-MM , Linus Torvalds , Dave Hansen , Josh Poimboeuf , Juergen Gross , Peter Zijlstra , Borislav Petkov , Jiri Kosina , Boris Ostrovsky , Brian Gerst , David Laight , Denys Vlasenko , Eduardo Valentin , Greg KH , Will Deacon , "Liguori, Anthony" , Daniel Gruss , Hugh Dickins , Kees Cook , Andrea Arcangeli , Waiman Long , Pavel Machek , "David H . Gutteridge" , Joerg Roedel , Arnaldo Carvalho de Melo , Alexander Shishkin , Jiri Olsa , Namhyung Kim Subject: Re: [PATCH 1/3] perf/core: Make sure the ring-buffer is mapped in all page-tables Message-ID: <20180720174846.GF18541@8bytes.org> References: <1532103744-31902-1-git-send-email-joro@8bytes.org> <1532103744-31902-2-git-send-email-joro@8bytes.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 20, 2018 at 10:06:54AM -0700, Andy Lutomirski wrote: > > On Jul 20, 2018, at 6:22 AM, Joerg Roedel wrote: > > > > From: Joerg Roedel > > > > The ring-buffer is accessed in the NMI handler, so we better > > avoid faulting on it. Sync the vmalloc range with all > > page-tables in system to make sure everyone has it mapped. > > > > This fixes a WARN_ON_ONCE() that can be triggered with PTI > > enabled on x86-32: > > > > WARNING: CPU: 4 PID: 0 at arch/x86/mm/fault.c:320 vmalloc_fault+0x220/0x230 > > > > This triggers because with PTI enabled on an PAE kernel the > > PMDs are no longer shared between the page-tables, so the > > vmalloc changes do not propagate automatically. > > It seems like it would be much more robust to fix the vmalloc_fault() > code instead. The question is whether the NMI path is nesting-safe, then we can remove the WARN_ON_ONCE(in_nmi()) in the vmalloc_fault path. It should be nesting-safe on x86-32 because of the way the stack-switch happens there. If its also nesting-safe on x86-64 the warning there can be removed. Or did you think of something else to fix there? Thanks, Joerg