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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id AB240C433EF for ; Mon, 11 Jul 2022 14:35:16 +0000 (UTC) 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: Subject:Cc:To:From:Message-ID:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=wM1+GThZ45BC0i4ln26E+9NiRBg0UN5JCO+ziovsMag=; b=TOJfsDDKJRo4ZA IgoJ6R21Z+vw2NDYFdsBKDIhTnRhB11yjLKyNuFpTfVhfVC/WrYzl6D8s7mmIVU0cOqchS1A9wlrr sXLsQULdF9eQbuRnbmFbb6p2rpUPwGPJwsIgT9VnOlm0JQnHhzBihncxm+wME72hnWmtuGi2nEic3 R++mYwUIRpFL/r/4XF4T9+CVdujQd5ik0nMFfL2HO5kTIdRFyFPO96PTux2HMhJZPdTgKzfiHIIaA glTrxKpOud+vZcc8KPQKHdLe2VgzLtjoMuiRnbdFzpcULVTjDeUpJAMBMR/nzs6kCSPv2+ESzNWIF en2x8qiNrC3twU9ObUTA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oAuU7-002M6n-Ul; Mon, 11 Jul 2022 14:34:04 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oAuU4-002M4Y-PN for linux-arm-kernel@lists.infradead.org; Mon, 11 Jul 2022 14:34:02 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 39B666152A; Mon, 11 Jul 2022 14:33:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9D38CC34115; Mon, 11 Jul 2022 14:33:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1657550037; bh=WH/GSsgDH8mWI7ojC7q2AHv8+SGuAofOvHOySdK3FbQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=lxD9E4OF0qQCwDVKXFZYaglqEVb6QfBtGGP6zc3/ow+DnR/Z7nE+amslwyUYsEO1Q YsAJ2MYa3DP9nAHKdAe7oRMo72kXxDa93xNl/pOgT5vuUI5rXefqjE0VoiT+A4dtiH uMWpeGQ/2dwDVs3isZLhnJZcZ/YEmEXdzkg1/6lYg1MCGTu1nXoWChfGBpxciJzvy3 54vMndMHO3yyZfKbpdwEp62OZcyTxVPjaQ6EXcigerWTvAI2wIHRxH1AbCp/Mftjja 0YfWhzyV0lv1Twe6KqHNs7KGsIzW8K9Wt3gvkUhDhw9crChqRRyagrfu+33NrdJRkF mQCawSlWQewnw== Received: from 82-132-215-190.dab.02.net ([82.132.215.190] helo=wait-a-minute.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1oAuTy-006hDZ-9d; Mon, 11 Jul 2022 15:33:54 +0100 Date: Mon, 11 Jul 2022 15:33:51 +0100 Message-ID: <87h73nlnw0.wl-maz@kernel.org> From: Marc Zyngier To: Mark Brown Cc: Catalin Marinas , Will Deacon , Zhang Lei , James Morse , Alexandru Elisei , Andre Przywara , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v2 2/7] arm64/fpsimd: Track the saved FPSIMD state type separately to TIF_SVE In-Reply-To: References: <20220620124158.482039-1-broonie@kernel.org> <20220620124158.482039-3-broonie@kernel.org> <87ilo4kmvx.wl-maz@kernel.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") X-SA-Exim-Connect-IP: 82.132.215.190 X-SA-Exim-Rcpt-To: broonie@kernel.org, catalin.marinas@arm.com, will@kernel.org, zhang.lei@jp.fujitsu.com, james.morse@arm.com, alexandru.elisei@arm.com, andre.przywara@arm.com, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220711_073400_936544_CD8268D8 X-CRM114-Status: GOOD ( 32.75 ) 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 Mon, 11 Jul 2022 12:39:51 +0100, Mark Brown wrote: > > [1 ] > On Mon, Jul 11, 2022 at 10:40:50AM +0100, Marc Zyngier wrote: > > Mark Brown wrote: > > > > + enum fp_state *type; > > > For consistency: s/type/fp_type/ ? > > Sure if nobody else wants a different bikeshed. It really needs a > longer name like fp_state_t or something but that had it's own problems > with non-idiomaticness. I'm not talking about the name of the type, but about the name of the member in the struct fpsimd_last_state_struct. I'd like it to be homogeneous to the name you use in struct kvm_vcpu_arch. 'type' is way too vague a name, and maybe it should be fp_reg_type, as that's what it actually indicates. > > > > if (test_and_clear_tsk_thread_flag(task, TIF_SVE) || > > > - thread_sm_enabled(&task->thread)) > > > + thread_sm_enabled(&task->thread)) { > > > sve_to_fpsimd(task); > > > + task->thread.fp_type = FP_STATE_FPSIMD; > > > Can you move this assignment into the sve_to_fpsimd() helper? > > There are cases where we want a FPSIMD version of the state for > reading but don't want to affect the actual state of the process > (eg, if someone reads the FPSIMD registers via ptrace) so we don't > want to change the active register state just because we converted > it. Adding another API that does the convert and update didn't feel > like it was helping since you then have to remember which API does > what and we already have lots of similarly named functions for > slightly different contexts. I still think the state conversion should be self contained. Sprinkling this context tracking is bound to end-up with a bug, while documenting what is to be used when, or with a helper named explicitly enough ("extract_fp_from_sve()" springs to mind) for ptrace. > > > } else { > > > fpsimd_to_sve(current); > > > + current->thread.fp_type = FP_STATE_SVE; > > > Same thing here. > > There's not the same issue with reading FPSIMD state via the SVE APIs > but for consistency it seems best to always leave these updates in the > callers. I disagree again. I really want these things to be self-contained, and be able to reason about what they do from their name and the arguments they take (and even some documentation). Relying on some extra updates adds complexity to a difficult part of the kernel, and an even more difficult part of the architecture. Thanks, M. -- Without deviation from the norm, progress is not possible. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel