Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp700691ybt; Wed, 24 Jun 2020 09:07:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw0ABKZbWBSa7ESgw8qV163dHesQCZzIoasHkT3I8E5JNd+KSTmOqLApuQe0XsJ4E321vlf X-Received: by 2002:a50:d513:: with SMTP id u19mr15479307edi.241.1593014857386; Wed, 24 Jun 2020 09:07:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593014857; cv=none; d=google.com; s=arc-20160816; b=TcNYDWWJYw6+VuCaGPftWMlAnm+UYj4m2JGSitp3FhXfDKwSNeXCG0E8GiTUcEqwXU hgdCnjKxal1uwDYn2jUiX+LIxUqDaFC9ATg1Vj5QObdlfzjkj3snzUduUKFbY/Bf6o3i Uu0DxvH/ai6FQQHHE7aaq5Bg/xqbSLPeAQnEICkcQeiouwyaZysAQdveW0n0g3S288fP q7sqxzTAb4fSi7UZ+bhA3hXdP+ebIqyRvgQwLodGSWUn6FoOZZRMFfbitHDEBrlfIROz K1M1SkuIA77SKmXvy7g396cWU5+wz3wQCkVYRVCqi4sm1OiHFuvMH2tOAfcQ3VBUKfOS dtrA== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject:ironport-sdr :ironport-sdr; bh=YczgE8AQ49Bc6wYTx+H6RcuJFaJR2ncvXFcwpn7sX0E=; b=w82IaVdEUszaUudETfOuITYSGlqVieoiSuvSXFR0trNvIGZXOzks2jYMN9Hgwi/6FM p8JVKOIM0H3IDtXtQi3HK5uHT3wvsNbtmowul6hxtfyZg/nEq4lhzugVbMl6/n51yEJh H9ApM/E244w5oHHVCigB+fYrY2usl+hobZxwm4ZxM2UvTwKzZAmo1TUyJB0cVg5s+SiF nbpU50ILSMCD9/SVELp+gK7ViyBj2EQNPOg57luTsJ7qYEmT6fk98xc9NIYt7cThH4Tq NV1OGi2RP89uYtNzl5o40ZFPL5dgaEqSnQJ4aXJ4Zg0uhBwnuUIXtFuZVaSKGp/1ajUE GMVA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z1si7882236eju.7.2020.06.24.09.07.12; Wed, 24 Jun 2020 09:07:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404869AbgFXQFo (ORCPT + 99 others); Wed, 24 Jun 2020 12:05:44 -0400 Received: from mga17.intel.com ([192.55.52.151]:52909 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404551AbgFXQFk (ORCPT ); Wed, 24 Jun 2020 12:05:40 -0400 IronPort-SDR: 4zAy2CGEMIHZB1EweszIjL0AE3swoMAgX2aMI2EHCBAfVz4E6XtwGQyO47Trpp3K2VIyagYhZJ YUdEHAobOClQ== X-IronPort-AV: E=McAfee;i="6000,8403,9662"; a="124782192" X-IronPort-AV: E=Sophos;i="5.75,275,1589266800"; d="scan'208";a="124782192" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jun 2020 09:05:40 -0700 IronPort-SDR: RXeouA/apnHQ7YZett2vnnFyYNDVHOp1tzEFxw3NOrqoKcZLmcup13oGomgk+u/CrxQqo/B7LO IaaL/f74/7eA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,275,1589266800"; d="scan'208";a="385208483" Received: from ahunter-desktop.fi.intel.com (HELO [10.237.72.73]) ([10.237.72.73]) by fmsmga001.fm.intel.com with ESMTP; 24 Jun 2020 09:05:37 -0700 Subject: Re: [PATCH] [perf] intel_pt_recording_options: Remove redundant intel_pt_evsel null check To: Jiri Olsa , Gaurav Singh Cc: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Namhyung Kim , Mathieu Poirier , Ian Rogers , "open list:PERFORMANCE EVENTS SUBSYSTEM" References: <20200623234905.18608-1-gaurav1086@gmail.com> <20200624124241.GA2719003@krava> From: Adrian Hunter Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Message-ID: Date: Wed, 24 Jun 2020 19:05:03 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.1 MIME-Version: 1.0 In-Reply-To: <20200624124241.GA2719003@krava> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 24/06/20 3:42 pm, Jiri Olsa wrote: > On Tue, Jun 23, 2020 at 07:48:50PM -0400, Gaurav Singh wrote: >> intel_pt_evsel cannot be NULL here since its already being >> dereferenced above. Remove this redundant check. >> >> Signed-off-by: Gaurav Singh >> --- >> tools/perf/arch/x86/util/intel-pt.c | 24 +++++++++++------------- >> 1 file changed, 11 insertions(+), 13 deletions(-) >> >> diff --git a/tools/perf/arch/x86/util/intel-pt.c b/tools/perf/arch/x86/util/intel-pt.c >> index 839ef52c1ac2..8cc87fd2dc6f 100644 >> --- a/tools/perf/arch/x86/util/intel-pt.c >> +++ b/tools/perf/arch/x86/util/intel-pt.c >> @@ -836,19 +836,17 @@ static int intel_pt_recording_options(struct auxtrace_record *itr, >> } >> } >> > > I wonder we sould put check before that above usage of intel_pt_evsel, > because there's no check for that.. but yes, if intel_pt_evsel is NULL > it will fail earlier.. Adrian? The code was written when sampling-mode did not require an intel_pt_evsel. Now it does, so intel_pt_evsel will not be NULL. I think it is OK as is. > > thanks, > jirka > >> - if (intel_pt_evsel) { >> - /* >> - * To obtain the auxtrace buffer file descriptor, the auxtrace >> - * event must come first. >> - */ >> - perf_evlist__to_front(evlist, intel_pt_evsel); >> - /* >> - * In the case of per-cpu mmaps, we need the CPU on the >> - * AUX event. >> - */ >> - if (!perf_cpu_map__empty(cpus)) >> - evsel__set_sample_bit(intel_pt_evsel, CPU); >> - } >> + /* >> + * To obtain the auxtrace buffer file descriptor, the auxtrace >> + * event must come first. >> + */ >> + perf_evlist__to_front(evlist, intel_pt_evsel); >> + /* >> + * In the case of per-cpu mmaps, we need the CPU on the >> + * AUX event. >> + */ >> + if (!perf_cpu_map__empty(cpus)) >> + evsel__set_sample_bit(intel_pt_evsel, CPU); >> >> /* Add dummy event to keep tracking */ >> if (opts->full_auxtrace) { >> -- >> 2.17.1 >> >