Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp3929782imm; Mon, 8 Oct 2018 11:51:55 -0700 (PDT) X-Google-Smtp-Source: ACcGV630UNfHHfZ7ihOZAyQ28XPgta4EEQjqde+0ciJeaWMJCZSJ5DiDh17erpDzjGd6M6Nb9SRn X-Received: by 2002:a17:902:6501:: with SMTP id b1-v6mr25319150plk.31.1539024715265; Mon, 08 Oct 2018 11:51:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539024715; cv=none; d=google.com; s=arc-20160816; b=QYbclAyf5fS0sltothTfM3gGr2pW1q27ZGlUJf7Yt5nHamps5V4xds4WJ0DNKiQyFn zHPXHZn8WyRwqMw68ypal8TeGFsDOco2+UhN1hU14RmviDE6h0jvULW+phYNIhTuY1wa Mrvs3Jf4AZZl4n7VQ6+v1z6GoeuZsYEFKb5IgBNWoT58gjEdH9Xyj15QbVcynsCKAS99 yJTbaw6k6SgnIYIDh66YRX88H7Qp24L/auz9+MJA3MLdJkV0m7BSSVfQ3AVtECqd9Oe+ zEmnWmmgsLYWwt+tOsVOLj+Q55qyV5HFX24PsO/aSrV/EQEsIkxAhnJyBVkpJlJ+08G3 KkPw== 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=4YdQPJZ7O051SXIed2YxshG2/ZB2cth9dJo5pjyrpA4=; b=nIlux9NBAtya5kzjrO866Y0iuzjCBkwopWS/PpPkT055MVpBuuFk+yptGL3Dbkv8FC nBwqrZONc43pvE010vDK/JjsE1M1ytgRArQ/EH/hEUnlBYV66jBqha4eVv8GWv9ijbAs pDhWp86b1NcU4/fK9/Es8qS1iLG2VhhIesOj58OdvF1OIW0VC6erM1ko2ePJLGhI/W9u NQZTMM+WX9dGfTmQSqyOabkdZXE9VZ+vvkoRgQeEGJW5R1Ovo/P8DK3a6P+AQuckbeYB RlA4kbJ+JcMcWSm+ERs5QLdJSmcIl3vY0hoW0py00CkIhbQZ9JQlaRaNm418y5p1Cgpw Yn/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Sicqm2L+; 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 a15-v6si18763534pfn.248.2018.10.08.11.51.40; Mon, 08 Oct 2018 11:51:55 -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=@kernel.org header.s=default header.b=Sicqm2L+; 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 S1732360AbeJICEm (ORCPT + 99 others); Mon, 8 Oct 2018 22:04:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:54612 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731723AbeJICEl (ORCPT ); Mon, 8 Oct 2018 22:04:41 -0400 Received: from localhost (ip-213-127-77-176.ip.prioritytelecom.net [213.127.77.176]) (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 55B52204FD; Mon, 8 Oct 2018 18:51:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539024693; bh=/zo+l7xZlKZ1jIA+SskN4XLPAqvWUIyi1quBA2ne7cI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Sicqm2L+wexUVa9f2wu0yFROZAAeEz1imteZLfxB2DwoeUJc+lvTvxml3cbS1PQgl lGJPd4jZHoGZmxlv74jAMfSPm/P5TgXL22uNCStIxrMVVkWMq2fJoIR4T4LWpgYWmJ ywQmSqWohiIJe3DobHp51MKeZejifwhd+A9V/MLg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jacek Tomaka , "Peter Zijlstra (Intel)" , Linus Torvalds , Thomas Gleixner , Ingo Molnar , Sasha Levin Subject: [PATCH 4.18 124/168] perf/x86/intel: Add support/quirk for the MISPREDICT bit on Knights Landing CPUs Date: Mon, 8 Oct 2018 20:31:44 +0200 Message-Id: <20181008175624.760053711@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181008175620.043587728@linuxfoundation.org> References: <20181008175620.043587728@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review 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.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jacek Tomaka [ Upstream commit 16160c1946b702dcfa95ef63389a56deb2f1c7cb ] Problem: perf did not show branch predicted/mispredicted bit in brstack. Output of perf -F brstack for profile collected Before: 0x4fdbcd/0x4fdc03/-/-/-/0 0x45f4c1/0x4fdba0/-/-/-/0 0x45f544/0x45f4bb/-/-/-/0 0x45f555/0x45f53c/-/-/-/0 0x7f66901cc24b/0x45f555/-/-/-/0 0x7f66901cc22e/0x7f66901cc23d/-/-/-/0 0x7f66901cc1ff/0x7f66901cc20f/-/-/-/0 0x7f66901cc1e8/0x7f66901cc1fc/-/-/-/0 After: 0x4fdbcd/0x4fdc03/P/-/-/0 0x45f4c1/0x4fdba0/P/-/-/0 0x45f544/0x45f4bb/P/-/-/0 0x45f555/0x45f53c/P/-/-/0 0x7f66901cc24b/0x45f555/P/-/-/0 0x7f66901cc22e/0x7f66901cc23d/P/-/-/0 0x7f66901cc1ff/0x7f66901cc20f/P/-/-/0 0x7f66901cc1e8/0x7f66901cc1fc/P/-/-/0 Cause: As mentioned in Software Development Manual vol 3, 17.4.8.1, IA32_PERF_CAPABILITIES[5:0] indicates the format of the address that is stored in the LBR stack. Knights Landing reports 1 (LBR_FORMAT_LIP) as its format. Despite that, registers containing FROM address of the branch, do have MISPREDICT bit but because of the format indicated in IA32_PERF_CAPABILITIES[5:0], LBR did not read MISPREDICT bit. Solution: Teach LBR about above Knights Landing quirk and make it read MISPREDICT bit. Signed-off-by: Jacek Tomaka Signed-off-by: Peter Zijlstra (Intel) Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Link: http://lkml.kernel.org/r/20180802013830.10600-1-jacekt@dugeo.com Signed-off-by: Ingo Molnar Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- arch/x86/events/intel/lbr.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/arch/x86/events/intel/lbr.c +++ b/arch/x86/events/intel/lbr.c @@ -1250,4 +1250,8 @@ void intel_pmu_lbr_init_knl(void) x86_pmu.lbr_sel_mask = LBR_SEL_MASK; x86_pmu.lbr_sel_map = snb_lbr_sel_map; + + /* Knights Landing does have MISPREDICT bit */ + if (x86_pmu.intel_cap.lbr_format == LBR_FORMAT_LIP) + x86_pmu.intel_cap.lbr_format = LBR_FORMAT_EIP_FLAGS; }