Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp1859807rdb; Thu, 7 Dec 2023 10:33:56 -0800 (PST) X-Google-Smtp-Source: AGHT+IFTZ9MXgS3kR6SiogcSdavKM25qQ44iFdO9ASWT/ieCyaPPSDrfAKsfZn2yR9ru5n832CZR X-Received: by 2002:a17:90b:1d07:b0:286:bd98:398f with SMTP id on7-20020a17090b1d0700b00286bd98398fmr3127674pjb.1.1701974035834; Thu, 07 Dec 2023 10:33:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701974035; cv=none; d=google.com; s=arc-20160816; b=t+is13bJicBnkuNp7TNe6yJbxIMT8pMw51nMnlvCTgWyNx5PTMr0esGwUJSpLXLgJ7 JPyn3hDuiWAtYAYg42080+g6FTecYgqrGjFhaAOc9lN6iu4pnM2ojenCl6DX61SOK8SH qFuPqyU/0w+YHdA4Wg3qvCevsw0NsRRKla1ELvtqH0kENybfq1sgq4pzH0lj/Bd7xqBw 2BnthKZQmrvO+3vXHb07TuZUt+/dIWHtMbpiGsf9sW/5346bZWBkyMZC0rAUlHNm9TbX mJvFSljPiDx2EUewHlpMYFcy3qXKPxK+y+aOzW3NTXhrFwbQdnibjgFRnhYEHCzzXDuM XbaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date:dkim-signature; bh=aicwd8+Wf55+wl2xQFIwxpTfgw3IQeGsxcZsp+XwYwo=; fh=XHJC3rNtFqy9NBdwfesynq0dG98cBzq8Qrv2Usg7GS0=; b=lsmtqJUYFPvNQg7hXZlvvdEEOYF07mXOTY9bMXNiC7D/XgFugL25WJdUX4byBDme86 u4gI0DRC2JTkDMdyqrqcQtW0X2DvyJZEv8K/o9SZUwcn/GqMCBJH7KiywjTo9237HrMR D0U0RrYFS/chu5ASR9jWrEIDV3jgF4uLrsC7f8TAzgtyFgPiyAwe0Yw5LI/lhIybc5GL 5HIcRboz/XnWbEW5tZwvwdayXeZVJmjoT8wv0fji0iVd4My5ViA7isNVDOP9QPY5aRbK EHc/G6ub7mRkOqSBkAsqc50zSK85n93+SHSNtl1X9OaqZjdF4MpXxVb57G4ESXGbb4/r R+Rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=As9Xf3sb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id q16-20020a17090311d000b001b8922e82e3si162625plh.297.2023.12.07.10.33.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 10:33:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=As9Xf3sb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id B74C7802C7FF; Thu, 7 Dec 2023 10:33:54 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233081AbjLGSdo (ORCPT + 99 others); Thu, 7 Dec 2023 13:33:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233032AbjLGSdk (ORCPT ); Thu, 7 Dec 2023 13:33:40 -0500 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6460510E7; Thu, 7 Dec 2023 10:33:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1701974026; x=1733510026; h=date:from:to:cc:subject:in-reply-to:message-id: references:mime-version; bh=vOrZCjTlpOw7hm/DaYACfQ5R3zdPrvsOUsNaWvhG3Fk=; b=As9Xf3sblg86nm3qcZw8xnVqN1amKxvL75u+6BZFM5EFa/y5Y6wkBZVR hzICXoXRqyQWHDz1J3bGyMhIV6N1earCAT2yyKTl45TSnJd62xmc+3e9Y kw9bimf84nWcn64UoQfyD+AEZtPrQaEZp59qSXQFgMIp815RJA2mkTUZ5 BlqqN3oTWPjWFEgfe49qVq0a9meoJ9/9mt+9sFKiDji54VXxwDMjJD1sW xcGZXvr7PKFktX3CoV56pOwvb0RswSqo794QodqISluIwwQ0nYWLDIFt3 8ajlGXVS6jUQWc8nuOOwwFeVDD/poUVJ9ml7WHR3DU0oev/rsDsQyzSS8 Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10917"; a="393152071" X-IronPort-AV: E=Sophos;i="6.04,258,1695711600"; d="scan'208";a="393152071" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Dec 2023 10:33:46 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10917"; a="889833432" X-IronPort-AV: E=Sophos;i="6.04,258,1695711600"; d="scan'208";a="889833432" Received: from dkrupnov-mobl3.ger.corp.intel.com ([10.249.34.6]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Dec 2023 10:33:43 -0800 Date: Thu, 7 Dec 2023 20:33:41 +0200 (EET) From: =?ISO-8859-15?Q?Ilpo_J=E4rvinen?= To: Reinette Chatre cc: linux-kselftest@vger.kernel.org, Shuah Khan , Shaopeng Tan , =?ISO-8859-15?Q?Maciej_Wiecz=F3r-Retman?= , Fenghua Yu , LKML Subject: Re: [PATCH v2 08/26] selftests/resctrl: Split measure_cache_vals() In-Reply-To: <8f6c7b40-5218-4427-865d-55e5f09c594f@intel.com> Message-ID: References: <20231120111340.7805-1-ilpo.jarvinen@linux.intel.com> <20231120111340.7805-9-ilpo.jarvinen@linux.intel.com> <8f6c7b40-5218-4427-865d-55e5f09c594f@intel.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="8323329-2060136618-1701974025=:1765" X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 07 Dec 2023 10:33:55 -0800 (PST) This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323329-2060136618-1701974025=:1765 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT On Thu, 7 Dec 2023, Reinette Chatre wrote: > On 12/7/2023 6:32 AM, Ilpo Järvinen wrote: > > On Tue, 28 Nov 2023, Reinette Chatre wrote: > >> On 11/20/2023 3:13 AM, Ilpo Järvinen wrote: > > ... > >>> - /* > >>> - * Measure llc occupancy from resctrl. > >>> - */ > >>> - if (!strncmp(param->resctrl_val, CMT_STR, sizeof(CMT_STR))) { > >>> - ret = get_llc_occu_resctrl(&llc_occu_resc); > >>> - if (ret < 0) > >>> - return ret; > >>> - llc_value = llc_occu_resc; > >>> - } > >>> - ret = print_results_cache(param->filename, bm_pid, llc_value); > >>> - if (ret) > >>> + ret = print_results_cache(filename, bm_pid, llc_perf_miss); > >>> + return ret; > >>> +} > >> > >> Perhaps print_results_cache() can be made to return negative error > >> and this just be "return print_results_cache(...)" and the function > >> comment be accurate? > > > > I think, I'll just change all "return errno;" to "return -1" before this, > > however, one open question which impacts whether this is actually Fixes > > class issue: > > > > It seems that perror()'s manpage doesn't answer one important question, > > whether it ifself can alter errno or not. The resctrl selftest code > > assumes it doesn't but some evidence I came across says otherwise so doing > > return errno; after calling perror() might not even be valid at all. > > > > So I'm tempted to create an additional Fixes patch about the return change > > into the front of the series. > > > > I would not trust errno to contain code of earlier calls after a call to perror(). > If errno is needed I think it should be saved before calling perror(). Looking > at perror() at [1] I do not see an effort to restore errno before it returns, > and looking at the implementation of perror() there appears to be many > opportunities for errno to change. > > Reinette > > [1] https://sourceware.org/git/?p=glibc.git;a=blob;f=stdio-common/perror.c;h=51e621e332a5e2aa76ecefb3bcf325efb43b345f;hb=HEAD#l47 I already spent some moments in converting all return error -> return -1, since all such places do perror() calls anyway (which I also converted to ksft_perror() or ksft_print_msg() where perror() didn't make any sense) there's not much added value in returning the errno which was not correctly done in the existing code anyway. -- i. --8323329-2060136618-1701974025=:1765--