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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1217BC4332F for ; Mon, 11 Oct 2021 09:40:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E5158610F8 for ; Mon, 11 Oct 2021 09:40:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235500AbhJKJmV (ORCPT ); Mon, 11 Oct 2021 05:42:21 -0400 Received: from frasgout.his.huawei.com ([185.176.79.56]:3955 "EHLO frasgout.his.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235587AbhJKJmU (ORCPT ); Mon, 11 Oct 2021 05:42:20 -0400 Received: from fraeml701-chm.china.huawei.com (unknown [172.18.147.200]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4HSYc71Y7Zz67Zw0; Mon, 11 Oct 2021 17:37:27 +0800 (CST) Received: from lhreml710-chm.china.huawei.com (10.201.108.61) by fraeml701-chm.china.huawei.com (10.206.15.50) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.8; Mon, 11 Oct 2021 11:40:18 +0200 Received: from localhost (10.52.122.204) by lhreml710-chm.china.huawei.com (10.201.108.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.8; Mon, 11 Oct 2021 10:40:17 +0100 Date: Mon, 11 Oct 2021 10:39:59 +0100 From: Jonathan Cameron To: Mark Brown CC: Catalin Marinas , Will Deacon , Shuah Khan , Shuah Khan , "Alan Hayward" , Luis Machado , "Salil Akerkar" , Basant Kumar Dwivedi , Szabolcs Nagy , , Subject: Re: [PATCH v1 01/38] arm64/fp: Reindent fpsimd_save() Message-ID: <20211011103959.00003d8a@Huawei.com> In-Reply-To: <20210930181144.10029-2-broonie@kernel.org> References: <20210930181144.10029-1-broonie@kernel.org> <20210930181144.10029-2-broonie@kernel.org> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; i686-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.52.122.204] X-ClientProxiedBy: lhreml723-chm.china.huawei.com (10.201.108.74) To lhreml710-chm.china.huawei.com (10.201.108.61) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org On Thu, 30 Sep 2021 19:11:07 +0100 Mark Brown wrote: > Currently all the active code in fpsimd_save() is inside a check for > TIF_FOREIGN_FPSTATE. Reduce the indentation level by changing to return > from the function if TIF_FOREIGN_FPSTATE is set. > > Signed-off-by: Mark Brown Hi Mark Trivial formatting thing inline, but otherwise this is clearly a noop refactor as expected. > --- > arch/arm64/kernel/fpsimd.c | 38 ++++++++++++++++++++------------------ > 1 file changed, 20 insertions(+), 18 deletions(-) > > diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c > index ff4962750b3d..995f8801602b 100644 > --- a/arch/arm64/kernel/fpsimd.c > +++ b/arch/arm64/kernel/fpsimd.c > @@ -308,24 +308,26 @@ static void fpsimd_save(void) > WARN_ON(!system_supports_fpsimd()); > WARN_ON(!have_cpu_fpsimd_context()); > > - if (!test_thread_flag(TIF_FOREIGN_FPSTATE)) { > - if (IS_ENABLED(CONFIG_ARM64_SVE) && > - test_thread_flag(TIF_SVE)) { > - if (WARN_ON(sve_get_vl() != last->sve_vl)) { > - /* > - * Can't save the user regs, so current would > - * re-enter user with corrupt state. > - * There's no way to recover, so kill it: > - */ > - force_signal_inject(SIGKILL, SI_KERNEL, 0, 0); > - return; > - } > - > - sve_save_state((char *)last->sve_state + > - sve_ffr_offset(last->sve_vl), > - &last->st->fpsr); > - } else > - fpsimd_save_state(last->st); > + if (test_thread_flag(TIF_FOREIGN_FPSTATE)) > + return; > + > + if (IS_ENABLED(CONFIG_ARM64_SVE) && > + test_thread_flag(TIF_SVE)) { Trivial, but - the above now fits nicely on oneline under 80 chars. Looks like you have another instance of this in patch 21 in roughly the same place. Then you drop at least some of this code later. hohum, maybe not worth tidying up. > + if (WARN_ON(sve_get_vl() != last->sve_vl)) { > + /* > + * Can't save the user regs, so current would > + * re-enter user with corrupt state. > + * There's no way to recover, so kill it: > + */ > + force_signal_inject(SIGKILL, SI_KERNEL, 0, 0); > + return; > + } > + > + sve_save_state((char *)last->sve_state + > + sve_ffr_offset(last->sve_vl), > + &last->st->fpsr); > + } else { > + fpsimd_save_state(last->st); > } > } > 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3BA92C433EF for ; Mon, 11 Oct 2021 09:42:53 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F3E7660EBB for ; Mon, 11 Oct 2021 09:42:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org F3E7660EBB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=Huawei.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Subject:CC:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=0jZj1ELFBKYtdEUGng5jnxP1Y7zIYEq1/Oy9NpwDXMU=; b=yFdDjkEq7sbb+k +hI2KE03jScP7NdxTzJtX+oetbTVJcWwlqXYKQBGU5jxoQCY7untmH/ykOpcKIXL2qBUoj/ZXbUAS gn1vCf7LtvsEPybS5+gsGQepBolN+LLQxK/B96kIubALWede2ZXrWNwtKJ9COb1h/NWnrmlicwACN IvwMhZrQicPo1EbXRznI1aSmMK6rPxg4Ro6oO7OszJ1IBKN68H+eZmhQBOe/eP5THotQZLAjJ83g/ atxT8yL717mxXBK9CiOZLHDp3jMfXeLzRbKokTKSf1himXeW57EShJSXm3xHD+NizSoX1lYncCYaw dbCIxDZJvWB/A0vnnrxA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mZrnT-008a41-6q; Mon, 11 Oct 2021 09:40:39 +0000 Received: from frasgout.his.huawei.com ([185.176.79.56]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mZrnE-008ZxT-MT for linux-arm-kernel@lists.infradead.org; Mon, 11 Oct 2021 09:40:26 +0000 Received: from fraeml701-chm.china.huawei.com (unknown [172.18.147.200]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4HSYc71Y7Zz67Zw0; Mon, 11 Oct 2021 17:37:27 +0800 (CST) Received: from lhreml710-chm.china.huawei.com (10.201.108.61) by fraeml701-chm.china.huawei.com (10.206.15.50) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.8; Mon, 11 Oct 2021 11:40:18 +0200 Received: from localhost (10.52.122.204) by lhreml710-chm.china.huawei.com (10.201.108.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.8; Mon, 11 Oct 2021 10:40:17 +0100 Date: Mon, 11 Oct 2021 10:39:59 +0100 From: Jonathan Cameron To: Mark Brown CC: Catalin Marinas , Will Deacon , Shuah Khan , Shuah Khan , "Alan Hayward" , Luis Machado , "Salil Akerkar" , Basant Kumar Dwivedi , Szabolcs Nagy , , Subject: Re: [PATCH v1 01/38] arm64/fp: Reindent fpsimd_save() Message-ID: <20211011103959.00003d8a@Huawei.com> In-Reply-To: <20210930181144.10029-2-broonie@kernel.org> References: <20210930181144.10029-1-broonie@kernel.org> <20210930181144.10029-2-broonie@kernel.org> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; i686-w64-mingw32) MIME-Version: 1.0 X-Originating-IP: [10.52.122.204] X-ClientProxiedBy: lhreml723-chm.china.huawei.com (10.201.108.74) To lhreml710-chm.china.huawei.com (10.201.108.61) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211011_024025_102346_1CB8BDF3 X-CRM114-Status: GOOD ( 19.30 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, 30 Sep 2021 19:11:07 +0100 Mark Brown wrote: > Currently all the active code in fpsimd_save() is inside a check for > TIF_FOREIGN_FPSTATE. Reduce the indentation level by changing to return > from the function if TIF_FOREIGN_FPSTATE is set. > > Signed-off-by: Mark Brown Hi Mark Trivial formatting thing inline, but otherwise this is clearly a noop refactor as expected. > --- > arch/arm64/kernel/fpsimd.c | 38 ++++++++++++++++++++------------------ > 1 file changed, 20 insertions(+), 18 deletions(-) > > diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c > index ff4962750b3d..995f8801602b 100644 > --- a/arch/arm64/kernel/fpsimd.c > +++ b/arch/arm64/kernel/fpsimd.c > @@ -308,24 +308,26 @@ static void fpsimd_save(void) > WARN_ON(!system_supports_fpsimd()); > WARN_ON(!have_cpu_fpsimd_context()); > > - if (!test_thread_flag(TIF_FOREIGN_FPSTATE)) { > - if (IS_ENABLED(CONFIG_ARM64_SVE) && > - test_thread_flag(TIF_SVE)) { > - if (WARN_ON(sve_get_vl() != last->sve_vl)) { > - /* > - * Can't save the user regs, so current would > - * re-enter user with corrupt state. > - * There's no way to recover, so kill it: > - */ > - force_signal_inject(SIGKILL, SI_KERNEL, 0, 0); > - return; > - } > - > - sve_save_state((char *)last->sve_state + > - sve_ffr_offset(last->sve_vl), > - &last->st->fpsr); > - } else > - fpsimd_save_state(last->st); > + if (test_thread_flag(TIF_FOREIGN_FPSTATE)) > + return; > + > + if (IS_ENABLED(CONFIG_ARM64_SVE) && > + test_thread_flag(TIF_SVE)) { Trivial, but - the above now fits nicely on oneline under 80 chars. Looks like you have another instance of this in patch 21 in roughly the same place. Then you drop at least some of this code later. hohum, maybe not worth tidying up. > + if (WARN_ON(sve_get_vl() != last->sve_vl)) { > + /* > + * Can't save the user regs, so current would > + * re-enter user with corrupt state. > + * There's no way to recover, so kill it: > + */ > + force_signal_inject(SIGKILL, SI_KERNEL, 0, 0); > + return; > + } > + > + sve_save_state((char *)last->sve_state + > + sve_ffr_offset(last->sve_vl), > + &last->st->fpsr); > + } else { > + fpsimd_save_state(last->st); > } > } > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel