Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5880931rdb; Thu, 14 Dec 2023 02:13:21 -0800 (PST) X-Google-Smtp-Source: AGHT+IEuq/m+JjsWO5wzTj3HZiOTVMV2Zp9ELEtxb0rFef5dqbAcE/4Lq0+Aop/Q0Z2Sss7vLdVK X-Received: by 2002:a05:6870:3b8c:b0:1fb:75a:77ba with SMTP id gi12-20020a0568703b8c00b001fb075a77bamr9849370oab.107.1702548801156; Thu, 14 Dec 2023 02:13:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702548801; cv=none; d=google.com; s=arc-20160816; b=c5tt/rgXn0pn5lBlnN9fSH+1aS0dPnm04LhH2kzi5EhdnyYulRR/nzMWwJAHfESSbP uUd7h976z2my9GFmcmAUmsjfF7AxyJQ4ZnecJ91A8KpVdCbeNEbBIeNRL0GeVIGTK25v N+EIuTZAihhXdpMJAwU9/HoySEK6q/ByWVQq8IiCjEpKyW+lZFVB6UH9Sc5/QPee2iU4 TV+dTid6UF37Lobr2V+B07Jyn8t+EqKTqrjpq6J8Yet7p0fQYF6qjaajT1TGrPWCyE8w pm1XRj9BgGoEEuGkT1MtElPMnUY1kU+WT+ce9hdYMVE/99zFAjOCjtafC7RdLe2UDbQo aF8w== 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=0QeoOfaSUS9S1MLyRvODixosu7SK0jJB6uAlfxVQzSw=; fh=XHJC3rNtFqy9NBdwfesynq0dG98cBzq8Qrv2Usg7GS0=; b=W5czDeu42gUKbvC7EhyJJdQtcXtaxujmWlW0qdnrqO4m7YPTiV/d+Z/f50y99lc6uq 1+Rokj47KmUZ6B46w83snBAA/gmS/DYpK+LsRu356JovA4WCp0jv1/DnE80zZ94CPrV+ Rl76HaVY14IhixJaw4afp/SV4BCvV5nil/7lZ9BKP5To+lyOtr/LIQnZhqKwWtq2A/1a b2b1lDLu+Z8HwrX0OeKSovnfj6i0lhqFttA5iMgqbn0fBU09GS3WeEXb5kBo3yrTf1mQ kxgeifmH4XyaK5BMUyDkUNQ3ZiC+H1UqmqaUGXi6vb5MFOA5odlpBCkVinV5/2QcbFN3 3xcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=NwczzJHd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id s2-20020a63f042000000b005c65c11ad09si11028685pgj.768.2023.12.14.02.13.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 02:13:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=NwczzJHd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 234B28028D76; Thu, 14 Dec 2023 02:13:01 -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 S1443555AbjLNKMv (ORCPT + 99 others); Thu, 14 Dec 2023 05:12:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1443503AbjLNKMu (ORCPT ); Thu, 14 Dec 2023 05:12:50 -0500 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94CFAB2; Thu, 14 Dec 2023 02:12:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1702548777; x=1734084777; h=date:from:to:cc:subject:in-reply-to:message-id: references:mime-version; bh=INz0o1RXXFJG7rPpR1emQNovSti+g5Nnf66owG44gU8=; b=NwczzJHdjwpsJDJM+aLRo/+05Bg1YzKAEvq1D6CQ2cmSoviKixmvd99N Hzls0SZT81Ihlipsacgg6MgPhUf7uu0R4EoWQT91XULweCV2MqcIM5rB3 KBAwtNJgwRJM6rb5voVloHqQKTNDxM/aSth8ccJ4PsiUcMxLPXZSoXkqq Y6OFhLmIWwJY/5oXVynitp7FrDyqcycDUpdGoI5z7/UuyZ1SxMzkkYgwP u2rkDedCAo53Ultf/T72xh+XoqkiStR9wHzziQ5/wmToJugY/aFyzWKSl VdSI1cp84KP+zz2Xn9j50MEr2HNqhRiFUy9fruFKa9lfj2UJl85w/kzTa Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10923"; a="1950190" X-IronPort-AV: E=Sophos;i="6.04,275,1695711600"; d="scan'208";a="1950190" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Dec 2023 02:12:56 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10923"; a="808533599" X-IronPort-AV: E=Sophos;i="6.04,275,1695711600"; d="scan'208";a="808533599" Received: from ijarvine-mobl1.ger.corp.intel.com (HELO ijarvine-mobl2.mshome.net) ([10.237.66.38]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Dec 2023 02:12:53 -0800 Date: Thu, 14 Dec 2023 12:12:50 +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 v3 01/29] selftests/resctrl: Convert perror() to ksft_perror() or ksft_print_msg() In-Reply-To: <1e7ede83-ac80-43aa-a452-0f95b32d849c@intel.com> Message-ID: References: <20231211121826.14392-1-ilpo.jarvinen@linux.intel.com> <20231211121826.14392-2-ilpo.jarvinen@linux.intel.com> <1e7ede83-ac80-43aa-a452-0f95b32d849c@intel.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="8323329-830180910-1702548775=:5690" X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, 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, 14 Dec 2023 02:13:01 -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-830180910-1702548775=:5690 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT On Wed, 13 Dec 2023, Reinette Chatre wrote: > Hi Ilpo, > > On 12/11/2023 4:17 AM, Ilpo Järvinen wrote: > > The resctrl selftest code contains a number of perror() calls. Some of > > them come with hash character and some don't. The kselftest framework > > provides ksft_perror() that is compatible with test output formatting > > so it should be used instead of adding custom hash signs. > > > > Some perror() calls are too far away from anything that sets error. > > For those call sites, ksft_print_msg() must be used instead. > > > > Convert perror() to ksft_perror() or ksft_print_msg(). > > > > Other related changes: > > - Remove hash signs > > - Remove trailing stops & newlines from ksft_perror() > > - Add terminating newlines for converted ksft_print_msg() > > - Use consistent capitalization > > > > Another great cleanup. Also thanks for fixing some non-sensical messages. > > ... > > > @@ -149,7 +149,7 @@ int cat_perf_miss_val(int cpu_no, int n, char *cache_type) > > param.num_of_runs = 0; > > > > if (pipe(pipefd)) { > > - perror("# Unable to create pipe"); > > + ksft_perror("Unable to create pipe"); > > return errno; > > } > > > > @@ -185,7 +185,7 @@ int cat_perf_miss_val(int cpu_no, int n, char *cache_type) > > * Just print the error message. > > * Let while(1) run and wait for itself to be killed. > > */ > > - perror("# failed signaling parent process"); > > + ksft_perror("Failed signaling parent process"); > > > > Partial writes are not actually errors and it cannot be expected that errno be set > in these cases. In these cases I think ksft_print_msg() would be more appropriate. I can change those to use print instead although I don't think these will fail for other reasons than a real error as the pipe should be empty and only single byte is written to it. > > if (fprintf(fp, "Pid: %d \t Mem_BW_iMC: %f \t Mem_BW_resc: %lu \t Difference: %lu\n", > > bm_pid, bw_imc, bw_resc, diff) <= 0) { > > + ksft_perror("Could not log results"); > > fclose(fp); > > - perror("Could not log results."); > > > > return errno; > > >From what I can tell fprintf() does not set errno on error. Perhaps this > should rather be ksft_print_msg()? Oh, what a stupid gotcha in libc. I just assumed it does set errno without even checking... because why it wouldn't follow the custom. ...It seems nothing can be relied on :-/. -- i. --8323329-830180910-1702548775=:5690--