From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Cyrus-Session-Id: sloti22d1t05-3707328-1516020746-2-581897854444283810 X-Sieve: CMU Sieve 3.0 X-Spam-known-sender: no X-Spam-score: 0.0 X-Spam-hits: BAYES_00 -1.9, RCVD_IN_DNSWL_MED -2.3, SPF_HELO_PASS -0.001, SPF_PASS -0.001, T_RP_MATCHES_RCVD -0.01, LANGUAGES en, BAYES_USED global, SA_VERSION 3.4.0 X-Spam-source: IP='140.211.169.12', Host='mail.linuxfoundation.org', Country='US', FromHeader='org', MailFrom='org' X-Spam-charsets: cc='UTF-8', plain='UTF-8' X-Resolved-to: greg@kroah.com X-Delivered-to: greg@kroah.com X-Mail-from: gregkh@linuxfoundation.org ARC-Seal: i=1; a=rsa-sha256; cv=none; d=messagingengine.com; s=arctest; t=1516020745; b=QXS91Ci8MTpuVXAbHgIzdp0WL+x7axzJxajLGfB0iD5hxRg k4t4tPASfmiongfZ/jd9tykSNxZlNLpOc4bv3PT5GUhG52nS+gVxYwq0JkyRBt4f 9vyH3NTFLjC8gcXRNqPUaxu67691d75YRbo4f92fQPKSVDZAqfNYXE4CndfFEgRK x99iht2srqnbAPAJnNAQjjQuQipWBcdln0BxcI268etTQII6bsRayHI4lBzJ16Nj 2CiYeXaEoKCURtjcVqcG45+9EsIux5r7Ohw6PV4t3hJTNKZKE/ILdp6O77m78oFZ ZvLP1EHKsdiMZmprfTEAm05UPfox5Al7RQlo/Uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-type; s=arctest; t= 1516020745; bh=IRCPqA9vV0y/dK77CJ/VNbo6t7rzxlyn7Q2cSHDWFYM=; b=t RrtudxLd44WWuTBCzCRli5PdUbd2cRJ99N2wC23w8ClAJ7O7TjLVWno3LN48adKo HSMsWO29o0ws3tQj2UDptOBAp6j7RULAytlXunXaxbxjclWjqju8VcQGJ90zKBz1 nkSVwTyh1+ezekUnrdGgFifjP9R+vVgyOSu6K2muS2EoYw2QJ2AY95Mnbnlqb5Gp jH9EVibjxMsALezO96DY/Yg+2OAbuoLgIPv5b8tQf52tn5sTUNSJ+m3HDgg1/AL2 K/KXKTc9g6Y7ZA0SCbJ0HjDpVbpPnN1OWG5sqvyUwtDJakSfJ/4HfPHwf4JZBZx9 Z3mVOgfrYO/jlt60zOVsw== ARC-Authentication-Results: i=1; mx1.messagingengine.com; arc=none (no signatures found); dkim=none (no signatures found); dmarc=none (p=none,d=none) header.from=linuxfoundation.org; iprev=pass policy.iprev=140.211.169.12 (mail.linuxfoundation.org); spf=pass smtp.mailfrom=gregkh@linuxfoundation.org smtp.helo=mail.linuxfoundation.org; x-aligned-from=pass; x-ptr=pass x-ptr-helo=mail.linuxfoundation.org x-ptr-lookup=mail.linuxfoundation.org; x-return-mx=pass smtp.domain=linuxfoundation.org smtp.result=pass smtp_is_org_domain=yes header.domain=linuxfoundation.org header.result=pass header_is_org_domain=yes; x-tls=pass version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128 Authentication-Results: mx1.messagingengine.com; arc=none (no signatures found); dkim=none (no signatures found); dmarc=none (p=none,d=none) header.from=linuxfoundation.org; iprev=pass policy.iprev=140.211.169.12 (mail.linuxfoundation.org); spf=pass smtp.mailfrom=gregkh@linuxfoundation.org smtp.helo=mail.linuxfoundation.org; x-aligned-from=pass; x-ptr=pass x-ptr-helo=mail.linuxfoundation.org x-ptr-lookup=mail.linuxfoundation.org; x-return-mx=pass smtp.domain=linuxfoundation.org smtp.result=pass smtp_is_org_domain=yes header.domain=linuxfoundation.org header.result=pass header_is_org_domain=yes; x-tls=pass version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128 From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vince Weaver , =?UTF-8?q?Robert=20=C5=9Awi=C4=99cki?= , "Peter Zijlstra (Intel)" , Thomas Gleixner , Alexander Shishkin , greg@kroah.com, hughd@google.com, luto@amacapital.net, Vince Weaver , torvalds@linux-foundation.org Subject: [PATCH 4.14 117/118] x86,perf: Disable intel_bts when PTI Date: Mon, 15 Jan 2018 13:35:44 +0100 Message-Id: <20180115123422.312457537@linuxfoundation.org> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180115123415.325497625@linuxfoundation.org> References: <20180115123415.325497625@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-getmail-retrieved-from-mailbox: INBOX X-Mailing-List: linux-kernel@vger.kernel.org List-ID: 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Peter Zijlstra commit 99a9dc98ba52267ce5e062b52de88ea1f1b2a7d8 upstream. The intel_bts driver does not use the 'normal' BTS buffer which is exposed through the cpu_entry_area but instead uses the memory allocated for the perf AUX buffer. This obviously comes apart when using PTI because then the kernel mapping; which includes that AUX buffer memory; disappears. Fixing this requires to expose a mapping which is visible in all context and that's not trivial. As a quick fix disable this driver when PTI is enabled to prevent malfunction. Fixes: 385ce0ea4c07 ("x86/mm/pti: Add Kconfig") Reported-by: Vince Weaver Reported-by: Robert Święcki Signed-off-by: Peter Zijlstra (Intel) Signed-off-by: Thomas Gleixner Cc: Alexander Shishkin Cc: greg@kroah.com Cc: hughd@google.com Cc: luto@amacapital.net Cc: Vince Weaver Cc: torvalds@linux-foundation.org Cc: stable@vger.kernel.org Link: https://lkml.kernel.org/r/20180114102713.GB6166@worktop.programming.kicks-ass.net Signed-off-by: Greg Kroah-Hartman --- arch/x86/events/intel/bts.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) --- a/arch/x86/events/intel/bts.c +++ b/arch/x86/events/intel/bts.c @@ -582,6 +582,24 @@ static __init int bts_init(void) if (!boot_cpu_has(X86_FEATURE_DTES64) || !x86_pmu.bts) return -ENODEV; + if (boot_cpu_has(X86_FEATURE_PTI)) { + /* + * BTS hardware writes through a virtual memory map we must + * either use the kernel physical map, or the user mapping of + * the AUX buffer. + * + * However, since this driver supports per-CPU and per-task inherit + * we cannot use the user mapping since it will not be availble + * if we're not running the owning process. + * + * With PTI we can't use the kernal map either, because its not + * there when we run userspace. + * + * For now, disable this driver when using PTI. + */ + return -ENODEV; + } + bts_pmu.capabilities = PERF_PMU_CAP_AUX_NO_SG | PERF_PMU_CAP_ITRACE | PERF_PMU_CAP_EXCLUSIVE; bts_pmu.task_ctx_nr = perf_sw_context;