Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3329174imm; Fri, 20 Jul 2018 14:37:54 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcUSfKAbQTAA9xeSJjOcvJjX6AzhRf/92imXp3sSUme1mO9Wt6dv1V0hsrFX3662ws6iJ7A X-Received: by 2002:a17:902:a716:: with SMTP id w22-v6mr3532302plq.271.1532122674884; Fri, 20 Jul 2018 14:37:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532122674; cv=none; d=google.com; s=arc-20160816; b=I8r1dNb+/qmJwDn5i8B+XaJTbXC10ZPtX9ndOJvQLIHyrrWSvP9n+GkhGwchlasKCz lVTIhs8Pn8AAJ7/oyfSrQTFp8jfLvotY5XnIAPaOWkAPLfi3e8CAZJILW6gg/xr1uLWx Yg//tFawfKgqBHSrGBE+BpngoCr/8WqgNPnzna3AS4qmbHP/DVJzvvU0cbWJgIDuQ/Ox w/LYkLeuzgYro+fmy9pztLKIBwc14niYO2ZoJYERj6DJaqNDTnGbX2utbcug2PS9yU3p DDGi7fx1UxhRv2dDVLT6ldp8ihMPa2D5a0pesv0oQCIm/sSjPeB7uSSJI7jwZuyXecEG DgKw== 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:arc-authentication-results; bh=qT95oRKE9qfrPPHcnwcBaQ451hsNnvDqevexD7rrGxs=; b=yGgZBGSuHnzLCHz8vyeG8b2M9Y3vdVfWrrzitlpnIsZ1yBprdJilVf4+UCgPXmTuWp q9qrwGQcaGGwiHgq6w9B+g5lYRfkC5+kLpMFjibI0/snRMXu+hKYBiyugpQ7qVNN0jUe XZuEgmLK3rCrc+gBjtlS4wOHGa7KPiPwqkzjMjqBTpSFFm4s6GPqLn6ud178bQkdf2vT kc/Acc7o2JrnsCID1RvLU8p5jNOqCQSsoKoufA4xRnBJrmYfUQZKvT7e2IKuslP0BZXC sCTir5O8vFpS0ErQ89XPrtrS3DkYYuXNUvdDZe8rfqp0XuPO01VkJeo37Z2wP+5MkR5R KARA== ARC-Authentication-Results: i=1; mx.google.com; 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 j1-v6si2413215pll.493.2018.07.20.14.37.39; Fri, 20 Jul 2018 14:37:54 -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; 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 S1728706AbeGTW1L (ORCPT + 99 others); Fri, 20 Jul 2018 18:27:11 -0400 Received: from mx2.suse.de ([195.135.220.15]:37400 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727412AbeGTW1K (ORCPT ); Fri, 20 Jul 2018 18:27:10 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id DC5EEACFB; Fri, 20 Jul 2018 21:37:02 +0000 (UTC) Date: Fri, 20 Jul 2018 23:37:00 +0200 From: Joerg Roedel To: Andy Lutomirski Cc: Joerg Roedel , 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" , 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: <20180720213700.gh6d2qd2ck6nt4ax@suse.de> References: <1532103744-31902-1-git-send-email-joro@8bytes.org> <1532103744-31902-2-git-send-email-joro@8bytes.org> <20180720174846.GF18541@8bytes.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170421 (1.8.2) 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 12:32:10PM -0700, Andy Lutomirski wrote: > I'm just reading your changelog, and you said the PMDs are no longer > shared between the page tables. So this presumably means that > vmalloc_fault() no longer actually works correctly on PTI systems. I > didn't read the code to figure out *why* it doesn't work, but throwing > random vmalloc_sync_all() calls around is wrong. Hmm, so the whole point of vmalloc_fault() fault is to sync changes from swapper_pg_dir to process page-tables when the relevant parts of the kernel page-table are not shared, no? That is also the reason we don't see this on 64 bit, because there these parts *are* shared. So with that reasoning vmalloc_fault() works as designed, except that a warning is issued when it's happens in the NMI path. That warning comes from ebc8827f75954 x86: Barf when vmalloc and kmemcheck faults happen in NMI which went into 2.6.37 and was added because the NMI handler were not nesting-safe back then. Reason probably was that the handler on 64 bit has to use an IST stack and a nested NMI would overwrite the stack of the upper handler. We don't have this problem on 32 bit as a nested NMI will not do another stack-switch there. I am not sure about 64 bit, but there is a lot of assembly magic to make NMIs nesting-safe, so I guess the problem should be gone there too. Regards, Joerg