Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp1866166lqg; Mon, 4 Mar 2024 06:19:19 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWP3mEhBh/7wRhQqqWra1wXcr/itfu9+JIutnVtylBo3iVNkWvEm4yoV/1rsTXXSgZf24GKIxzZyDL5ni3WzpJneb1jDt0M8K02uyi8IQ== X-Google-Smtp-Source: AGHT+IGWpjD7UKRDwQ6dt6CCVCIgqSJquAikVhdofXFEL9EZ9urYtmawgrttW+1gmjylA+T8WNO+ X-Received: by 2002:a17:902:cece:b0:1dc:8f8e:63e2 with SMTP id d14-20020a170902cece00b001dc8f8e63e2mr10059026plg.46.1709561959009; Mon, 04 Mar 2024 06:19:19 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709561958; cv=pass; d=google.com; s=arc-20160816; b=jXOEXonxayqUx0Qsnxbr+S0zJnO/eUyDpLE26MPk33C0xy7+yxl2QJwKuDbHFMKWj6 k4XQ7ZzP2RM51SebS+/I7owwnC/EgkAX2SvlhAFVdvnB6mJlHOZ1hvKmARY4kv+cssAl KcVfK///ojq8WyGMm9sejRKM1vsFDcJpgR23nJIiHTU3idixOZMy1Rq8KIvWcAuDPlRF 2WnL0lP4sWk9uB+Z8C93VC7D+fa8P4U5WmR1XDTGYsHJYJrSWN3IFV2K7Fw8Lx3acxYL iItdouJzF5r0DJPbH8fR0GvpyMI+JjEtCwYu0aYOKVMRFi01aRqA5OFpm2AL1H9kS7f5 lziw== 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=sNYFi7Rc8PD8XXy2JOuSdkUhnSqNqtI/fC/Tsnb8DXc=; fh=JdzZF7sKQ6CUkgdIvryn7YOq/ADZ230Jx3uQs3J3B9I=; b=lwiH+7xu2hxliGbhzUipLu3lvMuswUJeYFEmq+HXxTVU0udOL06CD2SUSpW0Fc1uab n9JcmHWEX8138rjNGv94iNGufjr0R5YotDCWSCwTkl5wL91E9w8DSxfFse0nmTbiVx2U t3blAAOpMEdaSjymLAfiU/WZ+raDz+nqFt2HIVoTrtnKjO+ZNklynAydXqHaENrdTHOS tKs/D25kl7M9jQPck6n2cAzaT5EUrUCA7xyWv2nasw730qTP5EAwtiBRxkpzZeWcNDma 2OB3uY9Hs8CHK9J7HEhjSiazo+K9qbKfNjvJKepdPFkDw55u3foAZgWosGDg6kyIxZJo sIng==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FLDRcz66; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-90689-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90689-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id q17-20020a17090311d100b001dbeb96c48bsi3400249plh.346.2024.03.04.06.19.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 06:19:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-90689-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FLDRcz66; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-90689-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90689-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id C63BBB25AE4 for ; Mon, 4 Mar 2024 13:55:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2F05F3F8D1; Mon, 4 Mar 2024 13:55:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="FLDRcz66" 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 5BEC63D97F for ; Mon, 4 Mar 2024 13:55:35 +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=1709560535; cv=none; b=OHhb5zCdIkiJ/+fDNWNooXHKwK5RAamKPVisBjv6LR/UMgT+35lG9BAFyPhArlPQJa8K+am2u3T8VnFPnggiDcm1rzZTFgPUVk4+qmg/YQwCtBfyaedxlS8x+3rXn5ECuifxq8Fo+q/g9DfVfOl27EsPfAwukAFvfe60/0H8PO8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709560535; c=relaxed/simple; bh=3M+/bQX/v9G+J1KliPz9dmTJESbLCH9kKdvpsKmgcrk=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=O3tYYJfpM5s8E+G+hDKGUiPUjUvWJgZbOi97g1JOJNSIuwl1XR+OFQBTjOQsA4TYS4KpKYPgIMgqmLh5uC785U4KdDufBN3Nb1C23t3ePWvmxXM5wz1Tr/9v1M2MjwR/7b7J1ZVzrz24BKuUGfwsRfCoLtE5a1iY+sxiscJAtnA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=FLDRcz66; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0E74CC433B1 for ; Mon, 4 Mar 2024 13:55:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709560535; bh=3M+/bQX/v9G+J1KliPz9dmTJESbLCH9kKdvpsKmgcrk=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=FLDRcz66TGjYLfnsEHY5VDgqohIRmf+bAFveGtZvAn4+hJhHQg5WGAKNzH6bfQZj1 DvUaUGLWWkVLOoN60YANjjy73WlQwO/99pLjH8+WE5mXTLX37FyOh9XsVBmJJE78GI DqHRBwU8SkM2SavBcA1NmPJhu4NoDzhTX+6aBztA5Wtmih3RlhDUnK+JJObdbfkxxf oKovzk568dFn9R0JpJNKFeioKvOuMC93Ut6XAG04Y9xRv7/EIr1dRRBJrmhlewHb7Y m8iiWKQxS6WxH9I4liCvcOi871N2fkBzIIefaou/q/d1nV/icVWgB/6+Xfm5xEDAF1 Q60Sx8A5gJdZA== Received: by mail-lj1-f180.google.com with SMTP id 38308e7fff4ca-2d275e63590so63086041fa.2 for ; Mon, 04 Mar 2024 05:55:34 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCUJfkhUVVUoFCqWThcSb9A60fqplU5cRVAgUx7uDeUNabAV0wUpO0XF4zd3Ai2zyJ92IVA/+RTBqSI97u+AKXO6mo8hqbwnuHQKrbor X-Gm-Message-State: AOJu0Yw6cfsL5HOC1vUDBlb7U1dnBtC8RaZvmHjZLKzM29ZEjj2T33wY r4jdmdctRkvkzvh71TboTQ9D9lPdOv69Dop6v5sckB0GvXUSyVAkL5mqtTbi2LZ4s0lfzm9ftcy qIu9se9Cy6xwPNHBwgI1tyitvRgM= X-Received: by 2002:a2e:a4ae:0:b0:2d3:4652:b2ff with SMTP id g14-20020a2ea4ae000000b002d34652b2ffmr5751566ljm.40.1709560533267; Mon, 04 Mar 2024 05:55:33 -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> <61aa333f-aa13-4068-b73f-eeae615f4640@app.fastmail.com> In-Reply-To: <61aa333f-aa13-4068-b73f-eeae615f4640@app.fastmail.com> From: Ard Biesheuvel Date: Mon, 4 Mar 2024 14:55:21 +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 14:49, Arnd Bergmann wrote: > > On Mon, Mar 4, 2024, at 14:01, Ard Biesheuvel wrote: > > On Mon, 4 Mar 2024 at 13:35, Arnd Bergmann wrote: > >> On Mon, Mar 4, 2024, at 12:45, Andre Przywara wrote: > >> 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. > > I meant it will use the optimization after the patch to convert > the plain '/' to div_u64(). > Ah ok. I did not realize we implement the same optimization in our code as the one that GCC will apply when encountering a compile-time constant divisor. > > 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); > > } > > I think the div_u64()->do_div()->__div64_const32()->__arch_xprod_64() > optimization in asm-generic/div64.h already produces what we want > on both compilers. Is there something missing there? > No, you are right. I thought we were relying on GCC for the optimization here.