Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp3059452iob; Sun, 1 May 2022 05:43:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzUJ3EYq0WjFKpEirfqSf7f2XHKAveB0JJ0eagwNx74fwa/Gi/4Xi3GwInjGKb9R36CyOqf X-Received: by 2002:a05:6512:291:b0:472:5ad6:1624 with SMTP id j17-20020a056512029100b004725ad61624mr4494288lfp.100.1651408990627; Sun, 01 May 2022 05:43:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651408990; cv=none; d=google.com; s=arc-20160816; b=ZE5brhZEWk4ppEARH2gQj+9uFdt7kM82ycJuuosjSNFT65hPmIIyhShdpVtO8W1rXN erhiwC9ggFj9D5fzrsQwMo0fXKMA20HbNQpXbhazswFvoyyOgYGQfHX5N6IYixATiTJU VwWcfA7CRebIwiCDOQzb4QVcC8buVsqp6sHL0RkR2IZg/DYFkrUFrenD4Jz+h3+oLrIE dxEM5DbOmdLggbrpLfMDi/X/n265exmtNZnKXRheimrSTo5LSOOJG6THNJ7WWcKbfsoJ rIgx/vuRilDYefUk/nnaHI5M20ztb1Tw+zlh6fuG2mcoN0Df3JxK4QorGJBoFJOzxtNA AiSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:message-id :in-reply-to:subject:cc:to:from:date; bh=oAsO97OHw4lDNJGy6qEi1Qmv2C95Ug0kTTs79rj+lZI=; b=vUJ8+Wzqt0qNEqpNWxN0frI8yAFj1bhTtk7wG78xvWLpY84qqv0wS5wQZ17Adl2Gsk MACnmZqoKzb+x0B5EiZhPQNzitN3bexFtplf9voTrAFNvrVEyDPiVAvLHAWDuoWE0TQa LlHICP11pMtXiRyExUOLROigkSv0lXmtUxtRmpAnoPrPTei3e+M3qYkl3uD5ABjlzN8H N4Ntmg5l45ndBANJqYMYN7dHvYIheFHtQBbKDpoxdktdV1dLoaJEOjE8cHdzeOpwGTlH Y0CeN5sNCnaVJFPoD8Pej6Lchxr7EPprBhih3b/HZUWFVdxHiUwToNiFCxfz0w24ujGQ PiEQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e4-20020a2e8ec4000000b0024f131266e0si13480290ljl.572.2022.05.01.05.42.44; Sun, 01 May 2022 05:43:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383039AbiD3PmL (ORCPT + 99 others); Sat, 30 Apr 2022 11:42:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382994AbiD3Plh (ORCPT ); Sat, 30 Apr 2022 11:41:37 -0400 Received: from angie.orcam.me.uk (angie.orcam.me.uk [IPv6:2001:4190:8020::34]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0DBDFA2049; Sat, 30 Apr 2022 08:38:09 -0700 (PDT) Received: by angie.orcam.me.uk (Postfix, from userid 500) id 2B1B89200BF; Sat, 30 Apr 2022 17:38:08 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by angie.orcam.me.uk (Postfix) with ESMTP id 24B0A9200B3; Sat, 30 Apr 2022 16:38:08 +0100 (BST) Date: Sat, 30 Apr 2022 16:38:08 +0100 (BST) From: "Maciej W. Rozycki" To: Stephen Zhang cc: Thomas Bogendoerfer , liam.howlett@oracle.com, ebiederm@xmission.com, alobakin@pm.me, f.fainelli@gmail.com, paul@crapouillou.net, linux@roeck-us.net, anemo@mba.ocn.ne.jp, zhangshida , linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org Subject: Re: [PATCH v2] MIPS: undefine and redefine cpu_has_fpu when it is overrided In-Reply-To: Message-ID: References: <20220429032621.674865-1-starzhangzsd@gmail.com> <20220429095104.GA11365@alpha.franken.de> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 30 Apr 2022, Stephen Zhang wrote: > > Additionally I've thought of adding something like: > > > > #if cpu_has_fpu > > # undef cpu_has_fpu > > #endif > > > > or maybe even: > > > > #if cpu_has_fpu > > # error "Forcing `cpu_has_fpu' to non-zero is not supported" > > #endif > > > > to arch/mips/include/asm/cpu-features.h, but maybe that's an overkill. > > Yeah, but why do you think that's an overkill? There is a great chance > people will ignore the note of 'cpu_has_fpu', and it did happen. When > that happens, there should exist a way to point out or fix that. Maybe it's the language, but my intent has been to express my uncertainty here rather than asserting that indeed it is an overkill. People do make mistakes from time to time, both code writers and reviewers do. It's not clear to me where to draw the line for safety checks though. Here `cpu_has_fpu' is a bit unusual in that unlike with the other feature override macros we don't want it to expand to a non-zero constant. The comment didn't work twice, though I suspect both cpu-feature-overrides.h files may have been written before the comment went in (I'm fairly sure the IP30 port lived outside the tree for a while). But I have only added the comment in the first place when I tripped over the `nofpu' option not working for the machine I needed to run FPU emulator verification with, and several platforms were fixed alongside. Given these circumstances it probably makes sense to have such a safety check after all. > > I prefer just removing the #defines from ip27/ip30 cpu-feasture-overrides.h. > > Or isn't that enough for fixing the problem ? > > > > Thomas. > > So maybe that's why I don't think just removing the #defines from > ip27/ip30 cpu-feasture-overrides.h. is enough for fixing the problem. Well, that *is* the fix for the problem at hand, as this macro is not supposed to be defined such as to expand to a non-zero constant. Adding a safety check would be a separate improvement. Please feel free to submit one. We need to keep fixes and improvements as separate changes. For one fixes can be candidates for backporting while improvements are never backported; cf. Documentation/process/stable-kernel-rules.rst. I hope this clears your concerns. Let me know if you have further questions. Maciej