Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp25844841rwd; Mon, 3 Jul 2023 01:39:59 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5mbz3oGNhb+xHJrVT7TFLolVQfpkms55mqj9nDkYICpl/qN64pKlHaG972kd7mVJSpp2xs X-Received: by 2002:a05:6a00:1a01:b0:65e:1d92:c0cc with SMTP id g1-20020a056a001a0100b0065e1d92c0ccmr19825844pfv.10.1688373599638; Mon, 03 Jul 2023 01:39:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688373599; cv=none; d=google.com; s=arc-20160816; b=n3AbX+GiMFyOnruDfvYCB+3YzsBAS3d6PIeub2PH2rCG6pY7RjXElxOncmRVcuqNVz 6hnqA/FKDFyDtaS9qd8e2gIr61CaoIoZedo6PFJYFFhFD3QD5NpGTkH16m79FHEoGt5o ng4XlMoKOCzMv3PenpF6Dt5/7lh/ryLLMpqQMEMu3xe38lnHyhoTIAlX+dMGynYVwuLo ydX7doeUI4VZWxB2ekNjBL9HPbo1+jOMJWYCW6jpq69BbMD3DXHgDihqP+YAXM67Jq1C hGR/NeUYG3ha2Ofdee8c2W7msHWPaa3I3S2CWirc22VUvfNgYx2ogVt0hZFYfxOrkjP8 qfjg== 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=witDb9gKNjSpwmjour6CvlkzwyJ9Q8C6t++/PlgfaEY=; fh=PTv3p/7vygTmzN4JlkocoWKpHmYRaDqc8dSietxqxBY=; b=UlzT7Q54qfGKd3G1aW6f+p/E5vVjNogpFb7RkixlaZ8OZxc3+VUU+H+d1N6ibbfpXp XurkdyG4jwrvMvTkdS8Ne2axg050K/Xij77b0KJuFy3/weXU4VO9SGKN6aYSirvPEGco SXe7yS7ObGSeAeBobOpP8dh3bR5GoS/WUl1A1xnPpn+9qipgR3MBlzmHYxj/kiERgWKn WCKOMPxvtTpFdwTZNyjoXre+Q2ljvP6rmbwFO5RRlqv4FTk8QNlzQLEpQHdq6TvO6BIF Is25Kny/dL/fTFtgWiNlDwtgR0A2fjq1ipAY9bDpSNOC+mBuqxIZsGB2fC6U5mIqRSes RAlw== 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 o3-20020a056a0015c300b0067a39a4c12bsi14237633pfu.81.2023.07.03.01.39.46; Mon, 03 Jul 2023 01:39:59 -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 S231352AbjGCIS6 (ORCPT + 99 others); Mon, 3 Jul 2023 04:18:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231403AbjGCIS4 (ORCPT ); Mon, 3 Jul 2023 04:18:56 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9D949E5F; Mon, 3 Jul 2023 01:18:53 -0700 (PDT) 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 EE7CC1FB; Mon, 3 Jul 2023 01:19:35 -0700 (PDT) Received: from [192.168.1.3] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E52483F73F; Mon, 3 Jul 2023 01:18:50 -0700 (PDT) Message-ID: <3a0fff38-b364-a6b4-1d10-41311e2073b4@arm.com> Date: Mon, 3 Jul 2023 09:18:50 +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: Namhyung Kim Cc: Ian Rogers , 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 X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 On 30/06/2023 22:02, Namhyung Kim wrote: > On Wed, Jun 28, 2023 at 1:06 PM Namhyung Kim wrote: >> >> On Wed, Jun 28, 2023 at 3:34 AM James Clark wrote: >>> >>> >>> >>> 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? >> >> No, I can take care of that. I'll take this as your Acked-by. :) > > This part is applied to perf-tools-next, thanks! Thanks Namhyung