Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp1817875lqg; Mon, 4 Mar 2024 05:02:12 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCULgaRgXzf0IveXYjR6pCvn1MVwDRxMECtDpj8zKwY2+SPgsd4Lh9liXm0AvrICUfghwuMv76O6l5srGT5PJojgB7TatraLdEXb/MJQVQ== X-Google-Smtp-Source: AGHT+IE5Lwr+W5Bm3PLRkwRR2PxsrU3e34HW9IT2AywpC8grrgfvhhoX6MlBH+L/xEz+0ZbkzTLF X-Received: by 2002:a05:6808:13d1:b0:3c1:c025:67b6 with SMTP id d17-20020a05680813d100b003c1c02567b6mr11636684oiw.43.1709557331703; Mon, 04 Mar 2024 05:02:11 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709557331; cv=pass; d=google.com; s=arc-20160816; b=Is9bT3k81fUyUzxZa5aILEs9bIAzNV9wlaz4WvGlHYEAqOAVWj2aK7bLTmrNxhx8/S qmKseNg2RISEVDwmZjowV+Wst+FxF1ZhW606BYQHFhZv1FiLNbUswnoDwQMrtggIS4e4 1ckTUfL5Ge2HGvPSl5uc1tQ2iE9fF1w6yVwHftdnsxgapBA2dW+sOOyVSlbJK+eZByiG PyGDtzem72BFvwwXmcenK8zW3WMzheJTy0TlaCOaYkqPKq9Geam/Nit9iA8pZ8urW8hB HmVZ7v+iO6ixuBwwAWo2ayItyGIB11A/Wgic+Ra7gmqD9UC/pa8BVvnL5O10h5UMN9sS aGtA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=n6P2Vv8DmusW0tFRYyTV8GygBuIrcN4LIkqW3inqDB4=; fh=ZN0oeLq3wDyVN4/8k0p2xhSnKq6Dp+iLoqm3CopS2bs=; b=qsODpMzbbtdHJC2vZI9b+9RoMyXhpvaLC8fes1NGFB0/yM2QxSRO5Rfpb+t5p4+jSA XMj6Wd/8U5GhTaFltCIyqZY3AeynB9yRIqQqZaGjniriMrM+tsw9Z2NTR7F1I214nvhu XARGXSNpOKsItSeX6PgzvDMo4+XVW3p9iABh/SXIuamtVf4hpJbij/h18j5Di9CcEGmP +matTau0PvYiT0LdV8ecE83L7LFRUBsvp2kXgxZwcY3jJmGH/uBc1L5KPqa40qaa9UI4 ckGnr30GOFKBNfeEynsa/LOpLv7PvaKCuTVcyvl9R+05FjAjfa2HrTXAxM0ShwFMvTmI DEJQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=R6udMehQ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-90596-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90596-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id ez10-20020a0561302f0a00b007d2fcc30707si1301960uab.57.2024.03.04.05.02.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 05:02:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-90596-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=R6udMehQ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-90596-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90596-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 646C91C224D0 for ; Mon, 4 Mar 2024 13:02:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C05253D3BF; Mon, 4 Mar 2024 13:02:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="R6udMehQ" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 E8F2D17C62 for ; Mon, 4 Mar 2024 13:02:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709557326; cv=none; b=Bj1hL5Kynwnv2M7IaSGe2KEk+H1enEFiVLhp2mFvQ2f/GiEsxQr47ub83DZ+3kk7bpnzswFIPXxbncUcUJRffWuQgmRlNnkTDPQ+PorUCNyyvuVumUIhFGupnOdF4FfFtT+/A+chhGeRqiV1liEOXI5v/8Szew1KDUB/TDtgv8Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709557326; c=relaxed/simple; bh=OIq1GSC2Asx+nhf1HO80avSwemP0Jz8lS4ttehqA8ZU=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=h22A7lx6mwRHskO3pVKlMXxKegUI6vHyl+8dHqAPfWJmxZM8NCmiYZ7yqoIVCWj1tqUWMJCCNjkrSEdZxuEaFwtSVVvAnKIgojNgSyW9su0VtIwlbPkKNHytrSa1oZbA2D6TsWraaeBvxer9DVMN183Ly5IsQAf4Z+vZs806o74= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=R6udMehQ; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id BCA9AC433C7 for ; Mon, 4 Mar 2024 13:02:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709557325; bh=OIq1GSC2Asx+nhf1HO80avSwemP0Jz8lS4ttehqA8ZU=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=R6udMehQjtGtAmCDZAgC2ey6ZZa2Fpc/S37zT4e/Fz4fKNGZkVChcMbHvkTFveoGM NnPBVlNnGBeQNSFy/lSpBEtrZ1wT2/JFHMTL7pG/OBXGT6HX1wUTkbDocayN8MKH/5 QSUh376bb+5TpGQ05AWlTqXDFLDHDmR30hdlwZXjM6cjhY0Obo0hpyguC/9qY1MYgG ztT/7WDnMYHXxiNtmcrJrSmlc5ikKtJJOtzcwr1miWI40llHyeAPJAr/OFb9mQEZqn UwNWjmVveUB5B0wwZzXTEh93FepK8Z9PPNnwC4aJ9TmMTn6VLaKqT0tEHPEXq+mRCL vAn7tpvgG0giw== Received: by mail-lj1-f170.google.com with SMTP id 38308e7fff4ca-2d27fef509eso61261751fa.3 for ; Mon, 04 Mar 2024 05:02:05 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCXmOGHng20ohAcEbwtqwXh8sPQIBhwxc2Nlw13SwxzwxY1jWZY7Q7xiQd1XhbeghEwFcTKkevuWS7FXA8ASTddd5jTq2Yn0ZRJJzNy+ X-Gm-Message-State: AOJu0YzUaaA39lJeaJhp44EmF9AQ8nSQlK1hhnC4/YaDT8OLslMf0R7Q Z2KjBPRVxydqPtBt+ZokpCiUuAv7TjP6ejEWFYOBH769xbi6zJP7/h5UGp9I8pOt/e1d8wXX/DR E1x2e2mtG+r6o9+Di8eYoxcw5TB0= X-Received: by 2002:a2e:240c:0:b0:2d2:d9b2:b310 with SMTP id k12-20020a2e240c000000b002d2d9b2b310mr5659217ljk.47.1709557323922; Mon, 04 Mar 2024 05:02:03 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <338c89bb-a70b-4f35-b71b-f974e90e3383@app.fastmail.com> <20240304112441.707ded23@donnerap.manchester.arm.com> <1baf9a7f-b0e4-45d8-ac57-0727a213d82d@app.fastmail.com> <20240304114546.4e8e1e32@donnerap.manchester.arm.com> In-Reply-To: From: Ard Biesheuvel Date: Mon, 4 Mar 2024 14:01:52 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: arm: ERROR: modpost: "__aeabi_uldivmod" [drivers/gpu/drm/sun4i/sun4i-drm-hdmi.ko] undefined! To: Arnd Bergmann Cc: Andre Przywara , Naresh Kamboju , open list , Linux ARM , linux-sunxi@lists.linux.dev, dri-devel@lists.freedesktop.org, lkft-triage@lists.linaro.org, Maxime Ripard , Dave Airlie , Dan Carpenter Content-Type: text/plain; charset="UTF-8" On Mon, 4 Mar 2024 at 13:35, Arnd Bergmann wrote: > > On Mon, Mar 4, 2024, at 12:45, Andre Przywara wrote: > > On Mon, 04 Mar 2024 12:26:46 +0100 > > "Arnd Bergmann" wrote: > > > >> On Mon, Mar 4, 2024, at 12:24, Andre Przywara wrote: > >> > On Mon, 04 Mar 2024 12:11:36 +0100 "Arnd Bergmann" wrote: > >> >> > >> >> This used to be a 32-bit division. If the rate is never more than > >> >> 4.2GHz, clock could be turned back into 'unsigned long' to avoid > >> >> the expensive div_u64(). > >> > > >> > Wouldn't "div_u64(clock, 200)" solve this problem? > >> > >> Yes, that's why I mentioned it as the worse of the two obvious > >> solutions. ;-) > > > > Argh, should have cleaned my glasses first ;-) > > > > I guess I was put somehow put off by the word "expensive". While it's > > admittedly not trivial, I wonder if we care about the (hidden) complexity > > of that function? I mean it's neither core code nor something called > > frequently? > > It's not critical if this is called infrequently, and as Maxime > just replied, the 64-bit division is in fact required here. > Since we are dividing by a constant value (200), there is a good > chance that this will be get turned into fairly efficient > multiply/shift code. > Clang does not implement that optimization for 64-bit division. That is how we ended up with this error in the first place. Perhaps it is worthwhile to make div_u64() check its divisor, e.g., --- a/include/linux/math64.h +++ b/include/linux/math64.h @@ -127,6 +127,9 @@ static inline u64 div_u64(u64 dividend, u32 divisor) { u32 remainder; + + if (IS_ENABLED(CONFIG_CC_IS_GCC) && __builtin_constant_p(divisor)) + return dividend / divisor; return div_u64_rem(dividend, divisor, &remainder); } #endif