Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp186875rwl; Thu, 30 Mar 2023 14:17:14 -0700 (PDT) X-Google-Smtp-Source: AKy350ZVGOiqcvy2fzhOBhvroXf+hnASS/DFDzdwEQ2vl3E83IMyLjk01GBSHa9DUyAybYGBq49n X-Received: by 2002:a17:903:41c6:b0:1a2:1a52:14b5 with SMTP id u6-20020a17090341c600b001a21a5214b5mr3709082ple.3.1680211034178; Thu, 30 Mar 2023 14:17:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680211034; cv=none; d=google.com; s=arc-20160816; b=ayso2kx1RVAsTe4uoqOvwIDEPzbmckQJA6DMHGyvROLE0kRWz9OJTcY9ZVU4ViHLVu eDDeaRDLSMyQ3J/XndJFtZcc6klYuG0vA0UEl4Rtq+lR2b1bq+yD5McBybzGr8Y0SLRx TNeGj550uzc+fHAh5EfQ2499CWyvPbnJragdJylZ4S4tr0iqDUARcmFnd4xDn8XlUDby cfIJb+GTMKgzPPBLXPuUHPy/6BzNLGmUYZPq8TGNR32gulambxKSnvBuLyAI75hNfnAB lvqJFNdJkFQ6liqKEFQxS76NC2ilUPbLFzbJsxQ/ggPLwPR4CC2YwrkThOja+KkNm0cO s/rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=t+yk5FdIdU7djbidFrqC5l3Y6yRh7fkm3xaybhwWjNU=; b=HYTTaN44w/6DR3mE5bSWRdkBoNc1XHtGH6xhfMg13k2tqiehKLgfGmLl2mW3eaMxT5 u2NuvPEIVJXKLQ9thsySsuimBrq4patUBT9+z8qE8dTfA/GyNldlE1S7uN5uJy6xA4gu vKY2jHfpVU32fsqaCs9xhUkMO/Gn0jQmyLPKcX42Z3JQuHmGAfpnGV7wBvtj+7YHck+H BBWl4dugXQaKstv7+c/JK9t2JwjJSM4YA28rqwok8JLSw39Y3ZtJzfxcFoaJVoh6LzDl kFrNChW67Bo2aB35iEH3Y1cEuujsUT2f607pgv3Q+Bk9hUqvADbQNfS7LgilAPhPRMj/ XMKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uNYvhDsr; 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 b14-20020a170902d88e00b001a1f8e130f9si377458plz.472.2023.03.30.14.17.01; Thu, 30 Mar 2023 14:17:14 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uNYvhDsr; 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 S229776AbjC3VQd (ORCPT + 99 others); Thu, 30 Mar 2023 17:16:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229974AbjC3VQT (ORCPT ); Thu, 30 Mar 2023 17:16:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2544C19A6; Thu, 30 Mar 2023 14:16:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BDED8621AE; Thu, 30 Mar 2023 21:16:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F1023C433EF; Thu, 30 Mar 2023 21:16:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1680210978; bh=ooDK8+6y9Kfl0/zn/9ZI2cFoW7WtHh5MrFLIEToNiIo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=uNYvhDsrd/8GYB4SrpR4BA1Vfz2wk8PiEsL9XRLUpzDFfMoMls1tgud9ukrx0azHj JvzJkEnzphOTnxtfBRgaQ5PIfQzkq/JDRnTAO8zTdvrgLmuf3krSiosoGpIeVKBnZ7 Gqa04fN9aWWXGsZbWYJuQyeVdE1qfsMOWgKBsLKGhjDGGEbEa0QaifrwktZmC3JTh3 PboJCO8b6NNrcngCMt00P8DTIZvFB+BDNUlKoCaFBY+iiOSa7v34nuzNjqSW4Cu8U1 gmR7v3tj3XO2IV1pLRQO5cZEa0duPe2Qd9bPP63wJB7YpmSY/zBzsW5cWBkyffMQlh 1K2ObDSWMGRnQ== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id A6B004052D; Thu, 30 Mar 2023 18:16:15 -0300 (-03) Date: Thu, 30 Mar 2023 18:16:15 -0300 From: Arnaldo Carvalho de Melo To: James Clark Cc: Andreas Herrmann , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Subject: Re: [PATCH] perf bench numa: Fix for loop in do_work Message-ID: References: <20230330074202.14052-1-aherrmann@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Url: http://acmel.wordpress.com X-Spam-Status: No, score=-5.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable 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 Em Thu, Mar 30, 2023 at 09:31:31AM +0100, James Clark escreveu: > > > On 30/03/2023 08:42, Andreas Herrmann wrote: > > j is of type int and start/end are of type long. Thus j might become > > negative and cause segfault in access_data(). Fix it by using long for > > j as well. > > Signed-off-by: Andreas Herrmann > > --- > > tools/perf/bench/numa.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > Example of segfault (with 6.3.0-rc4) is: > > > > # ./perf bench numa mem -d -m -p 2 -t 12 -P 25425 > > ... > > threads initialized in 6.052135 seconds. > > # > > perf: bench/numa.c:1654: __bench_numa: Assertion `!(!(((wait_stat) & 0x7f) == 0))' failed. > > Aborted (core dumped) > > # dmesg | grep segfault > > [78812.711311] thread 1/3[43215]: segfault at 7f07936c9ec0 ip 00000000004ab6d0 sp 00007f0acb1f9cb0 error 4 > > [78812.711309] thread 1/9[43221]: segfault at 7f08bda71a70 ip 00000000004ab6d0 sp 00007f0ac81f3cb0 error 4 > > [78812.711316] thread 1/4[43216]: segfault at 7f07ccf76a08 ip 00000000004ab6d0 sp 00007f0aca9f8cb0 error 4 > > [78812.711325] thread 1/2[43214]: segfault at 7f08be2f44b0 ip 00000000004ab6d0 sp 00007f0acb9facb0 error 4 > > [78812.711328] thread 1/8[43220]: segfault at 7f06d3096b20 ip 00000000004ab6d0 sp 00007f0ac89f4cb0 error 4 > > [78812.711345] thread 1/6[43218]: segfault at 7f0774b46a18 ip 00000000004ab6d0 sp 00007f0ac99f6cb0 error 4 in perf[400000+caa000] likely on CPU 6 (core 8, socket 0) > > [78812.711366] thread 0/0[43224]: segfault at 7f08a936b130 ip 00000000004ab6d0 sp 00007f0acc9fccb0 error 4 in perf[400000+caa000] likely on CPU 1 (core 1, socket 0) > > > > diff --git a/tools/perf/bench/numa.c b/tools/perf/bench/numa.c > > index 9717c6c17433..1fbd7c947abc 100644 > > --- a/tools/perf/bench/numa.c > > +++ b/tools/perf/bench/numa.c > > @@ -847,7 +847,7 @@ static u64 do_work(u8 *__data, long bytes, int nr, int nr_max, int loop, u64 val > > > > if (g->p.data_rand_walk) { > > u32 lfsr = nr + loop + val; > > - int j; > > + long j; > > > > for (i = 0; i < words/1024; i++) { > > long start, end; > > Reviewed-by: James Clark Thanks, applied. - Arnaldo