Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1741645ybb; Thu, 9 Apr 2020 08:11:02 -0700 (PDT) X-Google-Smtp-Source: APiQypKyR4vyKXdzM1E1sdC5NQzmWByc/Fw1DFFPRwZ2UkdN0BCg12EuSgl5MpwqSI1gqc4up+7W X-Received: by 2002:ac8:18c3:: with SMTP id o3mr13084699qtk.49.1586445062289; Thu, 09 Apr 2020 08:11:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586445062; cv=none; d=google.com; s=arc-20160816; b=P4xiUzUNfO0I0nCP/fpCkEh/J/hSM/n5IPAkvv20PZa+nyh/a50JHyWWoGARypVjaJ ZwLAwmqhAIcu8YqFTBP4Bu/zX2fob8z+W9OEl5cCKIF9tQHo4QmbfEv6m6+Q5m711/2i 2VVzqFD8icLFzHgDM6rm7zGwNvHhC1oCQKGa+RZR3sSwWJI4gX0qXoRqN185zBhKvw2H 5QeQ/+S2J8s0rCiZ0cumeJMORTDGlemR8pnJQxrAZs3y5FprATU/Eq4ng2Q6+UY3ke0M +Rohqfm5lt61Oz3pwTyO+PaEEUiH4O9cqjt3WbQ4Vb4CH1oqy+9zqGUU6bpQn6eCo0C4 SRRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:message-id :in-reply-to:subject:cc:to:from:date; bh=VZ22+3wAbDk2r3E1v5EOBVA4zAZs8kp69GcyYqqO+Hg=; b=Zl3rOp6lpYRSreE/+P9qs2fR0m0Lmft2SrX0QoL446zokCfviAu1JtbWv2Pm9cK2// B5plCaDq+8W6+sZv0TSq4x/kZa2LVN5c8Jw0bI4gFesyfxttHcTGISIRYku7f88hfOrK LwbHUIT/KUb9/NVmt4WcpgA9ZahMMdLkxl/WEoAyZ9i1kNYVZYQDmUQ4Obk+3j2sEi8n LlVvtwnEAjgy9PrB5Q57Aq+3Uwr5rGBas0pAKdjUr2KBCkcAPwjueRWzDVIVVRcMXVns Hn0R2UbBjiAKE4co2pvZ3Xr2kB/9fB5DoXYKHV88qNa6DtO+qcP5rClI4YvE8mTKoJRM n5AA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e4si7577550qtw.72.2020.04.09.08.10.25; Thu, 09 Apr 2020 08:11:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727327AbgDIPHt (ORCPT + 99 others); Thu, 9 Apr 2020 11:07:49 -0400 Received: from eddie.linux-mips.org ([148.251.95.138]:39000 "EHLO cvs.linux-mips.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727736AbgDIPHt (ORCPT ); Thu, 9 Apr 2020 11:07:49 -0400 Received: (from localhost user: 'macro', uid#1010) by eddie.linux-mips.org with ESMTP id S23994900AbgDIPHqi08Bp (ORCPT + 1 other); Thu, 9 Apr 2020 17:07:46 +0200 Date: Thu, 9 Apr 2020 16:07:46 +0100 (BST) From: "Maciej W. Rozycki" To: Jiaxun Yang cc: YunQiang Su , Tiezhu Yang , Thomas Bogendoerfer , linux-mips , LKML , Xuefeng Li Subject: Re: [PATCH] MIPS: Limit check_bugs32() under CONFIG_32BIT In-Reply-To: <20200409150923.5b224361@flygoat-x1e> Message-ID: References: <1586401829-22242-1-git-send-email-yangtiezhu@loongson.cn> <20200409150923.5b224361@flygoat-x1e> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 9 Apr 2020, Jiaxun Yang wrote: > > > There is no need to build and call check_bugs32() under > > > CONFIG_64BIT, just limit it under CONFIG_32BIT. > > > > Since 32bit is subset of 64bit, and due to the code, I think that the > > initial purpose > > of check_bugs32() is also willing to run even with CONFIG_64BIT. > > > > For example, if we have a CPU which is 64bit, and work well on 64bit > > mode, while has a bug only on 32bit mode, check_bugs32 should be used > > here. > > > > Loongson's 3A 1000 is the example, I cannot support FP32 mode well. > > In this case bugs32 only contains a workaround for MIPS34K, which is a > MIPS32 processor. It's safe to do so. This is because commit c65a5480ff29 ("[MIPS] Fix potential latency problem due to non-atomic cpu_wait.") moved the other generic workaround elsewhere. The intent has been since historical commit 450ad16ba0ab ("Get rid of arch/mips64/kernel. 9116 lines of code gone.") that `check_bugs32' is for generic errata affecting both 32-bit and 64-bit operation (e.g. 32-bit instructions, which naturally may occur in both cases) and `check_bugs64' is for errata affecting 64-bit operation only (e.g. 64-bit instructions). But currently it appears we have no generic errata handled, as surely a 34K erratum cannot affect 64-bit operation. So I think such a change makes sense in principle (if a generic erratum appears in the future we can add a third category, which includes workarounds that are always applied), but I think it has to be made in a cleaner way. Specifically `check_errata' has to be renamed to `check_errata32', some commentary added as to the intent, and last but not least a proper change description added that not only repeats what the change does (and what everyone sees regardless), but actually justifies why the change is made. Saying: "There is no need[...]" does not tell us *why* there is no need. > But my suggestion is if you're going to clean-up bugs and workarounds > you'd better establish a file for silicon bugs and provide Kconfig > options to enable & disable them. Manage bug dependencies by Kconfig > will be easier. Why is using Kconfig supposed to be better? Several configurations support multiple processor types (e.g. swappable CPU daugthercards or FPGA soft-cores) and having to list CPU types across platforms as CPUs are added is going to be a maintenance nightmare. Whereas having workarounds or panics associated with run-time determination of the actual CPU type guarantees they will trigger where necessary. The use of `init' sections assures the reclaim of memory for use after bootstrap. OTOH I agree splitting off errata handling to a separate file may make sense for structural reasons; we have it already for `check_bugs64'. Maciej