Received: by 2002:a05:7412:518d:b0:e2:908c:2ebd with SMTP id fn13csp502941rdb; Thu, 5 Oct 2023 12:06:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFC4f8cbUkSBtNr8jPl3oPucV4WeadzN2fTazqCQ+Urvh1+XX+GQtQFKZOn69OaNyZw1mlX X-Received: by 2002:a05:6a21:a101:b0:162:6588:7174 with SMTP id aq1-20020a056a21a10100b0016265887174mr5402870pzc.28.1696532814564; Thu, 05 Oct 2023 12:06:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696532814; cv=none; d=google.com; s=arc-20160816; b=qm/Fm00DNDt25Xyq/tC8Zd8DtonufcP6YdLaWugD5vvAZd+Pywgy8macaFF7rtXCam 9hc5TteEJESrd2tABCGdHevjs/yTOr1r+4ainRgBYOW7tdUyRYPw8p0j7/9fqVfTcbOa T8olcIAbzTS4sbpd285zNi0yB0hqu6/+UGTAgAeTzLMlRiLbGRVq++T8kj5rqFO8igLc NathIfiI/bcaAH2tugihNiP4OeT3jhkFHCb9H+AzbF4EfRbrWcQdgQrWoQew0TpmjieP 7lSM5BRgcXsJJ5Yl+9W/fPTWl/P2HV9T+UD364mItLwkWaCr1XKiRy0Nd95GIZctetGV Ursg== 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 Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id ds4-20020a056a004ac400b00690d8405fe6si1895502pfb.317.2023.10.05.12.06.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Oct 2023 12:06:54 -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 3E7ED8328FD0; Thu, 5 Oct 2023 12:06:49 -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 S229608AbjJETGk (ORCPT + 99 others); Thu, 5 Oct 2023 15:06:40 -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 Content-Transfer-Encoding: 8bit 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:49 -0700 (PDT) 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) -- 2.34.1