Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp930571pxj; Fri, 11 Jun 2021 15:50:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJznKS/V8dHEFYm2AZx7mL7tPTEnEtwUwTKyuhQsAnucMLBLXMjw9kNCTESJ6G+8qFg3Rz9u X-Received: by 2002:a05:6402:1bd1:: with SMTP id ch17mr6046198edb.357.1623451832242; Fri, 11 Jun 2021 15:50:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623451832; cv=none; d=google.com; s=arc-20160816; b=oZYmiNTaxvNs6PYHKjzeahY9u6Ks1Q2l/+qsz2uYkDz1s/qpGnw9tq2TkLRTGHXP5X eqCLFmkmimE/D0HiHXoLgn4dNAkFPC4pIqFttgQSgRodTfiotjeQciAAWoqg5iVQJt1y WwyhX7Q8IqfdjXP09vDTC0vOHie/S8PsoxjhWqsROl8eZ3M0fO2wFVuNBVxVH0aVM738 75F1gLYu8aooyVCYv2h588tTQNrZLbFr7QilD0OJ42g/IpGBZEPM4bPWeYFBgq4IO2Tn p8hf1TksJINIycVdSSxdsaGVF+dEcVL8qoYpAGxzZFO921NC2MncU5PyOYpF4zDXbkzF PHBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=6rvf5L4W0BgzIeLS2ozoFK1m7OBX1sX/bY4Ev93bTqE=; b=VdfOaWethciucHR6HTEEYmWfllmLxScaYoCChqC6M78MtY3a70MNFAMIiHW/dhjzt3 lSdauPOfNw5m8z0jSKqG3M+MmTzn8vPr89NNNeY1FzjSBN7mGniJjYYbnAGdT2H4Ps6e w58QegtsCIN7ed5qW0ZfkWiPqGNQ5L2Rv4MbdWBX0paCKfU8ICmyZNnp46v7xEyHXcAQ hCzYduOFAs2WqYEVpS5kTqNWdcwk4RqRAdwitaQ2cgl7DIiNcOf2fcvng6IAU0Lxvy9V ij11y38OkhOvplsvgEJ9prKG4ln+wr51+w0TX3s5S3h89+0s1AwnbX5xEXt9k1nFnGsF Uf1w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u26si5959734ejz.348.2021.06.11.15.50.09; Fri, 11 Jun 2021 15:50:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230377AbhFKWsy (ORCPT + 99 others); Fri, 11 Jun 2021 18:48:54 -0400 Received: from mail104.syd.optusnet.com.au ([211.29.132.246]:51773 "EHLO mail104.syd.optusnet.com.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229777AbhFKWsx (ORCPT ); Fri, 11 Jun 2021 18:48:53 -0400 Received: from dread.disaster.area (pa49-179-138-183.pa.nsw.optusnet.com.au [49.179.138.183]) by mail104.syd.optusnet.com.au (Postfix) with ESMTPS id 284F6862B88; Sat, 12 Jun 2021 08:46:38 +1000 (AEST) Received: from dave by dread.disaster.area with local (Exim 4.92.3) (envelope-from ) id 1lrpvC-00Bgjv-D7; Sat, 12 Jun 2021 08:46:38 +1000 Date: Sat, 12 Jun 2021 08:46:38 +1000 From: Dave Chinner To: Geert Uytterhoeven Cc: Dave Chinner , Chandan Babu R , "Darrick J . Wong" , Allison Henderson , Christoph Hellwig , linux-xfs@vger.kernel.org, Linux-Next , Linux Kernel Mailing List , noreply@ellerman.id.au Subject: Re: [PATCH] xfs: Fix 64-bit division on 32-bit in xlog_state_switch_iclogs() Message-ID: <20210611224638.GT664593@dread.disaster.area> References: <20210610110001.2805317-1-geert@linux-m68k.org> <20210610220155.GQ664593@dread.disaster.area> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.3 cv=F8MpiZpN c=1 sm=1 tr=0 a=MnllW2CieawZLw/OcHE/Ng==:117 a=MnllW2CieawZLw/OcHE/Ng==:17 a=kj9zAlcOel0A:10 a=r6YtysWOX24A:10 a=7-415B0cAAAA:8 a=tBb2bbeoAAAA:8 a=sw44Y3MIkDGLgX3rhVgA:9 a=CjuIK1q_8ugA:10 a=biEYGPWJfzWAr4FL6Ov7:22 a=Oj-tNtZlA1e06AYgeCfH:22 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 11, 2021 at 08:55:24AM +0200, Geert Uytterhoeven wrote: > Hi Dave, > > On Fri, Jun 11, 2021 at 12:02 AM Dave Chinner wrote: > > On Thu, Jun 10, 2021 at 01:00:01PM +0200, Geert Uytterhoeven wrote: > > > On 32-bit (e.g. m68k): > > > > > > ERROR: modpost: "__udivdi3" [fs/xfs/xfs.ko] undefined! > > > > > > Fix this by using a uint32_t intermediate, like before. > > > > > > Reported-by: noreply@ellerman.id.au > > > Fixes: 7660a5b48fbef958 ("xfs: log stripe roundoff is a property of the log") > > > Signed-off-by: Geert Uytterhoeven > > > --- > > > Compile-tested only. > > > --- > > > fs/xfs/xfs_log.c | 4 ++-- > > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > > > > > 64 bit division on 32 bit platforms is still a problem in this day > > and age? > > They're not a problem. But you should use the right operations from > , iff you really need these expensive operations. See, that's the whole problem. This *isn't* obviously a 64 bit division - BBTOB is shifting the variable down by 9 (bytes to blocks) and then using that as the divisor. The problem is that BBTOB has an internal cast to a 64 bit size, and roundup() just blindly takes it and hence we get non-obvious compile errors only on 32 bit platforms. We have type checking macros for all sorts of generic functionality - why haven't these generic macros that do division also have type checking to catch this? i.e. so that when people build kernels on 64 bit machines find out that they've unwittingly broken 32 bit builds the moment they use roundup() and/or friends incorrectly? That would save a lot of extra work having fix crap like this up after the fact... Cheers, Dave. -- Dave Chinner david@fromorbit.com