Received: by 2002:a89:288:0:b0:1f7:eeee:6653 with SMTP id j8csp34939lqh; Mon, 6 May 2024 10:21:23 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUmNkwDfFD0VfEYtqcWjovu0po3uebu/oOAEUDh8M20MEHANYP/ifLKvaMs7/1ChaMev/1+qfX3/5bw7y7JNym6eL8Jw8fLgBs2hPi1mQ== X-Google-Smtp-Source: AGHT+IEYhF3TFd+7EzX+3Po1yCQXRZRkO6UQduGeA73gOirScwFr4WSOQGZjRilWC4BjY9tJUZ+x X-Received: by 2002:a05:6808:690:b0:3c7:4579:7526 with SMTP id k16-20020a056808069000b003c745797526mr11804723oig.59.1715016083011; Mon, 06 May 2024 10:21:23 -0700 (PDT) Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id kc13-20020a056214410d00b006a0ae8fe77fsi9592039qvb.579.2024.05.06.10.21.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 10:21:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-170225-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=p5wj2tle; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-170225-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-170225-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id A6BC21C217CD for ; Mon, 6 May 2024 17:21:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C742915747C; Mon, 6 May 2024 17:21:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="p5wj2tle" Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2043.outbound.protection.outlook.com [40.107.220.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D30C915746B; Mon, 6 May 2024 17:21:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.220.43 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715016075; cv=fail; b=lLTdWMIrZOfq2V+Tk3Ri0DhXVPeFE/8X4C0g3Xslb9b33a6kceWYDE0f1LxeqdiglPdgQQc6Bv9tBt15Cx2p658BIv4s4l9az8OycMRt4qpnL8RGob/dIrdZufbf4OIteeca0RP2Nn7XHHG96jo9wWq2bRitiI4ZlC5Cys5W64A= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715016075; c=relaxed/simple; bh=Qklca73GcdBnNTFq8VMarp5lIURo+pjiLZNyF5G92fU=; h=Message-ID:Date:Subject:To:Cc:References:From:In-Reply-To: Content-Type:MIME-Version; b=AYftRM/iqJ9ra4dBz1rWTXdYyyfQ72r6dJ8Cal3fgIOpG/X4xEcSw6DbKAePf5QtQ4XEMpv/kHZvzhxg/+sKtV/q1qflFjKoQcf36j4nrk7896SgtYBQznty+YumrudKeJM8tmyPk/2Yj3ESYyD61eO6MO0LzJeNmhPCFl+GumM= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=p5wj2tle; arc=fail smtp.client-ip=40.107.220.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Bnd01hWePVvGtmjEpexBSOgkeL3SgKfI1jhfyIz9GpMHtc7M0O8dmBJ9MVRwIRAZ6zBzBT7XfgohsaCJywZvP6UVLvBp5LXxIUJrwd3dvLoDyWQn3e247uTozcG+VuMuuLGZnC225R53vPHU69AGshw0OGqY8v4viihN0QPgkEejagBmvGv0EEnZsOmvyzaSDFL90P8yZs5KewHOerPeNjXRiFC9dKbxh5peND60Je7EGhkWJipF94UuzSQVsKK00lcnOAjtPY9+dMd592qtleLPvQPAzGb2ih3v6sQIzFJ9Tx3ZjWZYEh+/HCapfPV6Gs58sCDQzJYwwukWQv1AXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=qx+PCMejNQHrPgDEtiVqatwTX/uBjlm54kOduBhfB5Y=; b=RlViw4vHTT9Y6XyWuR/PtqSreXEBVoqF3Cuxr0ZFlAFAoCWQx5cRn0RPGjqkuhkGLs2p72fjfn5A+8id9sWQhJMv+zHrj2h+BM/J8JKvfVBe6jjmvwyR9V6l58epwZS3yycNhpta4pbhwh5/7/XpyvzLkdkRos4JYz/UAFq/Ee7IRnE+MUOwYfngr6TJRTOQcNHt0MEHjf8/F3fdsu2dq+6wVk0yXaA1qB0H0axB5rV/5AP1ljp0MNIRsYMc7wHnMCeuoaKFXCWdDsD8nRDW9wuQdEOB96vnzef7Q6q24PjsrStsVGWTzWczJ8KkmCLdVzy7oi+q7tlkKOmEnD+mNQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qx+PCMejNQHrPgDEtiVqatwTX/uBjlm54kOduBhfB5Y=; b=p5wj2tleuogw0rdNvl1CKIXukEocPjZqDGzH+KGK2HOCAk+hJ8P/rYjLbQj0fG5n1Zi8YrC3rJMp9v0D/yiFzEHAfAWM2XjU34zBtba3lsWO7e6qwPtOjBXk8WfFn6LYPBda5SplWXCXqQmLAApFNZvKDUN7snHyeMMLuWYwBLD0S8YyhJCd6mro2CuO+5v+MDvVFVNBlIHiv7ti6Pnm/c/Fq7qzAzYeu7rp3CKCnfsn/D2Ng3lIVDol0qtNAk1mKbj60ii0K3AMc/9ifGGaTQEiQnr8iQBEfIu6d5BtGpBiFh1K1dthakBhrgw9ZcjAUMmvtn1+Bdrd8AEfbyhGow== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BY5PR12MB4130.namprd12.prod.outlook.com (2603:10b6:a03:20b::16) by SJ2PR12MB8184.namprd12.prod.outlook.com (2603:10b6:a03:4f2::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.42; Mon, 6 May 2024 17:21:10 +0000 Received: from BY5PR12MB4130.namprd12.prod.outlook.com ([fe80::2cf4:5198:354a:cd07]) by BY5PR12MB4130.namprd12.prod.outlook.com ([fe80::2cf4:5198:354a:cd07%4]) with mapi id 15.20.7544.041; Mon, 6 May 2024 17:21:10 +0000 Message-ID: Date: Mon, 6 May 2024 10:21:01 -0700 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] selftests/resctrl: fix clang build warnings related to abs(), labs() calls To: =?UTF-8?Q?Ilpo_J=C3=A4rvinen?= Cc: Reinette Chatre , Shuah Khan , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Fenghua Yu , Valentin Obst , linux-kselftest@vger.kernel.org, LKML , llvm@lists.linux.dev References: <20240503023209.80787-1-jhubbard@nvidia.com> <793bd068-c3b4-6330-41a4-bea597b1d820@linux.intel.com> <26f3effc-6ea1-4670-a301-76df3a710fa9@intel.com> Content-Language: en-US From: John Hubbard In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: BYAPR21CA0025.namprd21.prod.outlook.com (2603:10b6:a03:114::35) To BY5PR12MB4130.namprd12.prod.outlook.com (2603:10b6:a03:20b::16) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BY5PR12MB4130:EE_|SJ2PR12MB8184:EE_ X-MS-Office365-Filtering-Correlation-Id: 50dd90be-9efe-4d0e-2b99-08dc6df0ec68 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|1800799015|7416005|366007|376005; X-Microsoft-Antispam-Message-Info: =?utf-8?B?MFRIaDlIR3hMRk9TeFRqdytGdHJjOG1ORGRqbmI1eGZSOU8zQkJ1SnpEMzgv?= =?utf-8?B?WFdPdFJuWkcrNEpUZU9aNW5uRVRDV2pvbThEVndBbkpvejlUV25sRTVFeXlk?= =?utf-8?B?NGxHdTRPS3BndTVaRkNXMklEQ1J6NEZrbC9aQktaSkorNzFuNGU1L2I1cUhS?= =?utf-8?B?b0FzY25QZDU5eHh5UktJeVhOY2VSQWdBbTFvZFY3WWJaM0dBZjlOZlhPNVdV?= =?utf-8?B?N2RROTNvQjFqdWdDYkNQVkZISmloU3RoT1lxV3p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RWIycm92cC9hT1VTRmp1WnJsMEY4TXNP?= =?utf-8?B?VnhCdVg3UXA5bG5VSVdvRVlUN21Idkxpc0FaUll5YzdLZjNaV0FyazNpMWZs?= =?utf-8?B?K3dkNEJiTVoxUFpXdXBFemNjRlhyTEswbG5WSjVnUnpsU21KWGE1cWpPWlpZ?= =?utf-8?B?ejZaREszNjRVVWE0MmtsaHRYV0VJbk5sV3o4REEzeTJPK1RLUktoRkxvVDRr?= =?utf-8?B?S0JWTjI2UlFjRVIrWm84Vm56cVllVE9JRlJtYys5R1FZWXBOMnV6T0lNT2hV?= =?utf-8?B?TlBFeE81ZkI5WWRRUXJvbkl2ZnZ4UkEzanRMTWZjQVpSdUVGWVo3bVhFc0sz?= =?utf-8?B?dld0ZHF3VGkzamN0dGR4NTNmVzRSVXQ2R3lNc3dVQW1tS1Z4T1MyS1JvT1lH?= =?utf-8?B?WFF6SkUxQTZReUdGK1BDdzZ6YzVSS2Vma0lkWHRqTFNxZ1BOb0cvcEpuNlNx?= =?utf-8?B?UWVVNDFSUDJvVW9IcTkyK2tPQzB0U2VRZmNPb1BsZjRzQWVEN3pObVhxS2RN?= =?utf-8?B?SENzS0xBRGUrYm1VQThvUS9objR1M3dwVm9BMGU0dElwQ1IvTkNnYnJnPT0=?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR12MB4130.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(1800799015)(7416005)(366007)(376005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?NGFYRWYrM2JmVWtnOVhTTXYzTENQWkNkdDNxVi9nN3NxbU1NQ1JkZS9QSlp4?= =?utf-8?B?Z0NpWE1tVGNjYlB1SUVSWHNGQVBjTXc2QTVxbFdSUHF5ckwyY2ZMLzJiZVJK?= =?utf-8?B?Z1Nxdm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3AxRGtHZnQzZGts?= =?utf-8?B?RFFJbXY0UVlKdk9sN3k2enM5WkhZYW8xRi9Ga0NFUHFCeTlmKy9tNDFIVDEw?= =?utf-8?B?ak83NjIrd2tGYkpXY2hoRmhNbldBbkVaSVdyRzMrdmRMd3NqZmVHSksxUkxw?= =?utf-8?B?NC92UDNGRm81NXVXcm1JM2x1Yys3ejhNdE5rSVJQM0ovbkxHaDJHa0FWQUpu?= =?utf-8?B?VEtMNjRyUlNPdnlqRzRTbU1aenFDZ3cwdHNaMU80VHFwenFRRTkwcHVPdUNz?= =?utf-8?Q?8gAne6suHeRoSzHqC28+81Y=3D?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 50dd90be-9efe-4d0e-2b99-08dc6df0ec68 X-MS-Exchange-CrossTenant-AuthSource: BY5PR12MB4130.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 May 2024 17:21:10.7156 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: dtZbbF4xn4OjEnW60+oIGns+1SjJePC+rIFSYL4nO9O5+R+cbWkC9fZAmFotjynSi6dPO7Ha53n+EGeUjvOHsA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB8184 On 5/6/24 2:07 AM, Ilpo Järvinen wrote: > On Fri, 3 May 2024, John Hubbard wrote: > >> On 5/3/24 11:37 AM, Reinette Chatre wrote: >>> On 5/3/2024 9:52 AM, John Hubbard wrote: >>>> On 5/3/24 1:00 AM, Ilpo Järvinen wrote: >>>>> On Thu, 2 May 2024, John Hubbard wrote: >>>> ... >>>>>> diff --git a/tools/testing/selftests/resctrl/mbm_test.c >>>>>> b/tools/testing/selftests/resctrl/mbm_test.c >>>>>> index d67ffa3ec63a..c873793d016d 100644 >>>>>> --- a/tools/testing/selftests/resctrl/mbm_test.c >>>>>> +++ b/tools/testing/selftests/resctrl/mbm_test.c >>>>>> @@ -33,7 +33,7 @@ show_bw_info(unsigned long *bw_imc, unsigned long >>>>>> *bw_resc, size_t span) >>>>>>         avg_bw_imc = sum_bw_imc / 4; >>>>>>       avg_bw_resc = sum_bw_resc / 4; >>>>>> -    avg_diff = (float)labs(avg_bw_resc - avg_bw_imc) / avg_bw_imc; >>>>>> +    avg_diff = (float)(avg_bw_resc - avg_bw_imc) / avg_bw_imc; >>>>>>       avg_diff_per = (int)(avg_diff * 100); >>>>>>         ret = avg_diff_per > MAX_DIFF_PERCENT; >>>>> >>>>> But how are these two cases same after your change when you ended up >>>>> removing taking the absolute value entirely? >>>> >>>> All of the arguments are unsigned integers, so all arithmetic results >>>> are interpreted as unsigned, so taking the absolute value of that is >>>> always a no-op. > > (I see there's a better patch posted already but since there are a few > incorrect claims in this discussion, I'll do for the record type of > reply.) > > This discussion now went to a tangent about the warning. My main point is > that logic is not correct after removing labs(). > > I also disagree with the claim that using labs() on unsigned value is > no-op because labs() takes long so unsigned is just forced into signed > when calling which is why the warning triggers but it's very misleading > warning (see below). > Yes you are correct. >>> It does not seem as though clang can see when values have been casted. >>> I tried to do so explicitly with a: >>> avg_diff = labs((long)avg_bw_resc - avg_bw_imc) / (float)avg_bw_imc; >> >> The subtraction result will get promoted to an unsigned long, before being >> passed into labs(3). >> >>> But that still triggers: >>> warning: taking the absolute value of unsigned type 'unsigned long' has no >>> effect [-Wabsolute-value] >> >> As expected, yes. > > That error message isn't factually correct: > > unsigned long a = LONG_MAX; > long b; > > a += 2; > b = (long)a; > printf("%llu %lli %lli\n", a, b, labs(a)); > > Prints (at least when built with gcc): > > 9223372036854775809 -9223372036854775807 9223372036854775807 > > labs(LONG_MAX + 1) won't work though since it's not positively presentable > with long and the value is left untouched. > Thanks for setting the detailed record straight! :) thanks, -- John Hubbard NVIDIA