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; }