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 A6100EE0206 for ; Wed, 11 Sep 2024 17:25:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 324F394007C; Wed, 11 Sep 2024 13:25:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2AC49940066; Wed, 11 Sep 2024 13:25:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 126A794007C; Wed, 11 Sep 2024 13:25:42 -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 EA8F6940066 for ; Wed, 11 Sep 2024 13:25:41 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 9ABF3121635 for ; Wed, 11 Sep 2024 17:25:41 +0000 (UTC) X-FDA: 82553134482.05.DE1BE5C Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) by imf13.hostedemail.com (Postfix) with ESMTP id A4AD120004 for ; Wed, 11 Sep 2024 17:25:39 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=linaro.org header.s=google header.b=TFUyvpT7; spf=pass (imf13.hostedemail.com: domain of dan.carpenter@linaro.org designates 209.85.128.54 as permitted sender) smtp.mailfrom=dan.carpenter@linaro.org; dmarc=pass (policy=none) header.from=linaro.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1726075511; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=xmCKuyw0DapJvOtbSWzmF0OL2IUWJWDlS7+rw4t0ojA=; b=OKcmeZSnv/22p0YVdrd4bdIAA0hvzMfO5fMbZL63PP/MyNrgFjzOvAyxU9ZyFy+gzpfSaC 4O20Qahnb2WWAFW77CaloJRsE7KamAKVMdzX0M1MLX+HAGQWQI0xeQoUavUpkKGitpM2J4 4K8OtVRvQjIoNuvnc1yT8rlV8cVehTI= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=linaro.org header.s=google header.b=TFUyvpT7; spf=pass (imf13.hostedemail.com: domain of dan.carpenter@linaro.org designates 209.85.128.54 as permitted sender) smtp.mailfrom=dan.carpenter@linaro.org; dmarc=pass (policy=none) header.from=linaro.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1726075511; a=rsa-sha256; cv=none; b=TROe6tKGU8Q+K1bQ5jPrLhylOktC3fRpq0G5/u2JEMKAUUWSzqrvLqtzvsDWVlSKWcfm1B 3hPhM6Us1JQFwVxy0IKkyfRis++oePXK70oanMB8rErJJz/9AH3kOyV87OeN8rekyhQ6fR u441Q7lgQB7noUKgfk5FoYPaMoZuEsE= Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-42cb806623eso20884525e9.2 for ; Wed, 11 Sep 2024 10:25:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726075538; x=1726680338; darn=kvack.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=xmCKuyw0DapJvOtbSWzmF0OL2IUWJWDlS7+rw4t0ojA=; b=TFUyvpT7UCzzFjwXniUCCx/dTKMsy5GAMH6k51WrqjSlREi7XhJQ0uSVtvgMkefdyd 3phtQCx4bUOWZRMZA37yPr6b0qmw9fappjh+CzLjknNgJIK/IXV2xdaX7vK3Q4GgSV+z e4BT2GNeIhgdTcKQVL8hAPnUA9JtoYdX76MILZrfv92LwnwWfWS/ogb/mKLkWxOx+H75 Vp0rpGfYPybHawpVvaf9EPe3tuDYRnOh7bSKTSDA9pCjk1ZWG8DzGIcvjXIyYGEOHN1M ag6dzoR1RuzuRiu0Ne35yXm4xGz6XZbgivDtH8wA9suk1PQEj+nYCdmnN8WKc0gKooZK ojJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726075538; x=1726680338; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=xmCKuyw0DapJvOtbSWzmF0OL2IUWJWDlS7+rw4t0ojA=; b=uxO9X/tkXATY1PQ9UoOwNBQDVM/ajo/kYpxtk1kz9XCZQohLNfMQs7R46IC4Y7iktM cgvCeGMzV/RYYBkGAbdhgEOLFyC8sWrSbx10W25muDxufAACam/Otr3HiAOExxUq+KFU xxMaHSNvX6J2tcTvDRlX6AdwHVAfYibmUM4I1K3pS7cMgO40RXTVf4wtUrapIRvmoq/F nqss/3YpDuphD6JibEIo4XnZ9f6oHp9NdMihpzUmQ8bozSDyzZSXEqZAMXajxuB9WN4V uL5aQWT5vJTEvpxlzJ6jD/1czrPXfYczjDCDUuv/ogzKevJCR924fmin7p8TgeGDOMbb eO9g== X-Forwarded-Encrypted: i=1; AJvYcCWcyPb2hElWJhFSQSyLd+tgHRC2XrYgrUFbfzVSTEbgceWOee3+dekrsZyfHwVS9rP8Eu/BOvyK0w==@kvack.org X-Gm-Message-State: AOJu0YyprgeJBqrdesh4MglR8EtnH7fJcQ83s1ZVHUrgitq8A1BqMiyj a5wxtM0gekki8+uaBN7fOeb8/ZrcKhDAj7j1/44M9+OCjWy6+ruED8hav7Kq65s= X-Google-Smtp-Source: AGHT+IHwgouVHhx28DMTt5PoacyStj3TzOC4jjzt7G5qL8rZ2fYGdKla/4VYhBMKB9fgtOsriRz47g== X-Received: by 2002:a5d:6111:0:b0:374:93c4:2f61 with SMTP id ffacd0b85a97d-378b07966dbmr2405056f8f.5.1726075538049; Wed, 11 Sep 2024 10:25:38 -0700 (PDT) Received: from localhost ([196.207.164.177]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3789564a18asm12049442f8f.15.2024.09.11.10.25.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Sep 2024 10:25:37 -0700 (PDT) Date: Wed, 11 Sep 2024 20:25:33 +0300 From: Dan Carpenter To: Hans de Goede Cc: Lorenzo Stoakes , Andrew Morton , Richard Narron , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Mauro Carvalho Chehab , Sakari Ailus , Greg Kroah-Hartman , Marcin Wojtas , Russell King , "David S . Miller" , Arnd Bergmann , Linus Torvalds , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-staging@lists.linux.dev, linux-mm@kvack.org, stable@vger.kernel.org Subject: Re: [PATCH hotfix 6.11] minmax: reduce egregious min/max macro expansion Message-ID: References: <20240911153457.1005227-1-lorenzo.stoakes@oracle.com> <181dec64-5906-4cdd-bb29-40bc7c02d63e@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <181dec64-5906-4cdd-bb29-40bc7c02d63e@redhat.com> X-Rspam-User: X-Stat-Signature: rsudycfgfhy3o65kszq7utkixftp56i3 X-Rspamd-Queue-Id: A4AD120004 X-Rspamd-Server: rspam11 X-HE-Tag: 1726075539-881472 X-HE-Meta: U2FsdGVkX18XMUbv0fRc4N96scbuDoz26BCRKQAp6K6ijOgmD1inIU3EzhaIt9fiTfoxQDG38FpYCZTR93P3jbcH/Ka/vp7tFA8EDq1IyfgOXxAw3Rwf9oikZA2ilsxg2dxYRIh5Bj3KsDMd9/oXGyLetJ9xcYvW9Khjo6yvLiwprJep2WaIsC66Y5rLmC1NAnP06kScAbxSkOiXdFatzlcBpJjPDo1T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VXxVmMLN/zruigM+E9Z8ME/xno8XtC+OYfnvl+ZmkQkyP0TcVL7QiyUYFZ4m3S4IR1POuazsMvxyJ61XVAyX1I8bVujhrxoULMU1bAguvciPquko9ixXqMmJR/uRJfR9feUzXYAnqljtGCsfZBEElVTjWzVDVRLQP7MosyHek9hwN5TnqI/Rxqo+ySh7zUoU5q51P5cK6PnRvmcDQmY2 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 Wed, Sep 11, 2024 at 06:24:54PM +0200, Hans de Goede wrote: > Hi Lorenzo, > > On 9/11/24 5:34 PM, Lorenzo Stoakes wrote: > > Avoid nested min()/max() which results in egregious macro expansion. > > > > This issue was introduced by commit 867046cc7027 ("minmax: relax check to > > allow comparison between unsigned arguments and signed constants") [2]. > > > > Work has been done to address the issue of egregious min()/max() macro > > expansion in commit 22f546873149 ("minmax: improve macro expansion and type > > checking") and related, however it appears that some issues remain on more > > tightly constrained systems. > > > > Adjust a few known-bad cases of deeply nested macros to avoid doing so to > > mitigate this. Porting the patch first proposed in [1] to Linus's tree. > > > > Running an allmodconfig build using the methodology described in [2] we > > observe a 35 MiB reduction in generated code. > > > > The difference is much more significant prior to recent minmax fixes which > > were not backported. As per [1] prior these the reduction is more like 200 > > MiB. > > > > This resolves an issue with slackware 15.0 32-bit compilation as reported > > by Richard Narron. > > > > Presumably the min/max fixups would be difficult to backport, this patch > > should be easier and fix's Richard's problem in 5.15. > > > > [0]:https://lore.kernel.org/all/b97faef60ad24922b530241c5d7c933c@AcuMS.aculab.com/ > > [1]:https://lore.kernel.org/lkml/5882b96e-1287-4390-8174-3316d39038ef@lucifer.local/ > > [2]:https://lore.kernel.org/linux-mm/36aa2cad-1db1-4abf-8dd2-fb20484aabc3@lucifer.local/ > > > > Reported-by: Richard Narron > > Closes: https://lore.kernel.org/all/4a5321bd-b1f-1832-f0c-cea8694dc5aa@aaazen.com/ > > Fixes: 867046cc7027 ("minmax: relax check to allow comparison between unsigned arguments and signed constants") > > Cc: stable@vger.kernel.org > > Signed-off-by: Lorenzo Stoakes > > Thank you for your patch. > > I must say that I'm not a fan of that this is patching 3 totally > unrelated files here in a single patch. > > This is e.g. going to be a problem if we need to revert one of > the changes because of regressions... These kinds of thing also complicates backporting to stable. The stable kernel developers like whole, unmodified patches. So if we have to fix something in sDIGIT_FITTING() then we'd want to pull this back instead of re-writing the fix on top of the original define (unmodified patches). But now we have to backport the chunk which changes mvpp2 as well (whole patches). regards, dan carpenter