Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp22890849rwd; Fri, 30 Jun 2023 14:21:27 -0700 (PDT) X-Google-Smtp-Source: APBJJlGSxPNqvIGYlPzB6WWmoKoplGdKOGNGmnL2j8GYZpasd/BW0D5YU4byQBXJcrlqhAZ7ztCp X-Received: by 2002:a17:902:760b:b0:1b8:5a32:2345 with SMTP id k11-20020a170902760b00b001b85a322345mr2371782pll.22.1688160086829; Fri, 30 Jun 2023 14:21:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688160086; cv=none; d=google.com; s=arc-20160816; b=ckje2sBU/fKZA/twLtr9ikKFSXkmLesc5xTL2qM9bI/trCCDK4eTfJRsHSJnyuF+zS GyeK1KKGtnAuZ+IaCZpntzQnAJQf0USmTkxgArhGhFGC8NpYDFVApvY8xORKJ8rurmPu Vvw49SsDvmBUFDL4fCku5EXut2rHlaqLTmjHvZBvHso9+KSj1ZNopgnVHWdJ9xrg47Ra lpXwYdQVR9DpWWE7JvDFIZ9CwmkG83qyN1zVv12iVMv/YJGeR6YRWMcRngx8PETQm75C 40bMw3SFyuJdgvcqqpR7B4zcS2K1Z2E+ePq64kXS5DeFXzEPTgiVxOOtey1toDcftW+o yp7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=N/XNdKayRtW9OWofhBn5vl0tM3DboyPE89uQfrdDuMs=; fh=YYiimnHBh2/aMw0c2UAM9IkNO/ixI1zyh1xvd9QmSkM=; b=nEDzqyTZCpN0HobK3qPsFEwx6sVumtW2qvgjS5fpMn9Hb0+yPFiMRTVBDT0EOR9Jgj R0JXoSg9tt+OhDpMGi60lv8sJIRadfcCabPFJ9q3QVOvsfzUzMWbpWUamfhDfBG2Uwlr +1/5wwWrekrg/hY8Dsf5Gczdc1e0B0SKaRbp9DECyMKSSpLdJwwx4BlovtZgA/16D0Ix bHk9sRsosCWwC8I1YcM1BX+z724s3ekeRbcmxLeuZopTmmg47opqiIbGZhjJG5EDlc76 LyKkzEcmYb6vJJ8KRIrdxxOwAXC9qByYxCXq25PEwcHfyiL59iti50t58rH21CLBF7/O UdaA== 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e16-20020a17090301d000b001b857361286si3893268plh.383.2023.06.30.14.21.12; Fri, 30 Jun 2023 14:21:26 -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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232432AbjF3VCz convert rfc822-to-8bit (ORCPT + 99 others); Fri, 30 Jun 2023 17:02:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232375AbjF3VCx (ORCPT ); Fri, 30 Jun 2023 17:02:53 -0400 Received: from mail-yb1-f170.google.com (mail-yb1-f170.google.com [209.85.219.170]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5AAC93AAF; Fri, 30 Jun 2023 14:02:52 -0700 (PDT) Received: by mail-yb1-f170.google.com with SMTP id 3f1490d57ef6-bfee66a5db6so2180424276.0; Fri, 30 Jun 2023 14:02:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688158971; x=1690750971; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QaJR3XXXCrhbjYtKCZ1X+dPieH6DxQBprcivRtbfQUY=; b=gVTRCWp6g1EyckUqz/MVo9qU+keBJqzfj6cYAeeomlMHxJ1wm/34Crkxjxsu2g6Suz BQ6dlDvBui2tz16xHg5KtCwjru95Ui5KMbn7o2fXs/h7gxZFHt8+91Erotfg1zn9T38G Jm2LV0q7FI6RLn7qpfJpsKOpOC8sU/VUIi6YrWGrAMxOOtF2BiEh6P+KGtRP/ZJ0QB3z tdBqAdmpDGTF68AnXIYxAnfyAMF9JQkoeSF5zlfAnzN5LCyMKRLr/gKQ6IqfLT0D+gW8 PC5AKYZ4qC66LklWxarFhW8LSFiGiTXp8ZHY8yyV+MjpsqF7o6ZCyGyZboXPaGj9OrcE iKBg== X-Gm-Message-State: ABy/qLZbCGev5ka5qRJ1f/HOS2+Zl0pLIXA4T2F9TuvsHgag/dneWncu ufG5l01kcVHYWY2aEPuQ0iY/3ClCLaUZQUNNmt8= X-Received: by 2002:a25:26c4:0:b0:c40:f090:98bf with SMTP id m187-20020a2526c4000000b00c40f09098bfmr3019764ybm.28.1688158971230; Fri, 30 Jun 2023 14:02:51 -0700 (PDT) MIME-Version: 1.0 References: <20230626161059.324046-1-james.clark@arm.com> <20230626161059.324046-3-james.clark@arm.com> In-Reply-To: From: Namhyung Kim Date: Fri, 30 Jun 2023 14:02:38 -0700 Message-ID: Subject: Re: [PATCH 2/2] perf report: Don't add to histogram when there is no thread found To: James Clark 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=no 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 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!