From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751526AbcBLRFP (ORCPT ); Fri, 12 Feb 2016 12:05:15 -0500 Received: from mout.kundenserver.de ([212.227.17.10]:57241 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750945AbcBLRFM (ORCPT ); Fri, 12 Feb 2016 12:05:12 -0500 From: Arnd Bergmann To: Mauro Carvalho Chehab Cc: linux-arm-kernel@lists.infradead.org, Nicolas Pitre , Stefan Richter , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] [media] zl10353: use div_u64 instead of do_div Date: Fri, 12 Feb 2016 18:04:31 +0100 Message-ID: <2712691.b9gkR7KMX7@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) In-Reply-To: <20160212143220.5a440e66@recife.lan> References: <1455287246-3540549-1-git-send-email-arnd@arndb.de> <20160212143220.5a440e66@recife.lan> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:3wKO4OE9yfHEoDOB39yK9fk/Wvu1yQ3ZXdTpITO7iAylzJacjGo /WJPPHjAmY+eu++27qpOz20RufDe1ASf4yv49oImpUn6MxnzNpMsRPf4ncZVvM9tSuc/F6Q IeNuSG+g/9rG1vnbivDPlRqgLv2DHwuYyoZe7chb0DMDpcqUKsqz1F2jsS//q5XnMF9Dl5h SvFoOdKYlIci+PntdhfxA== X-UI-Out-Filterresults: notjunk:1;V01:K0:8sSdOnPe5Kg=:xDjUj4xHrtj7KursFhSKpU y+IiYLykMAh5po+CBetTpRdFY//0Xh0L7jgBpNeb5pfV27tT3gpRa2K9E0artKjJ50+K4oJr6 I1O2uqs0XFnXM0HbMMWa1zNFV66STNrh+LaH8Z6IZn14gKVCzwWhUOlPT3P45KIDSvgXTRFtD UJbj0SPhHpAQYohFx4koipwe4TTzGKN+XEqwOPHYEvuurgKcngYrDX6P063FKmwbmyKiGy3nC Aqk0Bc3HLDmdwdOO1gbQrD/qJaxNc4lnn/svpYg+DtbiWkSOcV76yNgnBde3RDurZkb86r6rf UV8cpy7teUDNxearcQK/akmFs4vma93DWqplBgQ/m0hhAFfVkMj0MOGalZnZp+20quzugK7dV 1DjOqW7fsoS4M7yjidUVvCMrImqMSSrNez3dgBoGbYK//BxNz7w0I3oXOvxWLG3bRk/jBrdMv N/qp7IeFAEfbYMC2uj5LZnu/mAYL3bhnYLuOZVdUDgqPqrnNWGTprfPr4TYKVRvk7uyanbKfz NlJU9B6ekYmHyAyGxgLyMX6X1W5PX34clLoPNDHDaaIwYY5JVQ2kf3jjWA2eZq087rn9t31Qe Hrf/eOPL+0maOjJm93BhsNu7mo8suswxbrwSBDqcxXbLb9FEg1GsvXkt/lmJz8DCiBRME5OHG aGuldTs0uMotMp0/b49xx61UZ0xdjIbr09b1pNu+6m83hzarzwYe1ZF/4nwEauSs3FG2jgliw uozQIWbJ6yn+qH3M Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Friday 12 February 2016 14:32:20 Mauro Carvalho Chehab wrote: > Em Fri, 12 Feb 2016 15:27:18 +0100 > Arnd Bergmann escreveu: > > > I noticed a build error in some randconfig builds in the zl10353 driver: > > > > dvb-frontends/zl10353.c:138: undefined reference to `____ilog2_NaN' > > dvb-frontends/zl10353.c:138: undefined reference to `__aeabi_uldivmod' > > > > The problem can be tracked down to the use of -fprofile-arcs (using > > CONFIG_GCOV_PROFILE_ALL) in combination with CONFIG_PROFILE_ALL_BRANCHES > > on gcc version 4.9 or higher, when it fails to reliably optimize > > constant expressions. > > > > Using div_u64() instead of do_div() makes the code slightly more > > readable by both humans and by gcc, which gives the compiler enough > > of a break to figure it all out. > > I'm not against this patch, but we have 94 occurrences of do_div() > just at the media subsystem. If this is failing here, it would likely > fail with other drivers. So, I guess we should either fix do_div() or > convert all such occurrences to do_div64(). I agree that it's possible that the same problem exists elsewhere, but this is the only one that I ever saw (in five ranconfig builds out of 8035 last week). I also tried changing do_div() to be an inline function with just a small macro wrapper around it for the odd calling conventions, which also made this error go away. I would assume that Nico had a good reason for doing do_div() the way he did. In some other files, I saw the object code grow by a few instructions, but the examples I looked at were otherwise identical. I can imagine that there might be cases where the constant-argument optimization of do_div fails when we go through an inline function in some combination of Kconfig options and compiler version, though I don't think that was the case here. Nico, any other thoughts on this? Arnd