Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3361434imm; Fri, 20 Jul 2018 15:21:42 -0700 (PDT) X-Google-Smtp-Source: AAOMgpe+PUJfAkWY+T00ixmECYq54GOAlibdyjocr4CBegFjqeg2TyTVJyDJRUJW72FiWg5zbhz7 X-Received: by 2002:a17:902:8f8e:: with SMTP id z14-v6mr3624608plo.139.1532125302731; Fri, 20 Jul 2018 15:21:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532125302; cv=none; d=google.com; s=arc-20160816; b=P3t0GcYl6SFMiZOf+GtHGuWBPJWzx0LxqgyN7gdaSSf7mkO38Q4LDBXMKvQ2YVs2UA mzU0glMP6aVoIaU8QJXGrh2mM/oRs1s1IhdOERtgNlBsDh4noSbEh5xvf5/3KNkEUJHo X+oHoZNG8+7LDHxWrz6jYx8Y6PEm2Sv2OAyu0yjjQk349uiWUELgRZ7LqDYVTLuOUZVz W4rgOVIqX39ddjqVdIIChhuVdycoaUohgTGI22g7dGytaXVLTVlYoDYJkmsJ/kYHBhCJ l36bFW9eQytJh/4GimOhKcco68U97i6ifCeHfoFy2VJVuwyLZ4Aiuq0N7aYzaVqDxr2c +JQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature:arc-authentication-results; bh=jOEkLYXr9tHhZqe36sS26gXuMIDwzLc8OryBqDYo7Ls=; b=mQ6ELyViQPdB5NcAFZf1kpM2BcBGlqjuMymmmO700dFzeeL/lYh/CSqjYO8vmf2mTa OAo5pri7oS/Hjr+l5lRMRhhLUqjTbC2s42h0T1At7pREFcMz0N9JD+CZ6e/0WeAqhvJ5 F/IxNAEUgCfdNL9oTJM2GiB18zjfhTFfia54ZlpV6x4hrFDCa+hGBN4f2dUCYLcC37ld 1eberKjueHUvCwrYCrcZSIsiKF2eGrEVH7peqt2IQAYLrFWToGD34GoXXLmo55mjeog+ DHCrtBVo+mfua46iGXxgkByNig9iutrk+UFCfp3MgN6MQWgbEJFoz6tKxDbXXIWADy38 xhYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=hlArz64c; 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 t189-v6si2913000pgb.440.2018.07.20.15.21.28; Fri, 20 Jul 2018 15:21:42 -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=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=hlArz64c; 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 S1730010AbeGTXKn (ORCPT + 99 others); Fri, 20 Jul 2018 19:10:43 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:35180 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728297AbeGTXKn (ORCPT ); Fri, 20 Jul 2018 19:10:43 -0400 Received: by mail-pg1-f195.google.com with SMTP id e6-v6so7936404pgv.2 for ; Fri, 20 Jul 2018 15:20:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amacapital-net.20150623.gappssmtp.com; s=20150623; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=jOEkLYXr9tHhZqe36sS26gXuMIDwzLc8OryBqDYo7Ls=; b=hlArz64cbo9kTip7u4B3ayORsmjaDiPEl9jayNpPMfTlJQE8GErvaQM3E3qvATHW2l Fc6mEsYmnSBNiT9Ah3aYmrinDGuWHxn+xc4HFHAoDH54l3yz0e0iw9v83ROzEcqBbI4O PPVpclnSVG/Wt/+V/aFeJ2tsgGQl8f5VCL4FXPjaYoRDlqHEAqOjd4+JfD2qmVNXz9vn BccHOjlQcWosLuremRFKYBk0c3QKK1pucfHi6k8sh2u78WADYC3AHWrb8lKGIsj15bBC tBlPijx5nmwJEAfkp2QJvk6YuvVdEdFwWbnOHEBvzNRgqiyO53Cyvvu07IcDMmap8yOk mbQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=jOEkLYXr9tHhZqe36sS26gXuMIDwzLc8OryBqDYo7Ls=; b=MUHGsP02O6FV3aeKIOPdOkxdDrI6GOGjUL0vnKp7D43YCGGZeUev9qBTzXgQaFTWNV y8ojV0S2IM+7ZuS0ASt+j56eD9whEIUXnORfiZbBQWwrZgMGYyQ0A5FuF8c+ySmSmxBM GFmTEDbTLpVnF21zuxyPg3hLbd6R/2zByzvQi4t1zsQ9jXzTzXbDKJ/XtujThZ3C1pwi 8X1J8PwDDgzkG5dsNLYHNlcxnwr35eu+1wZw9jUkP7ptShDZpXGbbAqVDgEMHDV2qgPf V3MulR+H3iyqipnFk+uLC61TZE2puk2mMDL1LtSy5KMLmWIODPIUIZlvpLgJ61Qhb1KP I7IA== X-Gm-Message-State: AOUpUlHcNv5k4CKBViTmbx62wYL56+fJMzHjWB9BlUs7fjmGd8TahAey lDTItIPJ5R6JPwYejsSVXlxvQQ== X-Received: by 2002:a62:3cd7:: with SMTP id b84-v6mr3852431pfk.183.1532125227629; Fri, 20 Jul 2018 15:20:27 -0700 (PDT) Received: from ?IPv6:2600:1013:b011:182c:6ca7:9bfd:ed3e:df03? ([2600:1013:b011:182c:6ca7:9bfd:ed3e:df03]) by smtp.gmail.com with ESMTPSA id 75-v6sm4781756pfr.115.2018.07.20.15.20.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Jul 2018 15:20:26 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (1.0) Subject: Re: [PATCH 1/3] perf/core: Make sure the ring-buffer is mapped in all page-tables From: Andy Lutomirski X-Mailer: iPhone Mail (15G77) In-Reply-To: <20180720213700.gh6d2qd2ck6nt4ax@suse.de> Date: Fri, 20 Jul 2018 12:20:24 -1000 Cc: Andy Lutomirski , 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 Content-Transfer-Encoding: quoted-printable Message-Id: References: <1532103744-31902-1-git-send-email-joro@8bytes.org> <1532103744-31902-2-git-send-email-joro@8bytes.org> <20180720174846.GF18541@8bytes.org> <20180720213700.gh6d2qd2ck6nt4ax@suse.de> To: Joerg Roedel Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Jul 20, 2018, at 11:37 AM, Joerg Roedel wrote: >=20 >> 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. >=20 > 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? >=20 > That is also the reason we don't see this on 64 bit, because there these > parts *are* shared. >=20 > 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 >=20 > ebc8827f75954 x86: Barf when vmalloc and kmemcheck faults happen in NMI= >=20 > 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. >=20 Thanks for digging! The problem was presumably that vmalloc_fault() will IR= ET and re-enable NMIs on the way out. But we=E2=80=99ve supported page faul= ts on user memory in NMI handlers on 32-bit and 64-bit for quite a while, an= d it=E2=80=99s fine now. I would remove the warning, re-test, and revert the other patch. The one case we can=E2=80=99t handle in vmalloc_fault() is a fault on a stac= k access. I don=E2=80=99t expect this to be a problem for PTI. It was a prob= lem for CONFIG_VMAP_STACK, though. > 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. >=20 >=20 > Regards, >=20 > Joerg