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 X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 02472C433E0 for ; Wed, 3 Mar 2021 16:21:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A3F4D64E6F for ; Wed, 3 Mar 2021 16:21:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232733AbhCCQMO (ORCPT ); Wed, 3 Mar 2021 11:12:14 -0500 Received: from angie.orcam.me.uk ([157.25.102.26]:37256 "EHLO angie.orcam.me.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350530AbhCCC47 (ORCPT ); Tue, 2 Mar 2021 21:56:59 -0500 Received: by angie.orcam.me.uk (Postfix, from userid 500) id E939B92009C; Wed, 3 Mar 2021 03:56:13 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by angie.orcam.me.uk (Postfix) with ESMTP id DD7FD92009B; Wed, 3 Mar 2021 03:56:13 +0100 (CET) Date: Wed, 3 Mar 2021 03:56:13 +0100 (CET) From: "Maciej W. Rozycki" To: yunqiang.su@cipunited.com cc: Thomas Bogendoerfer , jiaxun.yang@flygoat.com, linux-mips@vger.kernel.org Subject: =?UTF-8?Q?Re=3A_=E5=9B=9E=E5=A4=8D=3A_=5BPATCH_v6=5D_MIPS=3A_fo?= =?UTF-8?Q?rce_use_FR=3D0_for_FPXX_binary?= In-Reply-To: <000701d70fd0$ecbb21a0$c63164e0$@cipunited.com> Message-ID: References: <20210302022907.1835-1-yunqiang.su@cipunited.com> <000701d70fd0$ecbb21a0$c63164e0$@cipunited.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org On Wed, 3 Mar 2021, yunqiang.su@cipunited.com wrote: > > > v5->v6: > > > Rollback to V3, aka remove config option. > > > > You can't reuse v3 as it stands because it breaks R6 as we previously > > discussed. You need to tell R6 and earlier ISAs apart and set the FR bit > > accordingly. > > > > It won't break r6, as all of r6 binary is FP64, and on r6 > `frdefault' is always false, and `fr1' is always true. > It won't trigger this mode switch. > > Oh, you are right, there may be a case that to run legacy app on r6 CPU. > For this case, on r6, we need to set the CPU to FRE mode. The FRE mode causes a severe performance regression for single FP operations, so we shouldn't use it for FPXX software. As a matter of interest: do you have figures available as to how many software packages are affected in Debian? Also it has now struck me that another userland workaround should be possible, by setting LD_PRELOAD in the environment system-wide to a dummy FR=0 DSO (e.g. via /etc/environment or /etc/initscript; I reckon systemd has its own way too), which will force the right mode the normal way. All the distribution has been built for FPXX I presume, right? You can distribute a package with the dummy along with the environment entry to all the people who require it. I fail to see how it could be more problematic than getting a questionable hack included in the kernel forever and then requiring everyone to upgrade the relevant packages anyway, which you will have to supply for stable releases too. Or I guess you could just rebuild libc as FR=0 instead, or is there a Golang standard library that every Golang program uses? And then have people upgrade that package instead. It seems to me like there are still a couple of alternatives available. You might be able to come up with yet more if you continued looking for them. I consider putting any workaround into the kernel the last resort really. The problem is in the userland, so let's try hard to deal with it there. Maciej