Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp6408403rdb; Tue, 2 Jan 2024 00:09:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IG5hHDkAgxfg7NZcZNDzErYceAnatiD6FJcxoGmmJB9k+FNers++iu1pRTyRVGxDRT+bG13 X-Received: by 2002:a05:6a20:6625:b0:195:635c:22df with SMTP id n37-20020a056a20662500b00195635c22dfmr4710670pzh.26.1704182967273; Tue, 02 Jan 2024 00:09:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704182967; cv=none; d=google.com; s=arc-20160816; b=vhNVfud9K0o6gszyhbsmYypUcI57Gn6TnWBBnASm+EhHUbW7m0RYb8xXfOI7+kicym GAtLLBlXU79EgKbalMTxIGxI7hkenKfBh+oie3g0m25R6tXUJv82pdn3KDUkts+y21eF /rhvvQFGznK/njjC6NenTqt8sXttFCmRk6GeeJmCcYUZk163ted8yTID41NTVkG8I1EA mcj6gSSnuohEcT7MVfvdMYqxh6dCUjkemM1DlFYWeuYIMU5eXGjmql5ajws/0ZXmLxDZ ReYUQqDFD5fYgyhcCuAgZLnbU+yTRmPRQVrxYfB5m9/tKIllKIR9E/wheYYLU3UaRw1x L/FQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:content-transfer-encoding:autocrypt:references :in-reply-to:date:cc:to:from:subject:message-id:dkim-signature; bh=YrwVmHqH1leX4YjLRMffPxxvyzlmVEBA3aGOy2ib/BA=; fh=1Vvbfwpv7NmPuTSR12x8EIQGUEDFe+iXjU1aNVscHA8=; b=ZRVTHA3Pu46GGDpdp4c0FMdYdualiWMm6+uRAeM7YzBrB7NiOW1VL2gLdR4//qSHUy 7ggqR8mOl02eWylQybGJLrCpGxC9ZE0cR8YsLekdokhSQXtpLE7YBmHpvjxp+3HJQ4Bw Cd2QmtUV15xXxJQdJMpyD9kba15lpFYPmCMDdCFptE2sAG6CbHPu43WT2AJoEXLdjbgW 9BdP1zqQIHzdNvE536cB+HZi5gEn9yvZ0h/Tj0vSIWLP7v9KCAFaje1159Fb/hnQ2Xyo qvN973g8UAAVPr3I/q8TXokXyxTnhuT4xjXUGhwEaAX0TgSHKfFUPnOB4l/Qo8IqNKmR AAWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@xry111.site header.s=default header.b=VkxwVMqd; spf=pass (google.com: domain of linux-kernel+bounces-14132-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14132-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=xry111.site Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id v190-20020a632fc7000000b005c658bf30aasi19910723pgv.412.2024.01.02.00.09.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 00:09:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-14132-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@xry111.site header.s=default header.b=VkxwVMqd; spf=pass (google.com: domain of linux-kernel+bounces-14132-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14132-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=xry111.site Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id E8E7C28117E for ; Tue, 2 Jan 2024 08:09:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 15304468E; Tue, 2 Jan 2024 08:09:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=xry111.site header.i=@xry111.site header.b="VkxwVMqd" X-Original-To: linux-kernel@vger.kernel.org Received: from xry111.site (xry111.site [89.208.246.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1554D2116; Tue, 2 Jan 2024 08:09:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=xry111.site Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=xry111.site DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xry111.site; s=default; t=1704182949; bh=rfgD7wZxYb3q3Dx3Za3Q0wUzALNwOb57oBPgRsgGEhg=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=VkxwVMqdveqAGWhyd+OVaZM8AZENzYgSY/np/cKWR/nmvD0l8poLVV4Xsh3p6yvUO VjncBlXIdtzeQp+9FKVTutNAiCq1wOXwpV458UztG/CuQQwnLVA4hs1wY9SWH0D3kn sj/5k2Bszg9lJwNZ+SZPdHij4UebdjlOybIsVWMQ= Received: from [IPv6:240e:358:11a9:2200:dc73:854d:832e:3] (unknown [IPv6:240e:358:11a9:2200:dc73:854d:832e:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) (Authenticated sender: xry111@xry111.site) by xry111.site (Postfix) with ESMTPSA id 392B366963; Tue, 2 Jan 2024 03:09:04 -0500 (EST) Message-ID: <22af410fe1f60e7fc04cafbe03cfc50b36b53ae3.camel@xry111.site> Subject: Re: [PATCH] LoongArch: Fix and simplify fcsr initialization on execve From: Xi Ruoyao To: Huacai Chen Cc: WANG Xuerui , Eric Biederman , Kees Cook , Tiezhu Yang , Jinyang He , Jiaxun Yang , loongarch@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Date: Tue, 02 Jan 2024 16:09:00 +0800 In-Reply-To: References: <20240101172143.14530-2-xry111@xry111.site> Autocrypt: addr=xry111@xry111.site; prefer-encrypt=mutual; keydata=mDMEYnkdPhYJKwYBBAHaRw8BAQdAsY+HvJs3EVKpwIu2gN89cQT/pnrbQtlvd6Yfq7egugi0HlhpIFJ1b3lhbyA8eHJ5MTExQHhyeTExMS5zaXRlPoiTBBMWCgA7FiEEkdD1djAfkk197dzorKrSDhnnEOMFAmJ5HT4CGwMFCwkIBwICIgIGFQoJCAsCBBYCAwECHgcCF4AACgkQrKrSDhnnEOPHFgD8D9vUToTd1MF5bng9uPJq5y3DfpcxDp+LD3joA3U2TmwA/jZtN9xLH7CGDHeClKZK/ZYELotWfJsqRcthOIGjsdAPuDgEYnkdPhIKKwYBBAGXVQEFAQEHQG+HnNiPZseiBkzYBHwq/nN638o0NPwgYwH70wlKMZhRAwEIB4h4BBgWCgAgFiEEkdD1djAfkk197dzorKrSDhnnEOMFAmJ5HT4CGwwACgkQrKrSDhnnEOPjXgD/euD64cxwqDIqckUaisT3VCst11RcnO5iRHm6meNIwj0BALLmWplyi7beKrOlqKfuZtCLbiAPywGfCNg8LOTt4iMD Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.50.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 On Tue, 2024-01-02 at 10:35 +0800, Huacai Chen wrote: /* snip */ > > The only other architecture setting FCSR in SET_PERSONALITY2 is MIPS. > > They do this for supporting different FP flavors (NaN encodings etc). > > which do not exist on LoongArch.=C2=A0 I'm not sure how MIPS evades the= issue > > (or maybe it's just buggy too) as I don't have a running MIPS hardware > > now. > I think you can use QEMU. :) I'll investigate it later. > > So for LoongArch, just remove the current->thread.fpu.fcsr setting from > > SET_PERSONALITY2 and do it in start_thread, after lose_fpu(0).=C2=A0 An= d we > > just set it to 0, instead of boot_cpu_data.fpu_csr0 (because we should > > provide the userspace a consistent configuration, no matter how hardwar= e > > and firmware behave). > I still prefer to set fcsr to boot_cpu_data.fpu_csr0, because we will > add LoongArch32 later, not sure whether something will change. I just seen fpu_csr0 is initialized to FPU_CSR_RN which is just 0 for LA64, so my concern about firmware & hardware leaving non-zero FCSR is not valid. I'll send v2 to keep using boot_cpu_data.fpu_csr0 then. >=20 >=20 --=20 Xi Ruoyao School of Aerospace Science and Technology, Xidian University