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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D5E56C43334 for ; Thu, 7 Jul 2022 04:23:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234788AbiGGEXA (ORCPT ); Thu, 7 Jul 2022 00:23:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231676AbiGGEW5 (ORCPT ); Thu, 7 Jul 2022 00:22:57 -0400 Received: from mailbox.box.xen0n.name (mail.xen0n.name [115.28.160.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0FC342FFE1 for ; Wed, 6 Jul 2022 21:22:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xen0n.name; s=mail; t=1657167773; bh=kVK+K1j5mB45c4TjayXPR0CHym4BWHEeRog+G28gmD4=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=isW7nzFD73L6p2ml5+cAPqYl4RKlNVriE6R+uySXyUk146ghNKzC/K9WSfQrT1NOq hL/GcXSW4BJhw7YBkg7ABoC9BZeAEzNHDtNJXLiF0XcnF8pV120J/ZNh7uUZXKvHRf CSsA3C1+iC/yQ3PQDRIDP70wOQI8tjAaXOW18aHA= Received: from [100.100.57.190] (unknown [220.248.53.61]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mailbox.box.xen0n.name (Postfix) with ESMTPSA id 037FE6010B; Thu, 7 Jul 2022 12:22:52 +0800 (CST) Message-ID: Date: Thu, 7 Jul 2022 12:22:52 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:104.0) Gecko/20100101 Thunderbird/104.0a1 Subject: Re: [PATCH v2] LoongArch: Clean useless vcsr in loongarch_fpu. To: Xi Ruoyao , WANG Xuerui , Qi Hu , Jiaxun Yang , Huacai Chen Cc: loongarch@lists.linux.dev, LKML References: <20220704153612.314112-1-huqi@loongson.cn> <4273e104-8392-6a06-5d18-a1933978d8c3@xen0n.name> <22a1ba993e298ce12a374decefebeca484240883.camel@xry111.site> <16c9ccaa5e5a2ffd39272cff6f66e487c659b571.camel@xry111.site> <9d064771-9402-4e84-96f8-4713cddf42f2@www.fastmail.com> <730cb4c4-a6a3-783e-3e4c-7c2bdc35c088@loongson.cn> <0583a335-72f7-55cf-3cd9-4dbd8109a440@xen0n.name> Content-Language: en-US From: WANG Xuerui In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2022/7/7 12:04, Xi Ruoyao wrote: > On Thu, 2022-07-07 at 11:05 +0800, WANG Xuerui wrote: > >> To be frank, at this point I think you're trying to hide something. >> (This is not your fault, blame someone else of course because they told >> you the fact.) In the old-world kernel the VCSR a.k.a. FCSR16 is >> certainly being saved/restored, and there's apparently no harm in doing >> so. And if the contents are indeed "undefined", why are the code there >> in the first place? Certainly the bits *are* meaningful, only that for >> some reason you aren't revealing the semantics and pretending that they >> are "undefined" and probably "do nothing externally observable" if >> accessed in the first place. > On a 3A5000LL, I did an experiment via a kernel module, which enables > LSX/LASX and tries to write and read fcsr16. I tried each bit (1, 2, 4, > 8, ..., 1 << 31) one by one. The result: no matter which bit I wrote > into fcsr16, I always read out 0. > > And I've objdump'ed a kernel shipped in an early Loongnix release. It > seems the only reference to fcsr16 is a "movgr2fcsr $r16, $r0" > instruction. Hmm this is weird. I can't understand why the vcsr code was there in the first place then... I'd like to check a few Loongnix/Kylin/UOS kernels but currently I don't have the time. If this is the case, indeed all vcsr-related code should be removed. Although I'm still not sure how to best word the commit message.