From patchwork Fri Jul 12 12:19:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 168941 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp820815ilk; Fri, 12 Jul 2019 05:29:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqwDHgfkeXJ4Ksg5dHgMz68Qw0HJBXBqyJbxS6v3o5zOQlZTbkB8JCwmQBnHF/NWvHVlxYQo X-Received: by 2002:a17:902:3081:: with SMTP id v1mr11402042plb.169.1562934586405; Fri, 12 Jul 2019 05:29:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562934586; cv=none; d=google.com; s=arc-20160816; b=OnJtOajOCTB2fwpafuVAwAtqjrlXe+wOZ8M79RhZbKnhWjIIgXpqOh8qW2oZoUyosl HYmH+jcGHBpaDsvwWYyubzCwsA8bEP+ZG3QiKK1rp15z5eaWt5uTMMBbrdqaxNC2jqSE Dgk11xArkeM0eaW/Ft802dbZKOsSOtKgyaz3j0a/DKnMTlknQLKZJ2FM/a1SzLrUXY+P 3itXY4cFTFMj65pKokocOvxdTFJHjafPqiQxgM2Pcm1GRCuel+MAXLUSr2kUtHdIfgFU T1HqaxR3e0Q+NMcbRuAca3iT5K50sVoHgRY0E5bTaQppDhxXGE/oGqYI89plmbvI2wFU bX0g== 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=11Dyiqec6wajqzSgTGwsUd9OrMe5kuwDmKQla8lUMdk=; b=IC8J2gqQMuTgvt8QVbeWtyc7rxgPNm2kYu7Sw9DXAhhl62W4t+Gtb8GG2Pj8M5JSkm CebVym22h2cSh2oXXc9wIQVyzt2/Hwp6J6aRh1Y/VLEYtICW4iaS2zksWZeIBjOLF1sL 0yPz+T2LRoidg14MZ9JHUrw45edU1mxhuaGuSPmEO6M0lXLoMzPqqhG994NU5CXlLDD0 y5jVvZg+zbwU7PkYcqBx2sn0dHloBssHx1y7S7RuvaRJNuM6cMVFmuFETcX9x7xqwbqk ieEDhuYaukAZphHb885Yj2GMuXpobc0IdxYptR2P8BgxAhmvMS4ey3BCGzAHgQr1ZROM 6Aww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=HlZ6YAsk; 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 v16si8368635pfi.142.2019.07.12.05.29.42; Fri, 12 Jul 2019 05:29:46 -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=HlZ6YAsk; 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 S1729016AbfGLM3h (ORCPT + 29 others); Fri, 12 Jul 2019 08:29:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:44414 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728435AbfGLM3b (ORCPT ); Fri, 12 Jul 2019 08:29:31 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 6DEE02084B; Fri, 12 Jul 2019 12:29:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562934570; bh=dqGDFDIi2rDPmFMdQfVLnotYxhySOqw8XaoV8MfvQW0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HlZ6YAsk3Xx9CSqYc06bvq11lgcRqzLIjr7gbNUOZ7ji+z5csg6tGZOKhBY+E8EA6 XOgRXdG2v+Lmz4cKlTzW8n/G2KZ2IOdtxNAqJZWQPi3aw8/07ffZ9lQV0Rb3990/a7 6j56BlcqHHe1Y4McfremD3hq2v4IMkiZKC0N/560= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, John Garry , Alexander Shishkin , Ben Hutchings , Hendrik Brueckner , Jiri Olsa , Kan Liang , Mark Rutland , Mathieu Poirier , Namhyung Kim , Peter Zijlstra , Shaokun Zhang , Thomas Richter , Will Deacon , linux-arm-kernel@lists.infradead.org, linuxarm@huawei.com, Arnaldo Carvalho de Melo Subject: [PATCH 5.1 099/138] perf pmu: Fix uncore PMU alias list for ARM64 Date: Fri, 12 Jul 2019 14:19:23 +0200 Message-Id: <20190712121632.564396373@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190712121628.731888964@linuxfoundation.org> References: <20190712121628.731888964@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: John Garry commit 599ee18f0740d7661b8711249096db94c09bc508 upstream. In commit 292c34c10249 ("perf pmu: Fix core PMU alias list for X86 platform"), we fixed the issue of CPU events being aliased to uncore events. Fix this same issue for ARM64, since the said commit left the (broken) behaviour untouched for ARM64. Signed-off-by: John Garry Cc: Alexander Shishkin Cc: Ben Hutchings Cc: Hendrik Brueckner Cc: Jiri Olsa Cc: Kan Liang Cc: Mark Rutland Cc: Mathieu Poirier Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Shaokun Zhang Cc: Thomas Richter Cc: Will Deacon Cc: linux-arm-kernel@lists.infradead.org Cc: linuxarm@huawei.com Cc: stable@vger.kernel.org Fixes: 292c34c10249 ("perf pmu: Fix core PMU alias list for X86 platform") Link: http://lkml.kernel.org/r/1560521283-73314-2-git-send-email-john.garry@huawei.com Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Greg Kroah-Hartman --- tools/perf/util/pmu.c | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) --- a/tools/perf/util/pmu.c +++ b/tools/perf/util/pmu.c @@ -709,9 +709,7 @@ static void pmu_add_cpu_aliases(struct l { int i; struct pmu_events_map *map; - struct pmu_event *pe; const char *name = pmu->name; - const char *pname; map = perf_pmu__find_map(pmu); if (!map) @@ -722,28 +720,26 @@ static void pmu_add_cpu_aliases(struct l */ i = 0; while (1) { + const char *cpu_name = is_arm_pmu_core(name) ? name : "cpu"; + struct pmu_event *pe = &map->table[i++]; + const char *pname = pe->pmu ? pe->pmu : cpu_name; - pe = &map->table[i++]; if (!pe->name) { if (pe->metric_group || pe->metric_name) continue; break; } - if (!is_arm_pmu_core(name)) { - pname = pe->pmu ? pe->pmu : "cpu"; + /* + * uncore alias may be from different PMU + * with common prefix + */ + if (pmu_is_uncore(name) && + !strncmp(pname, name, strlen(pname))) + goto new_alias; - /* - * uncore alias may be from different PMU - * with common prefix - */ - if (pmu_is_uncore(name) && - !strncmp(pname, name, strlen(pname))) - goto new_alias; - - if (strcmp(pname, name)) - continue; - } + if (strcmp(pname, name)) + continue; new_alias: /* need type casts to override 'const' */ From patchwork Fri Jul 12 12:19:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 168943 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp824429ilk; Fri, 12 Jul 2019 05:32:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqwQu1LqyYsO6p35HVh/pgaM2qVP16LOrJQrYyi+xGuFaeCTtLTGos8o8VbFBybfTi6pRpLU X-Received: by 2002:a63:181:: with SMTP id 123mr10862049pgb.63.1562934755284; Fri, 12 Jul 2019 05:32:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562934755; cv=none; d=google.com; s=arc-20160816; b=Az7QaYOOuNpRoDEg6aXTJZhYokD8sESUVYIEnGZrpnKgEhMo7ELcneAYRSa2VWNYpN Xh0VKx8gZg+5zb/0lLsXCCiIaf3ywhe+9/OtqMZaQMNbMe3AzfVXDZl8qKBZnCGmT+AL HSYlD3S4JHSA/bMXpz4CfNMD5vC3sNeN1X+ZU4uAzWtXFmBsOWyPryy0t2Z4l3YD3oRU 9PALyvp8NHDlNHnlIBAt/MySe5Pl0F+ozf1ZOAA6yMWKRIL9HGbyUl7eZMSTkwIWvxqa Z/wcOLZkX59XHwPwYK+u7mEZzzoXdqu0YNqCk6J2oFf84icRgSIV8zHQn+kTG+YTTUWf Skjw== 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=EvGskLrLl3F9kyli8z/7m15SNEiqGHGVXp7u7JiAsFQ=; b=suc8UgqZoMUGVFgkhDOyNepKTxClo3hHD76ckX5cm3Y2gxGRPgGTHr0C1jeM0RHP5L qCIlPg7QIk/mBMoxnxnrXFqOiN4XfK/EL0D62fQpZNdIcUAsKM3JpvN4xSfOdhvH3g/n TjYUwXFlpBapzlAs5xsUsYeNbF3MnSIaFPmlh9UVno2AI0UHvbDeszD6vM7zXuj5Q8BQ MWyaw7EHjiNnmukmwPzyStHqp0RH2Nxw9P+B9fXuB4ZVRty+rS6JzpTpElxefOfaVBFI CBB/PJ7/i5myblyNYCdNqNNiK3JKkeadHQNKCTlNyIkwxj9upxKf5olYUdwUcipyG41z ckPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=VAyvRIPH; 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 v16si8368635pfi.142.2019.07.12.05.32.31; Fri, 12 Jul 2019 05:32:35 -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=VAyvRIPH; 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 S1729365AbfGLMbo (ORCPT + 29 others); Fri, 12 Jul 2019 08:31:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:48672 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729356AbfGLMbm (ORCPT ); Fri, 12 Jul 2019 08:31:42 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 25347208E4; Fri, 12 Jul 2019 12:31:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562934701; bh=b30BjwC86bSBzRsL0WzOkPFpGQCDV3H1PobzYZ/QOtE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VAyvRIPHrEBLAke4ovRUlshhpe/kH4kuG3gf0zJN1clDKQyKK+ZWgwRSjHAeppryR X4HwkWkvydoGCsXBqIKIEsWpLrWpfyWHTUvOqlObEuWde8sVfTZYRPxwVAlRXqNwva Xtp5f9NxhOVEwGW3eQZ+m9/Ib+B/w4YmWHTtRKaw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nathan Chancellor , Alan Modra , Jordan Rupprect , Kees Cook , Nick Desaulniers Subject: [PATCH 5.1 124/138] lkdtm: support llvm-objcopy Date: Fri, 12 Jul 2019 14:19:48 +0200 Message-Id: <20190712121633.497228796@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190712121628.731888964@linuxfoundation.org> References: <20190712121628.731888964@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Nick Desaulniers commit e9e08a07385e08f1a7f85c5d1e345c21c9564963 upstream. With CONFIG_LKDTM=y and make OBJCOPY=llvm-objcopy, llvm-objcopy errors: llvm-objcopy: error: --set-section-flags=.text conflicts with --rename-section=.text=.rodata Rather than support setting flags then renaming sections vs renaming then setting flags, it's simpler to just change both at the same time via --rename-section. Adding the load flag is required for GNU objcopy to mark .rodata Type as PROGBITS after the rename. This can be verified with: $ readelf -S drivers/misc/lkdtm/rodata_objcopy.o ... Section Headers: [Nr] Name Type Address Offset Size EntSize Flags Link Info Align ... [ 1] .rodata PROGBITS 0000000000000000 00000040 0000000000000004 0000000000000000 A 0 0 4 ... Which shows that .text is now renamed .rodata, the alloc flag A is set, the type is PROGBITS, and the section is not flagged as writeable W. Cc: stable@vger.kernel.org Link: https://sourceware.org/bugzilla/show_bug.cgi?id=24554 Link: https://github.com/ClangBuiltLinux/linux/issues/448 Reported-by: Nathan Chancellor Suggested-by: Alan Modra Suggested-by: Jordan Rupprect Suggested-by: Kees Cook Acked-by: Kees Cook Reviewed-by: Nathan Chancellor Signed-off-by: Nick Desaulniers Signed-off-by: Greg Kroah-Hartman --- drivers/misc/lkdtm/Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/drivers/misc/lkdtm/Makefile +++ b/drivers/misc/lkdtm/Makefile @@ -15,8 +15,7 @@ KCOV_INSTRUMENT_rodata.o := n OBJCOPYFLAGS := OBJCOPYFLAGS_rodata_objcopy.o := \ - --set-section-flags .text=alloc,readonly \ - --rename-section .text=.rodata + --rename-section .text=.rodata,alloc,readonly,load targets += rodata.o rodata_objcopy.o $(obj)/rodata_objcopy.o: $(obj)/rodata.o FORCE $(call if_changed,objcopy)