Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp3923617imm; Mon, 8 Oct 2018 11:45:34 -0700 (PDT) X-Google-Smtp-Source: ACcGV63Z8ZWcXe8/VQcW1CTdiDtJ013p751pLz/GgXcGAbMQ+80TcXHLhyA47wYEvGDbglHzagyS X-Received: by 2002:a63:5a0d:: with SMTP id o13-v6mr22351154pgb.267.1539024334313; Mon, 08 Oct 2018 11:45:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539024334; cv=none; d=google.com; s=arc-20160816; b=mGvgFY8rq5FkM+/cHcTmAoT0z1MpcJtGiDquw5D6sJIBUjKwx/1jbnGScqwBavwoGh VAgegE1hCiDk8gbXDxl0p8e8Go5iTyxlgWd5CG2hy+3ryF6JJArHYRG2oimLHKSLRImy tc5kIi0B777043lU9psR82tTZT+vA5qZN7yf+9gtAr+ttfwVgB17NQKDRl9QfWk4dWgs QpqHKfcBH3xnqqBWyvXo509uulKJOnDCfjtKp7mCvy3IE7FW2h36zBNKC8YpOlhff1AP uC+ZWdiZoGWRNe1WoaBnFDv26Z60AKK98eIR6Dql/523aFVLCjxSaAFMWlD1j/9h5WIr foGA== 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=yw9VNJb7fui1sdLHHiFpxx3+oC3FXFshLvPXXJtqoyk=; b=Y8DlxLx9XfjTFIaFeHoN6MR3XLsqtPmS+CFyCYBHHNdkT+8q/OMfnQpwf2qyUiuHx/ vjbQvg+oT1WrDfXSwZ9GXOS8t2SVdu5P+B9dd65VruMsy2iGnUz02sVjLDDQMMwDNctX XdvgsDEKSqR9vSsNoW6H9VzoC9Y8/QymyfibSLyrcz5V5KObgihiyO1lkd8ZQok0Kklr Yg6+4L59+F3lwqYCbR5esS/4iafM0/QM/+H/xfaqCP4VLu9mALKNeIuFHIp/y/oP93qJ H5Wa9UkM7m95rq/paNzI52MZqCC8QQ55skhaBzLp3sXpjIOnORQk1C61+R8/jZDE39py MGeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=iscVHRP6; 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 g5-v6si13899265pgl.419.2018.10.08.11.45.19; Mon, 08 Oct 2018 11:45:34 -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=iscVHRP6; 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 S1730590AbeJIB44 (ORCPT + 99 others); Mon, 8 Oct 2018 21:56:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:44782 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729885AbeJIB4z (ORCPT ); Mon, 8 Oct 2018 21:56:55 -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 EEC1F2087D; Mon, 8 Oct 2018 18:43:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539024230; bh=ANmwA/ALpYI559KNF/EOOSfSdtFokBzGpl3cfiRyeHw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iscVHRP6Mg7FzuStLoRAFoVl0kq6/JTKpjbbbXPnGIfIawC473Eb0Cnj5cpp21n9b Ac7nlLH56/v9Un8OM+CP7snQ5hWTTDOVwIsj6qzK51Iupdg3ie0zk8MlvlFcTPkkEH NhLyu2ZADWh7fQsbcXPoAN2RGqQsvpK7WHOp3/AQ= 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.14 65/94] perf/x86/intel: Add support/quirk for the MISPREDICT bit on Knights Landing CPUs Date: Mon, 8 Oct 2018 20:31:46 +0200 Message-Id: <20181008175609.555414593@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181008175605.067676667@linuxfoundation.org> References: <20181008175605.067676667@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.14-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; }