Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6E008C433FE for ; Tue, 23 Nov 2021 08:27:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234754AbhKWIaJ (ORCPT ); Tue, 23 Nov 2021 03:30:09 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:32076 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234737AbhKWIaH (ORCPT ); Tue, 23 Nov 2021 03:30:07 -0500 Received: from pps.filterd (m0187473.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 1AN4pPg5027812; Tue, 23 Nov 2021 08:26:51 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=pp1; bh=mVN8f63W6syw/koy9XL127khMve0zsrXMri61nRWeP4=; b=LgersIe84Ozx26SSSs+K5X7ru5aMc8cgN9iFhmqJ2eN6ne+jYfzAKvAPhMlY1sEf+b1c Mj9sWJzFVqFkK9TpmVhjHOAUXpv2/IKtq/zViKCkkuDdqcxaMVQ6zUVb0ZzW1S0+ah26 qaWiCw1tbgFD9N+/NR9ItAlJNpmfccFqB9JU8uQmYq0dX1GFz2gHbJSoLtWRfRtk2hBB dCabcr7Hg9VqrA19z4bh93j/WJLSINhgEMtZOWuim2fQ8p9K72TEv2ihxw8C6o+tLZjP A2wzBVBWqW5zNAICFs1juTFozXA7TEy5f7A0kxCwbHPiagVjgebwx4lBEZT2FDF3bcm+ OQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3cgsn2kfs0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 23 Nov 2021 08:26:51 +0000 Received: from m0187473.ppops.net (m0187473.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 1AN8HVEV024226; Tue, 23 Nov 2021 08:26:50 GMT Received: from ppma02fra.de.ibm.com (47.49.7a9f.ip4.static.sl-reverse.com [159.122.73.71]) by mx0a-001b2d01.pphosted.com with ESMTP id 3cgsn2kfr4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 23 Nov 2021 08:26:49 +0000 Received: from pps.filterd (ppma02fra.de.ibm.com [127.0.0.1]) by ppma02fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 1AN88JJ7000788; Tue, 23 Nov 2021 08:26:47 GMT Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by ppma02fra.de.ibm.com with ESMTP id 3cern9md4s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 23 Nov 2021 08:26:47 +0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 1AN8QiX050135310 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 23 Nov 2021 08:26:44 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9B50BA4068; Tue, 23 Nov 2021 08:26:44 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 76CBEA4065; Tue, 23 Nov 2021 08:26:39 +0000 (GMT) Received: from li-e8dccbcc-2adc-11b2-a85c-bc1f33b9b810.ibm.com (unknown [9.43.21.81]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 23 Nov 2021 08:26:39 +0000 (GMT) Subject: Re: [PATCH 1/2] perf evsel: Make evsel__env always return a valid env To: Kim Phillips , Arnaldo Carvalho de Melo Cc: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Alexander Shishkin , Boris Ostrovsky , Ian Rogers , Ingo Molnar , Jiri Olsa , Joao Martins , Konrad Rzeszutek Wilk , Mark Rutland , Michael Petlan , Namhyung Kim , Peter Zijlstra , Robert Richter , Stephane Eranian References: <20211004214114.188477-1-kim.phillips@amd.com> From: kajoljain Message-ID: <00c83305-7654-132d-a734-1746dd9f34f2@linux.ibm.com> Date: Tue, 23 Nov 2021 13:56:38 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <20211004214114.188477-1-kim.phillips@amd.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: sn0wHtZhT05aj1f9jEiwDPK8iSdwS6Na X-Proofpoint-ORIG-GUID: CwfvGreq6VNZp673fxm7IyHHXPgNe0v3 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475 definitions=2021-11-23_02,2021-11-22_02,2020-04-07_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 suspectscore=0 impostorscore=0 malwarescore=0 spamscore=0 mlxscore=0 lowpriorityscore=0 mlxlogscore=999 adultscore=0 phishscore=0 bulkscore=0 clxscore=1011 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2111230042 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/5/21 3:11 AM, Kim Phillips wrote: > It's possible to have an evsel and evsel->evlist populated without > an evsel->evlist->env, when, e.g., cmd_record is in its error path. > > Future patches will add support for evsel__open_strerror to be able > to customize error messaging based on perf_env__{arch,cpuid}, so > let's have evsel__env return &perf_env instead of NULL in that case. > Patch looks good to me. Reviewed-by: Kajol Jain Thanks, Kajol Jain > Signed-off-by: Kim Phillips > Cc: Arnaldo Carvalho de Melo > Cc: Alexander Shishkin > Cc: Boris Ostrovsky > Cc: Ian Rogers > Cc: Ingo Molnar > Cc: Jiri Olsa > Cc: Joao Martins > Cc: Konrad Rzeszutek Wilk > Cc: Mark Rutland > Cc: Michael Petlan > Cc: Namhyung Kim > Cc: Peter Zijlstra > Cc: Robert Richter > Cc: Stephane Eranian > --- > tools/perf/util/evsel.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c > index dbfeceb2546c..b915840690d4 100644 > --- a/tools/perf/util/evsel.c > +++ b/tools/perf/util/evsel.c > @@ -2857,7 +2857,7 @@ int evsel__open_strerror(struct evsel *evsel, struct target *target, > > struct perf_env *evsel__env(struct evsel *evsel) > { > - if (evsel && evsel->evlist) > + if (evsel && evsel->evlist && evsel->evlist->env) > return evsel->evlist->env; > return &perf_env; > } >