From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 328C2C3DA49 for ; Tue, 30 Jul 2024 14:15:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BB6186B008C; Tue, 30 Jul 2024 10:15:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B67086B0092; Tue, 30 Jul 2024 10:15:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A2CA16B0093; Tue, 30 Jul 2024 10:15:15 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 84ED56B008C for ; Tue, 30 Jul 2024 10:15:15 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 2756FA02FF for ; Tue, 30 Jul 2024 14:15:15 +0000 (UTC) X-FDA: 82396616190.26.1EA949A Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf29.hostedemail.com (Postfix) with ESMTP id 02232120006 for ; Tue, 30 Jul 2024 14:15:12 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=iJWlb+Xg; spf=pass (imf29.hostedemail.com: domain of arnd@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=arnd@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1722348870; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=4I3jCoh2atpT8NBdVd3hcUjk3QeOvDBtJSzQlx8Umyc=; b=TqeGnrGpdv6gP7BcYAzDgb+fjafRrF+FSpHK09s/UrtnMJwQXmdY06+9jhfHrPGqoPJNZP JzaSse97PEF6KDxL81fHq8DNBSHuBQwLBelA4u4a3DIp27MKxIKcvQJ4idlp6RfTRkS2nl 8P1brQo2bu3DRNQah3wZL931WtxNlpc= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=iJWlb+Xg; spf=pass (imf29.hostedemail.com: domain of arnd@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=arnd@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1722348870; a=rsa-sha256; cv=none; b=h+zptCoelTky1waQNdXAqXNwPEGkjWxuAdFfyzx9ijKbEPpUcrMs+hTc2EWn7y2Qtii+pb YeXi+nwHMk3LVK2+kkz+ljL/J5lUUgUUFAXTBNBQz3wOiiNJsLp9KdqAkxcPdsQ3UgoSvy EAFVX4NTdNNzJE7X6FiUvlxcnGrcL6w= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 0FF7561F30; Tue, 30 Jul 2024 14:15:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6BD4BC4AF0E; Tue, 30 Jul 2024 14:15:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722348911; bh=ZPO4ikQfBugP0guGLRtP7Q+yMIz304qmBzCHuYNaMuA=; h=Date:From:To:Cc:In-Reply-To:References:Subject:From; b=iJWlb+Xg7mVa/+fUNvcnHf38OrJAtxlNuAfbAxyqovYGqmLYpdKvuZzDjNZPGPHqh Qt+otPl+u2bC0SutV0+4jRMo+5SvZPErFQqleT64919EXa32pdCLhuhty4L8yy5Mwy H7mxMyvORcpSUWen6Qo6Wnw6D5W2Yo/9w7ZxgkLOBkymGYy9hZZD3Zn1K7yIlFVkfv Ej3qLIBGV4ayMQi6eJbWPNeJvHcWJtT3bT/NAMQl2Z2NLQO53NZoUAjynqecu5QjyH EGO00vfkm88WKG8n8K603hFRWObVv5l79Xtj4GkcI7DY5lthBSWU0YXpLNy6fElbR7 LGUze3PZ6uiQA== Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailfauth.nyi.internal (Postfix) with ESMTP id 4E4441200068; Tue, 30 Jul 2024 10:15:10 -0400 (EDT) Received: from imap51 ([10.202.2.101]) by compute4.internal (MEProxy); Tue, 30 Jul 2024 10:15:10 -0400 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrjeeggdejhecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefoggffhffvvefkjghfufgtgfesthejredtredttdenucfhrhhomhepfdetrhhn ugcuuegvrhhgmhgrnhhnfdcuoegrrhhnugeskhgvrhhnvghlrdhorhhgqeenucggtffrrg htthgvrhhnpefftdduueeitdfgveeuudeikeduudfhffejjeejudeuffdtiedvleduhfeu gfdtgeenucffohhmrghinhepphgrshhtvggsihhnrdgtohhmnecuvehluhhsthgvrhfuih iivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprghrnhguodhmvghsmhhtphgruhht hhhpvghrshhonhgrlhhithihqdduvdekhedujedtvdegqddvkeejtddtvdeigedqrghrnh gupeepkhgvrhhnvghlrdhorhhgsegrrhhnuggsrdguvgdpnhgspghrtghpthhtoheptd X-ME-Proxy: Feedback-ID: i36794607:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 1CB3BB6008D; Tue, 30 Jul 2024 10:15:10 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface MIME-Version: 1.0 Date: Tue, 30 Jul 2024 16:14:48 +0200 From: "Arnd Bergmann" To: "Linus Torvalds" Cc: "David Laight" , "linux-kernel@vger.kernel.org" , "Jens Axboe" , "Matthew Wilcox" , "Christoph Hellwig" , "Andrew Morton" , "Andy Shevchenko" , "Dan Carpenter" , "Jason A . Donenfeld" , "pedro.falcato@gmail.com" , "Mateusz Guzik" , "linux-mm@kvack.org" , "Lorenzo Stoakes" Message-Id: <8111159a-c571-4c71-b731-184af56b5cb1@app.fastmail.com> In-Reply-To: References: <402c3c617c29465c898b1af55e3c6095@AcuMS.aculab.com> <5cd3e11780df40b0b771da5548966ebd@AcuMS.aculab.com> Subject: Re: [PATCH v2 1/8] minmax: Put all the clamp() definitions together Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Stat-Signature: 494b4h9gbhrojarfhesobj7azuf44fk8 X-Rspam-User: X-Rspamd-Queue-Id: 02232120006 X-Rspamd-Server: rspam02 X-HE-Tag: 1722348912-613565 X-HE-Meta: U2FsdGVkX1/bPSok0pZSoUXZSwpi3pYR2m9cAVAy1Xy0wWC4OQdCswlmTkg3cgzbCpKdfItkOSu+SEOpmS/17j7R0hz7+1UnQcKXCA8EJroeTaBpjRjiWaem8NEDoS/T/Nm7J2CUDUlwUpIb/IjyTMDoGtDjo8rLxxoMRIiDRKPorkg7l6jG9tUDTG1Ro3xVylD6viMETpON7uiMjZd1CPrrTOcbcu+Wet2l19k+Ms2WMKEjWIKwqq27EJgEvh6lD4NN41k/hCh47J/GuheTSfM9JY8GHsR97oS4pQjSz/ZJUmnhe0A4Dq33InFc7Td2iavlDb+zVBPxS861YdCTMlvFe5fZfJbpja1WIstJM2hK8hkUinaDBfFzQyfkOtyf5zovbGvHRGWe1lkC/prexv9RG+RrWXIFnj66NKqibmGhdDLEFSbeevLsxnziTzPuhHx5iCunYEt8LZthncAiVxZTJeM66R4Ldpp5X5UPuRuLCFYRn4pbDRLwohOL9jStZIqljrZ2Gf2xiPxXh2AgJl5IpuMVra8FovKjGBLJ7RsUrou78F2ySEdSwA5m1xqqUInEBY8p5OV2BDWGyBuszwdz6A0HZBQ5vinbfEehyKZZI868Fy43sHRr4jnMmfHaoJZYo+ql4TH0XxpceL6Sorf9DYsdW3qjfZMOM22u45H8fGFUKMhAvJyhD1lQz2JpZ5c2Sj7gefoNmdiH7FLZ3TyNBaE3QhXCLS+XZFxQ2OfSzZwyOFL4aXPhxDtINdcRWVVPakNf1qPQuZocHtQV9zd1RQ8AtMwX+UOZyo1GvoI5XaUyDy0v65b70mQyIKV6gs6WNNiHXXtDFDwshoqySUCj93N953lYFOzC0GUK35q6dh/VroP9ITB/f2yA0e9lZiDCpEL5eDItRUCKeH4Br8gglPuatqdFROZXnUlHf7BLhenQaZ0R7ZMdCp7vi76DjUjfnWukMGmDq9MxpJ8 l+jsxTvl lSaZna2GBXncfJUee0sdHSGPuebAzzunvJtUlSmBA1rRbZQ96enyNrNlk3KTm5q3VbRziHck+tDJMSFaYY4rAiGk/2nbNmXxtOJ8+4ye+FdiohvJN4V6vGy/noJCvalr4UE3WFZWHRgJQE9D/ypP+O9oYP43H+wIdB2q29rT/Ywc8kiSMmsgD5a+WaBZdDTpejr64pM7gauV/izRdaiVsG1JpTL2B3BACYNn3kMV4nQkEkJeSLZGFsLhtpDfA4IlsHns0E7OKYAjuV5CMkf3lsuVOhbTPVSBzg9q2lZHXZlQsYlmHgocncAYTdOS7hTXivDBplcWB3Hdfau45OvyJFgkq1xAIHn+tL1AezY0QC3EBgkM= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Tue, Jul 30, 2024, at 12:10, Arnd Bergmann wrote: > On Tue, Jul 30, 2024, at 05:59, Linus Torvalds wrote: >> On Mon, 29 Jul 2024 at 16:21, Linus Torvalds wrote: > > I'm giving this a spin on the randconfig test setup now to see > if there are some other cases like the bcachefs one. So far I've > seen one failure, but I can't make sense of it yet: > > drivers/gpu/drm/i915/display/intel_backlight.c: In function 'scale': > include/linux/compiler_types.h:510:45: error: call to > '__compiletime_assert_905' declared with attribute error: clamp() low > limit source_min greater than high limit source_max > include/linux/minmax.h:107:9: note: in expansion of macro > 'BUILD_BUG_ON_MSG' > 107 | BUILD_BUG_ON_MSG(statically_true(ulo > uhi), > \ > drivers/gpu/drm/i915/display/intel_backlight.c:47:22: note: in > expansion of macro 'clamp' > 47 | source_val = clamp(source_val, source_min, source_max); > > See https://pastebin.com/raw/yLJ5ZqVw for the x86-64 .config > that triggered this. The above seems to happen only with gcc-13 and gcc-14, but not gcc-12 and earlier, and it's the only one I've seen with a bit of randconfig testing on that version. There is another one that I see with gcc-8 randconfigs (arm64): net/netfilter/ipvs/ip_vs_conn.c: In function 'ip_vs_conn_init': include/linux/compiler_types.h:510:38: error: call to '__compiletime_assert_1040' declared with attribute error: clamp() low limit min greater than high limit max_avail 510 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | ^ include/linux/minmax.h:182:28: note: in expansion of macro '__careful_clamp' 182 | #define clamp(val, lo, hi) __careful_clamp(val, lo, hi) | ^~~~~~~~~~~~~~~ net/netfilter/ipvs/ip_vs_conn.c:1498:8: note: in expansion of macro 'clamp' 1498 | max = clamp(max, min, max_avail); I can reproduce this one with gcc-8/9/10, but not gcc-11 or higher. This may be another case of __builtin_constant_p() being slightly unreliable when a local variable is constant-folded based on a condition, or with partial inlining. Arnd