Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp19033532rwd; Wed, 28 Jun 2023 04:16:34 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7i9BKlGB68eBtYFutEM5rYx5okP4LZv2bE0PToQX1gXmtoJhqXEDpYzPvbQpKDyVj/mU/p X-Received: by 2002:a05:6a20:548f:b0:126:3eba:748e with SMTP id i15-20020a056a20548f00b001263eba748emr9294484pzk.21.1687950993932; Wed, 28 Jun 2023 04:16:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687950993; cv=none; d=google.com; s=arc-20160816; b=JUoXvwZgutP495slfcZ6MEo2RnjDVmrnipjAShwb2gaWH3luYjU92VPEZtaRykv5iF 8r9T+6DK+FPSh5YfoggAYCIseACYq827qA8/f3sJhOyFJ1qvn6sdTbQQQ5LlvdrWKwO+ /z+bKivRjnfKzFLjcgo5cokbJHmSBnfuZxD1BagjssYDh11V0l8RBmTzbCO5rI+uV0qx iuTBjqtTJeVZ9WofrdsRDxvRnnUYTQdxJ5hzEFDhodyN+HlSBJkI5NKEkES9qIPWU9CY orehleamIQoDW1gDHrB29121MRrj7guqr2/c7Ah7xifBdtJBb8uGlYLzw/bAJKGs4muN h4aw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=2ivXXUTnKBiSWGw7VRO6l8KMcDR+tSbFhDUqyCnzO88=; fh=AwC7oFAI598YAE7Dej0Mw8d9ZQHGJKuCcN0ZU36CEbk=; b=A86l8mi+6KNAJuCk7HvkhD6cgs1vKi9LSMOJkYyTr+EFot+Rv7aRjv9iXOVeOf2xhl ETN7v2EHKlTL4XK0s4XM6jL+hUtM1XcCWoqn2kcrK5eZGtBIMwcovs0AQ4IQl/dUyLdt H3co7lhsnCD00WcPS7Q/oT8w4jSWVpczaBviac1IoadLl9Ev2/c4/hJP1u3nZR6mRZHd 1NO2U62KuGtw7oS+dyR8FPShImbr2gH5p1SZu2RoK68oETlcwMFM7UoJSmLSC8x07u93 AXCmR9B95FSsbuOWvoM0tOogxiAE5rN1ZtOT6sXLVlWKQWGjSz4Dle7QrMSVxnhXw5Vg M48g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z11-20020a6552cb000000b0055336b93e04si8790195pgp.827.2023.06.28.04.16.20; Wed, 28 Jun 2023 04:16:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231561AbjF1Kgg (ORCPT + 99 others); Wed, 28 Jun 2023 06:36:36 -0400 Received: from foss.arm.com ([217.140.110.172]:53442 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232430AbjF1Keb (ORCPT ); Wed, 28 Jun 2023 06:34:31 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9D4A7C14; Wed, 28 Jun 2023 03:35:14 -0700 (PDT) Received: from [10.57.27.176] (unknown [10.57.27.176]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 84DD03F663; Wed, 28 Jun 2023 03:34:28 -0700 (PDT) Message-ID: Date: Wed, 28 Jun 2023 11:34:26 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: Re: [PATCH 2/2] perf report: Don't add to histogram when there is no thread found Content-Language: en-US To: Ian Rogers , Namhyung Kim Cc: linux-perf-users@vger.kernel.org, Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Adrian Hunter , Suzuki K Poulose , Mike Leach , Leo Yan , John Garry , Will Deacon , linux-kernel@vger.kernel.org, coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org References: <20230626161059.324046-1-james.clark@arm.com> <20230626161059.324046-3-james.clark@arm.com> From: James Clark In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 27/06/2023 18:19, Ian Rogers wrote: > On Tue, Jun 27, 2023 at 9:58 AM Namhyung Kim wrote: >> >> On Tue, Jun 27, 2023 at 9:43 AM Ian Rogers wrote: >>> >>> On Mon, Jun 26, 2023 at 5:02 PM Namhyung Kim wrote: >>>> >>>> On Mon, Jun 26, 2023 at 05:10:58PM +0100, James Clark wrote: >>>>> thread__find_map() chooses to exit without assigning a thread to the >>>>> addr_location in some scenarios, for example when there are samples from >>>>> a guest and perf_guest == false. This results in a segfault when adding >>>>> to the histogram because it uses unguarded accesses to the thread member >>>>> of the addr_location. >>>> >>>> Looking at the commit 0dd5041c9a0ea ("perf addr_location: Add >>>> init/exit/copy functions") that introduced the change, I'm not sure if >>>> it's the intend behavior. >>>> >>>> It might change maps and map, but not thread. Then I think no reason >>>> to not set the al->thread at the beginning. >>>> >>>> How about this? Ian? >>>> (I guess we can get rid of the duplicate 'al->map = NULL' part) >>> >>> It seemed strange that we were failing to find a map (the function's >>> purpose) but then populating the address_location. The change below >>> brings back that somewhat odd behavior. I'm okay with reverting to the >>> old behavior, clearly there were users relying on it. We should >>> probably also copy maps and not just thread, as that was the previous >>> behavior. >> >> Probably. But it used to support samples without maps and I think >> that's why it ignores the return value of thread__find_map(). So >> we can expect al.map is NULL and maybe fine to leave it for now. >> >> As machine__resolve() returns -1 if it gets no thread, we should set >> al.thread when it returns 0. >> >> Can I get your Acked-by? > > Yep: > Acked-by: Ian Rogers Looks good to me too. Should I resend the set with this change instead of my one? > > Thanks, > Ian > >> Thanks, >> Namhyung