From patchwork Thu Oct 5 19:04:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Hunter X-Patchwork-Id: 148993 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2016:b0:403:3b70:6f57 with SMTP id fe22csp508521vqb; Thu, 5 Oct 2023 12:06:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH0nVkharwr+WeV7Uc9dc0pZ0caiNMDlUqYTW/6yA3QHstlMaJvGJpIdzs7l5AN49McFgmB X-Received: by 2002:a05:6a20:1607:b0:163:61c:9275 with SMTP id l7-20020a056a20160700b00163061c9275mr6861378pzj.41.1696532815173; Thu, 05 Oct 2023 12:06:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696532815; cv=none; d=google.com; s=arc-20160816; b=AlXKItNXcO/QWOPEdviTVVF0a/IsHy13FrVwFlrSgLyXX2qXeRWpvJVEZErzC5Tx6K 5xrvz7wDxXAFSnZVpemUJepVWy02LLpHbvmWNp/fkeBqX5FKpbJfs9HSzrSNRNQ6Hjsn dZuH7otmj66XGLBhFECN+6E4R37JY4bMKpXlUIMLwkhsKpFEIIMfJYgBjXl/V3E7QaKT Tnfc9a+zfHftm+PlVHmYE+pjkyQoEKs02VvYqq/FnWp3Ns2jyomkSE2HR9Uu9pqHK0T6 pHQ/EPYAIZT0aZr26UmfHbr8wWSjiBAHH4ApRD3BmO2y4YeFi6QFGQgRZYslXYhnwzoE br0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:organization :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=5Rq+PUNdhPPKOn/goOo0uLhrEzdjJllAkQ6WWkpMj+U=; fh=7ueK1huCq2Lf3LMjc8i3Ob70zhQl+8ZRdqYzG6swRYY=; b=s456uUf8LlO/vdiW9miV9txyE8ygtLTOhedEnPZ2eayl9jlRWA+cQvaIgdIjaLRsFG /i8TKf9cfbN55LcNcNqMBPMzh76z77SK37MxzbY4h5aBtvgDXf8328FQPVUTWfIViKGr m7OrZut3II7DkljLwqneBjl4UZgiB8rk7cRKOFf14l1v+WXCurfKRvAKmLZyHc9qLjLT fP1ceXbB7p66V31w5IJr/k9eyVqqUomohgAkNExmvxATF8YvNnGJ62cFmUhwURnUWgPU njsvH3t+Fmzi/P0dJUhmu9eVtFiT41T0p7FuJNfW9jDe/NvDMJh/i6FdDSfcQh4sApNF RQuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=GcXzKhMs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id g21-20020a056a0023d500b0068fee0e95c5si1959655pfc.89.2023.10.05.12.06.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Oct 2023 12:06:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=GcXzKhMs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 7747883CDFEB; Thu, 5 Oct 2023 12:06:50 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229959AbjJETGh (ORCPT + 18 others); Thu, 5 Oct 2023 15:06:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229939AbjJETGf (ORCPT ); Thu, 5 Oct 2023 15:06:35 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B644FEA; Thu, 5 Oct 2023 12:06:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1696532794; x=1728068794; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=dx4bgn3zzTZ9xOLzFW1eBj7lM2vIsla8X5xiYClbPKg=; b=GcXzKhMsdO3FDl35O3GpDpY1GlBXi2Bl2Rl1Mh9wUIB9hAsgBxOJbRHi 0nRfqICQ/fOKoxdu4iwEQFfe6dQ0CY9pM9xSZSqANgUsamLIuFhrT2mbv LsPvTb3PngKBOMLxKhuSDPbIGVQC+gQBIIVlOBBRa7JOf3i6DV1jdKpf0 VmUfeBbtb+sagL+uwE66C/FfmUI+jVNIzfGEmWP1s1Cjz+5OIqETm8XDg 5WXGt1uYDYxc8kK3sS9CvwEuF/1+kxUbCIY9pBgFcnXZwUTj20RRZDGYG pqqnwl/IZmA6JpjQyPF3LwWQ70tnbBL9t6paqFGP3RkQqIBntMzUqlT86 w==; X-IronPort-AV: E=McAfee;i="6600,9927,10854"; a="383488228" X-IronPort-AV: E=Sophos;i="6.03,203,1694761200"; d="scan'208";a="383488228" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Oct 2023 12:05:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10854"; a="999055088" X-IronPort-AV: E=Sophos;i="6.03,203,1694761200"; d="scan'208";a="999055088" Received: from ahunter6-mobl1.ger.corp.intel.com (HELO ahunter-VirtualBox.home\044ger.corp.intel.com) ([10.249.35.8]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Oct 2023 12:05:10 -0700 From: Adrian Hunter To: Arnaldo Carvalho de Melo Cc: Jiri Olsa , Namhyung Kim , Ian Rogers , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Subject: [PATCH 1/5] perf tools: Add get_unaligned_leNN() Date: Thu, 5 Oct 2023 22:04:47 +0300 Message-Id: <20231005190451.175568-2-adrian.hunter@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231005190451.175568-1-adrian.hunter@intel.com> References: <20231005190451.175568-1-adrian.hunter@intel.com> MIME-Version: 1.0 Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Thu, 05 Oct 2023 12:06:50 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778943592910275208 X-GMAIL-MSGID: 1778943592910275208 Add get_unaligned_le16(), get_unaligned_le32 and get_unaligned_le64, same as include/asm-generic/unaligned.h. Use diagnostic pragmas to ignore -Wpacked used by perf build. Signed-off-by: Adrian Hunter --- tools/include/asm-generic/unaligned.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tools/include/asm-generic/unaligned.h b/tools/include/asm-generic/unaligned.h index 47387c607035..9140bb4e16c6 100644 --- a/tools/include/asm-generic/unaligned.h +++ b/tools/include/asm-generic/unaligned.h @@ -6,6 +6,9 @@ #ifndef __TOOLS_LINUX_ASM_GENERIC_UNALIGNED_H #define __TOOLS_LINUX_ASM_GENERIC_UNALIGNED_H +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wpacked" + #define __get_unaligned_t(type, ptr) ({ \ const struct { type x; } __packed *__pptr = (typeof(__pptr))(ptr); \ __pptr->x; \ @@ -19,5 +22,22 @@ #define get_unaligned(ptr) __get_unaligned_t(typeof(*(ptr)), (ptr)) #define put_unaligned(val, ptr) __put_unaligned_t(typeof(*(ptr)), (val), (ptr)) +static inline u16 get_unaligned_le16(const void *p) +{ + return le16_to_cpu(__get_unaligned_t(__le16, p)); +} + +static inline u32 get_unaligned_le32(const void *p) +{ + return le32_to_cpu(__get_unaligned_t(__le32, p)); +} + +static inline u64 get_unaligned_le64(const void *p) +{ + return le64_to_cpu(__get_unaligned_t(__le64, p)); +} + +#pragma GCC diagnostic pop + #endif /* __TOOLS_LINUX_ASM_GENERIC_UNALIGNED_H */ From patchwork Thu Oct 5 19:04:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Hunter X-Patchwork-Id: 148995 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2016:b0:403:3b70:6f57 with SMTP id fe22csp508548vqb; Thu, 5 Oct 2023 12:06:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFlpMcsL1CjcfuMEdW2cfT70+m3qPj+HtAJCWVyl0dIXb994DwC1WCiA/bOE1hf/1dvsoBj X-Received: by 2002:a05:6358:998e:b0:13c:dd43:f741 with SMTP id j14-20020a056358998e00b0013cdd43f741mr5044705rwb.24.1696532818153; Thu, 05 Oct 2023 12:06:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696532818; cv=none; d=google.com; s=arc-20160816; b=ZgB2HgSiHQ71ycjfpg2+bw1MmGpMICJm6kzBYQTX+5snJM8JFTOBTxYAJtoqdRzbJW g/KD91Icuu3WCP0EWgIh3/ulGQfzctEnsaqAVwNdOzb3ZlvNUgPi1TlFP9z2kVcwiKmZ aP2wtEiv62/ZmKAn49VEHzSjG0EQAqE9kPCGhzH8xCid0YayvlOMMY7HO7ZaD/amwGr3 oiPbxtSf8M74HWBLvaT00Ykt7YuzQEPghZCdqDEAjJXgB/JBjSPHXSK3Qj8/WRSDp+0I uIYCAUAYytGa4lTCRzJGQc09ZgNDmxmvk6pClS7yXG+N8riGQAcaF+BCVl701F7ThdDZ yqVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:organization :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=btqmz99wfG9JOl3O+5F6Moxbwbtx+zKY92CxSd0oT5k=; fh=7ueK1huCq2Lf3LMjc8i3Ob70zhQl+8ZRdqYzG6swRYY=; b=Eh7+QzOU865oTkdevHEXr0FJVRv9iPsmKPKw+LJ3FQNnc2+qxab3O3FWRuqDSNSVH0 iFuSQsKBpwZfWKQBH4njPXv9oXAjICwlLre/Fizuz6ACAyS+pkEX4MSV6LOgqsFUtv53 A0YxAdCzjh1tvU9KSvMrZYwh9p9eIpAsRXYAcXyeK+25Pp7nQwexvroSPACOGlPOAJVV 6bIlR9FtbbuPi5tGJ97j2QppXs+icJVM5KM3CA2h0T2vReGTAY1efPla7p7inublTU4o GuuWXrfEGS+j6FkXm6WPLdWPtKkt4PuYZNo3CRwmCDoyE+vIIMbOqIXx2rDgw7pYtj4l 37dA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=J+r21PKZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id p21-20020a63c155000000b00578d1b590b0si182262pgi.699.2023.10.05.12.06.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Oct 2023 12:06:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=J+r21PKZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 3EF1D835C23B; Thu, 5 Oct 2023 12:06:53 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230420AbjJETGl (ORCPT + 18 others); Thu, 5 Oct 2023 15:06:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229781AbjJETGg (ORCPT ); Thu, 5 Oct 2023 15:06:36 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D88AEEB; Thu, 5 Oct 2023 12:06:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1696532794; x=1728068794; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=/M0BXFayBhHOB8YBHRkLZxRHjkjjHcYFaqoHoxPtxBQ=; b=J+r21PKZg31aA1D3j2yjmnf2dI5vC479k4oUjpSD4XIf/QaeySprDkfX nE1CWAcuk0BDBOK3T7XQmpBJyVLK1yb462D07g0Pef8BvhBdbcsHsczkJ BhSpUkJs4O5r7PxxGVPvG+kLvBg/V61LPiZAiZOgJKPW2yxKoCgI4iCdC ELdoAWjOEc1mDz1afz9812v5AIP6lwv7bJdRX+lyJltarEg9dOy6ycxDA /3Uup9+Y57fSr0BDIgRrr6DwQJm3YISXR0/EvjhzQnGT9dfiEtQaACwQP qm5kkfpwfSu/wRo3r8ZfNkO5om/PgfP6uznx42/anIdi6T3umfEpvrbE/ Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10854"; a="383488235" X-IronPort-AV: E=Sophos;i="6.03,203,1694761200"; d="scan'208";a="383488235" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Oct 2023 12:05:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10854"; a="999055112" X-IronPort-AV: E=Sophos;i="6.03,203,1694761200"; d="scan'208";a="999055112" Received: from ahunter6-mobl1.ger.corp.intel.com (HELO ahunter-VirtualBox.home\044ger.corp.intel.com) ([10.249.35.8]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Oct 2023 12:05:12 -0700 From: Adrian Hunter To: Arnaldo Carvalho de Melo Cc: Jiri Olsa , Namhyung Kim , Ian Rogers , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Subject: [PATCH 2/5] perf intel-pt: Simplify intel_pt_get_vmcs() Date: Thu, 5 Oct 2023 22:04:48 +0300 Message-Id: <20231005190451.175568-3-adrian.hunter@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231005190451.175568-1-adrian.hunter@intel.com> References: <20231005190451.175568-1-adrian.hunter@intel.com> MIME-Version: 1.0 Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 05 Oct 2023 12:06:53 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778943596253323667 X-GMAIL-MSGID: 1778943596253323667 Simplify and remove unnecessary constant expressions. Signed-off-by: Adrian Hunter --- .../util/intel-pt-decoder/intel-pt-pkt-decoder.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/tools/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.c b/tools/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.c index af9710622a1f..249610cc9284 100644 --- a/tools/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.c +++ b/tools/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.c @@ -131,19 +131,14 @@ static int intel_pt_get_cbr(const unsigned char *buf, size_t len, static int intel_pt_get_vmcs(const unsigned char *buf, size_t len, struct intel_pt_pkt *packet) { - unsigned int count = (52 - 5) >> 3; - - if (count < 1 || count > 7) - return INTEL_PT_BAD_PACKET; - - if (len < count + 2) + if (len < 7) return INTEL_PT_NEED_MORE_BYTES; packet->type = INTEL_PT_VMCS; - packet->count = count; - memcpy_le64(&packet->payload, buf + 2, count); + packet->count = 5; + memcpy_le64(&packet->payload, buf + 2, 5); - return count + 2; + return 7; } static int intel_pt_get_ovf(struct intel_pt_pkt *packet) From patchwork Thu Oct 5 19:04:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Hunter X-Patchwork-Id: 148996 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2016:b0:403:3b70:6f57 with SMTP id fe22csp508613vqb; Thu, 5 Oct 2023 12:07:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFBwNgLPWcXVHtc4P6u+MJPRre5MStx4yENu+/Bd3+zt/fL7/W8LkBzdxb8gsdKkuWwmI+L X-Received: by 2002:a17:90b:46c7:b0:277:4b68:b93c with SMTP id jx7-20020a17090b46c700b002774b68b93cmr6026583pjb.4.1696532823217; Thu, 05 Oct 2023 12:07:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696532823; cv=none; d=google.com; s=arc-20160816; b=yLS2fCT5ebTrK49qB2plk+GjafCwUIuccGXsKXer4xTuAT+tPJ9hwVQLfFFGz6dRmo UV3uV6Aw27tmL6YeiGK4V7/eOgC/+iP/fkVqpynYffrs0zpnNYoKe6N7DmuoCvm3pxTc 3xHfaE1B04nHIQYJGJdc+7TSnLECKi2JfuyyUHa8LHoByGL0HOEN02L4nfrhboOyRNkL 4eGnsFjI1yq74HvGJQAGAR6Ju53itb8RSUJu4TdQ/Dm1rEEBitbBsVQ3Gf9TkZbpDOf8 ATk1IiMqmfG/QQJo+4rauhCQm/gpl0ktqz03D0WYv/op6Mb9njJlqM5cULZEbm1ljYY9 8ZoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:organization :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=i10KStxUqu3UJXHF4fUURVSFlv1f/TTIt6nKm8fPeCo=; fh=7ueK1huCq2Lf3LMjc8i3Ob70zhQl+8ZRdqYzG6swRYY=; b=ld+Y/uTf2ypYoW1gMhkZzd1hGceQXiVOw1wT7WiQsevEvaUNAgNg8UiUkFUYIlWhkN 23nD2f5KjXjUxL1lDd9dcGrKWmhCl1gyPxuQosima5B5guOnNc1z1mwNbqFCWtUAOtL/ UIUomgW0U4WsZbOVVFLupflapvKdAmm+xuZl4E1dS/vGcy72HwhF6B7o6CqBB9Y7rENo Qx5cgktx1rw5um992QYUV0igEM8RWMOkt+3t0LVRlL2WJDUWcM7VERvFAkvyzu6gwSWr 1eCiEXcDx5N5FSFrixHeWI6GCaa0TlrrKVkH2028LQ2c7nsMhfv3LFVGo21AyXX33sCy mwTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=QoDHwYG6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id lp3-20020a17090b4a8300b0026b49c1aa50si4663083pjb.111.2023.10.05.12.07.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Oct 2023 12:07:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=QoDHwYG6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 4ADF08047075; Thu, 5 Oct 2023 12:06:59 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230405AbjJETGr (ORCPT + 18 others); Thu, 5 Oct 2023 15:06:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230376AbjJETGh (ORCPT ); Thu, 5 Oct 2023 15:06:37 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6F4ADB; Thu, 5 Oct 2023 12:06:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1696532795; x=1728068795; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=qtF8zRHNP255BfSQ+DVT/RKn8FRUesePocVsXbPofQc=; b=QoDHwYG6p4azHfsI7MeXDqAdWFsA3Udnh6EirWfssBMDUrb8gibTBdoq 1dEIgG09RlWEhPDSH7L/Hf21lNulqJ1h0wGQ1TlgjOL6xV1lhtmBg81li VRpRQ96KlHavBd0GpFbz+iwQrQOH9nT1GMiQB/HX4l8gxvapibMWqTL4R QgME3JYQ06IWBtpIRAcZZ1v6ADTaPjovX3jIUn47SdximacJzsPdbdbPw 8DBPtj81V6Y7I/3WQCtKhSI18bkyQ1Ux9YC53uja/s0JLNV/LPnpDgf7I GnjKuK65IJ6XKafTqDjzpGvhm81qhI20vwgbDjO5JbYS0fPFpwSNNgCtO Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10854"; a="383488244" X-IronPort-AV: E=Sophos;i="6.03,203,1694761200"; d="scan'208";a="383488244" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Oct 2023 12:05:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10854"; a="999055151" X-IronPort-AV: E=Sophos;i="6.03,203,1694761200"; d="scan'208";a="999055151" Received: from ahunter6-mobl1.ger.corp.intel.com (HELO ahunter-VirtualBox.home\044ger.corp.intel.com) ([10.249.35.8]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Oct 2023 12:05:14 -0700 From: Adrian Hunter To: Arnaldo Carvalho de Melo Cc: Jiri Olsa , Namhyung Kim , Ian Rogers , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Subject: [PATCH 3/5] perf intel-pt: Use existing definitions of le16_to_cpu() etc Date: Thu, 5 Oct 2023 22:04:49 +0300 Message-Id: <20231005190451.175568-4-adrian.hunter@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231005190451.175568-1-adrian.hunter@intel.com> References: <20231005190451.175568-1-adrian.hunter@intel.com> MIME-Version: 1.0 Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 05 Oct 2023 12:06:59 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778943601910580197 X-GMAIL-MSGID: 1778943601910580197 Use definitions from tools/include/linux/kernel.h Signed-off-by: Adrian Hunter --- tools/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/tools/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.c b/tools/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.c index 249610cc9284..ffd0d647473c 100644 --- a/tools/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.c +++ b/tools/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include "intel-pt-pkt-decoder.h" @@ -17,17 +18,11 @@ #define BIT63 ((uint64_t)1 << 63) #if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ -#define le16_to_cpu bswap_16 -#define le32_to_cpu bswap_32 -#define le64_to_cpu bswap_64 #define memcpy_le64(d, s, n) do { \ memcpy((d), (s), (n)); \ *(d) = le64_to_cpu(*(d)); \ } while (0) #else -#define le16_to_cpu -#define le32_to_cpu -#define le64_to_cpu #define memcpy_le64 memcpy #endif From patchwork Thu Oct 5 19:04:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Hunter X-Patchwork-Id: 148994 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2016:b0:403:3b70:6f57 with SMTP id fe22csp508545vqb; Thu, 5 Oct 2023 12:06:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHPzDcCD1fLDlxwH+bTNnHM5+SA9E0SRzD8jjdYDqGIEwLT1xoxMr6zlo5yZYqr8x83Kp1t X-Received: by 2002:a05:6358:2611:b0:142:e357:e777 with SMTP id l17-20020a056358261100b00142e357e777mr6705353rwc.25.1696532817995; Thu, 05 Oct 2023 12:06:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696532817; cv=none; d=google.com; s=arc-20160816; b=J64JDHcrUKyusJmACm4Bqxtlm3TwSgZ7/vVf/c8vncn7jcZi7WVOqpHvLltjc3TtnL IthFTzx3qKeZx537PnpaFtLtv/OBdi64tOpQSos2E+/hIV8vsxvEtISF2moWfeLolKlr guq6eqB26ASBCHTrueijWI1X+LigtAX+vy1CluykmT2M3w+jsNr8j4eET9OYqa9zqPO3 uHfSO6JKFL6sTyTDHcsqEl5mCQwI0/7G/7YeXVh8nQyi9X+zIDQ5e14t8pROIsDZ/gGo OIPPMe3D9vatfJkc3sAzoTC94oUdcJk5GRiwnOwqKvIOiBg4k1oBJL07G7aJ0uait7jF dcVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:organization :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Z1ermOgdCtdHkTS1bJ4MgHACEg7KimCWvy62QZUReTQ=; fh=7ueK1huCq2Lf3LMjc8i3Ob70zhQl+8ZRdqYzG6swRYY=; b=LD+SWPIy7tICcZxulmjiVe/f7lMZBt/3Rok81EoxS61r2UYmeZNSAwQWUuMAdTIEPo tK1VP1ZbP7mLcfjQHkg0T5i33LNv8TDluRlB85ges7cc07SJ6apLF9iQMhjFH8VUScI6 lrGupexXKNBR2HlSdTOU25DP58LibpvaNeGKrtF3HKzq/e/CW5D9vzM82WlmVRDyHt0g SoZrLw1EKSoHn2EP1JcJZyimsHXvbrEmyRxQtq2cSoD4j3KizipYjI+oZ5cSrgm72YBH cCFBAIc34ynN4MOdKhc4vunWe0qIDajPKi+MIv2UjCQyHeXL8YqDZM8zL6EASFh+BLQ/ ++4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=l2p0CPXi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id hk8-20020a17090b224800b00274c6997c25si2399072pjb.110.2023.10.05.12.06.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Oct 2023 12:06:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=l2p0CPXi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id AAC77835C23A; Thu, 5 Oct 2023 12:06:52 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230055AbjJETGo (ORCPT + 18 others); Thu, 5 Oct 2023 15:06:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230112AbjJETGh (ORCPT ); Thu, 5 Oct 2023 15:06:37 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE64DDE; Thu, 5 Oct 2023 12:06:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1696532795; x=1728068795; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=U76zY0O5kmHJh4OzAqNOSoPGSwZlGkT5ypjB3gSNylc=; b=l2p0CPXi33NIXnsbOBW8NrUe9MlJhYAT5TAL6uYZUDOvFyrTAx3iS5iE EVlNVBV8KtXc0jRKCBrFolm8o+wJyH36I0BllWgwNvrzmJQ7CNWZTNI/m X5eLJdwh+aozs+RRMste/j0URZLmtZTkEqiMNHCVkHzsxcbJjvqpCXZhG GNT/1xdqRBeXopiMTa+RZWNQHwiRXxQh6vPTiI5IidhqByaShpVZc2psi 4YtCZO8jWI58LTVYN6sPVtynbHlkecnhrAPCzE4uxy5lNf/DIlOecI0MK N5xeclbU61KyPFol5kGL6ZnG04xCtWvClRAdR6YB+rQNGfTAZJsIqfZqD g==; X-IronPort-AV: E=McAfee;i="6600,9927,10854"; a="383488254" X-IronPort-AV: E=Sophos;i="6.03,203,1694761200"; d="scan'208";a="383488254" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Oct 2023 12:05:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10854"; a="999055177" X-IronPort-AV: E=Sophos;i="6.03,203,1694761200"; d="scan'208";a="999055177" Received: from ahunter6-mobl1.ger.corp.intel.com (HELO ahunter-VirtualBox.home\044ger.corp.intel.com) ([10.249.35.8]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Oct 2023 12:05:16 -0700 From: Adrian Hunter To: Arnaldo Carvalho de Melo Cc: Jiri Olsa , Namhyung Kim , Ian Rogers , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Subject: [PATCH 4/5] perf intel-pt: Use get_unaligned_le16() etc Date: Thu, 5 Oct 2023 22:04:50 +0300 Message-Id: <20231005190451.175568-5-adrian.hunter@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231005190451.175568-1-adrian.hunter@intel.com> References: <20231005190451.175568-1-adrian.hunter@intel.com> MIME-Version: 1.0 Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 05 Oct 2023 12:06:52 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778943596266979663 X-GMAIL-MSGID: 1778943596266979663 Avoid unaligned access by using get_unaligned_le16(), get_unaligned_le32() and get_unaligned_le64(). Signed-off-by: Adrian Hunter --- .../intel-pt-decoder/intel-pt-pkt-decoder.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/tools/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.c b/tools/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.c index ffd0d647473c..7a90218aecb1 100644 --- a/tools/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.c +++ b/tools/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.c @@ -10,6 +10,7 @@ #include #include #include +#include #include "intel-pt-pkt-decoder.h" @@ -78,7 +79,7 @@ static int intel_pt_get_long_tnt(const unsigned char *buf, size_t len, if (len < 8) return INTEL_PT_NEED_MORE_BYTES; - payload = le64_to_cpu(*(uint64_t *)buf); + payload = get_unaligned_le64(buf); for (count = 47; count; count--) { if (payload & BIT63) @@ -119,7 +120,7 @@ static int intel_pt_get_cbr(const unsigned char *buf, size_t len, if (len < 4) return INTEL_PT_NEED_MORE_BYTES; packet->type = INTEL_PT_CBR; - packet->payload = le16_to_cpu(*(uint16_t *)(buf + 2)); + packet->payload = get_unaligned_le16(buf + 2); return 4; } @@ -218,12 +219,12 @@ static int intel_pt_get_ptwrite(const unsigned char *buf, size_t len, case 0: if (len < 6) return INTEL_PT_NEED_MORE_BYTES; - packet->payload = le32_to_cpu(*(uint32_t *)(buf + 2)); + packet->payload = get_unaligned_le32(buf + 2); return 6; case 1: if (len < 10) return INTEL_PT_NEED_MORE_BYTES; - packet->payload = le64_to_cpu(*(uint64_t *)(buf + 2)); + packet->payload = get_unaligned_le64(buf + 2); return 10; default: return INTEL_PT_BAD_PACKET; @@ -248,7 +249,7 @@ static int intel_pt_get_mwait(const unsigned char *buf, size_t len, if (len < 10) return INTEL_PT_NEED_MORE_BYTES; packet->type = INTEL_PT_MWAIT; - packet->payload = le64_to_cpu(*(uint64_t *)(buf + 2)); + packet->payload = get_unaligned_le64(buf + 2); return 10; } @@ -455,13 +456,13 @@ static int intel_pt_get_ip(enum intel_pt_pkt_type type, unsigned int byte, if (len < 3) return INTEL_PT_NEED_MORE_BYTES; ip_len = 2; - packet->payload = le16_to_cpu(*(uint16_t *)(buf + 1)); + packet->payload = get_unaligned_le16(buf + 1); break; case 2: if (len < 5) return INTEL_PT_NEED_MORE_BYTES; ip_len = 4; - packet->payload = le32_to_cpu(*(uint32_t *)(buf + 1)); + packet->payload = get_unaligned_le32(buf + 1); break; case 3: case 4: @@ -474,7 +475,7 @@ static int intel_pt_get_ip(enum intel_pt_pkt_type type, unsigned int byte, if (len < 9) return INTEL_PT_NEED_MORE_BYTES; ip_len = 8; - packet->payload = le64_to_cpu(*(uint64_t *)(buf + 1)); + packet->payload = get_unaligned_le64(buf + 1); break; default: return INTEL_PT_BAD_PACKET; From patchwork Thu Oct 5 19:04:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Hunter X-Patchwork-Id: 148997 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2016:b0:403:3b70:6f57 with SMTP id fe22csp508647vqb; Thu, 5 Oct 2023 12:07:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFm+E9YDIas9DdeXdqIkQ+Z1a0hfdinJ42PuNM5X+PqSf0GlHpKrILhtqh2z+ZQeiFuJ9QM X-Received: by 2002:a05:6a21:7189:b0:15d:684d:f51b with SMTP id wq9-20020a056a21718900b0015d684df51bmr5433381pzb.45.1696532826488; Thu, 05 Oct 2023 12:07:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696532826; cv=none; d=google.com; s=arc-20160816; b=d+9jwf8zDYoDS4wJV69Vr6wE6yPz+2G4Y2uihdnLtqNdngkXiduadhGyut0l8/eU6f 0ujDOrf89EXUB/9jg6kbycPvxDL1sNN/ycqeBMkuNgF8wXK9ZR0PzOhOv5i9Ijs7jLJ+ WZs0RCsOq0xRIOFCI015Oz4eO4Ve/x4n5yJ4qifWRxdbv0ow/iVHlgljVLRvXe/dMOUR BrDxxciBflFDNt9Ke49dfXBHBRdetOtwkbfRAN2yxSiNlFX8Es+CQASKhP5bpXluomTt lGyf4nBx+sOm2CpGJ5q9UR3x8eqkI4eCleTHh9wYIVvYetY/GpGmHQAXRMFyDv+XbmhH hs7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:organization :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ut+nxo9NjF94t/TI85ATgeBEyyQJZ6rdWiZsRhWBkvE=; fh=7ueK1huCq2Lf3LMjc8i3Ob70zhQl+8ZRdqYzG6swRYY=; b=AFNWMqwsKMt6AXlYh4mSP9q7cDw5doFPwFoyQePVNLs+Kh4xAjpzdtqLTQDPidGYhy mvU3gtW/iAwifJMr5NGnSK+wnbdUpT+nC1Wbi3ay+zFZ0Jjnx33mbo3SOJSVcapro5Hp QuXCni7Oj6lfj9gapoEQm0mRjS8AdeKxs+fXBjNnNrIMHyQcQPjs+817GhZ5+5w4DNmk w1QS9lBqjzi2lAH3alzk5jNgXHzSBdKIduBNUsC8xvwTf5MBgwYTfJN5TmoUtRVSEiFc HW4Ig3LFXHJJjPiyQ44v5EfST7ZOo0vEp+kf0Uq47+HA327HC6nQh/rTE4MCd0u7jo62 yNBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=GYLfpluD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id l17-20020a056a00141100b006906a716917si2039715pfu.398.2023.10.05.12.07.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Oct 2023 12:07:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=GYLfpluD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id C5DC7835C237; Thu, 5 Oct 2023 12:07:03 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229799AbjJETGw (ORCPT + 18 others); Thu, 5 Oct 2023 15:06:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231142AbjJETGn (ORCPT ); Thu, 5 Oct 2023 15:06:43 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E54BD9; Thu, 5 Oct 2023 12:06:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1696532797; x=1728068797; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Idg8ltgyFZaayjhZqPMjxwfK9UI2JApxxyIZyfMjKUk=; b=GYLfpluDeVMuZW+WyB0/L2uLMqRzIBuF1ZFpTVxE5tkVQOeL+7p0Np0c AevmLnwWksu0eQkMUfHZDwnfsPBCJs4bTCe9SPOqpo1jlPjHt0erl98dH msyDgRGdnVT3UwLXDhvcly8JjJ9ZR+vaADaIcvl5EdH4XC0Y6V+9KxAiP z4Zh9KHKQkjj7X8gMijCDzw8jAC8Rn5ubP50bnhRFuHbAsdek89CB68Fs CQHR9tpb6KtgH54+Q0PyevGUVFLiCRGxZ1eLYS/1olVRoVI1kaFNM26f2 ZqvqxjEwA7M+lITBSgY96S3d53Ppl0fIpo9nUV0/2aJgAjW4ppHwgaAnx A==; X-IronPort-AV: E=McAfee;i="6600,9927,10854"; a="383488268" X-IronPort-AV: E=Sophos;i="6.03,203,1694761200"; d="scan'208";a="383488268" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Oct 2023 12:05:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10854"; a="999055209" X-IronPort-AV: E=Sophos;i="6.03,203,1694761200"; d="scan'208";a="999055209" Received: from ahunter6-mobl1.ger.corp.intel.com (HELO ahunter-VirtualBox.home\044ger.corp.intel.com) ([10.249.35.8]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Oct 2023 12:05:18 -0700 From: Adrian Hunter To: Arnaldo Carvalho de Melo Cc: Jiri Olsa , Namhyung Kim , Ian Rogers , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Subject: [PATCH 5/5] perf intel-pt: Prefer get_unaligned_le64 to memcpy_le64 Date: Thu, 5 Oct 2023 22:04:51 +0300 Message-Id: <20231005190451.175568-6-adrian.hunter@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231005190451.175568-1-adrian.hunter@intel.com> References: <20231005190451.175568-1-adrian.hunter@intel.com> MIME-Version: 1.0 Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 05 Oct 2023 12:07:03 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778943605056473732 X-GMAIL-MSGID: 1778943605056473732 Use get_unaligned_le64() instead of memcpy_le64(..., 8) because it produces simpler code. Signed-off-by: Adrian Hunter --- tools/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.c b/tools/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.c index 7a90218aecb1..bccb988a7a44 100644 --- a/tools/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.c +++ b/tools/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.c @@ -190,7 +190,7 @@ static int intel_pt_get_mnt(const unsigned char *buf, size_t len, if (len < 11) return INTEL_PT_NEED_MORE_BYTES; packet->type = INTEL_PT_MNT; - memcpy_le64(&packet->payload, buf + 3, 8); + packet->payload = get_unaligned_le64(buf + 3); return 11; } @@ -302,7 +302,7 @@ static int intel_pt_get_bip_8(const unsigned char *buf, size_t len, return INTEL_PT_NEED_MORE_BYTES; packet->type = INTEL_PT_BIP; packet->count = buf[0] >> 3; - memcpy_le64(&packet->payload, buf + 1, 8); + packet->payload = get_unaligned_le64(buf + 1); return 9; } @@ -341,7 +341,7 @@ static int intel_pt_get_evd(const unsigned char *buf, size_t len, packet->type = INTEL_PT_EVD; packet->count = buf[2] & 0x3f; packet->payload = buf[3]; - memcpy_le64(&packet->payload, buf + 3, 8); + packet->payload = get_unaligned_le64(buf + 3); return 11; }