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 3C368C54E41 for ; Wed, 6 Mar 2024 18:55:11 +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:In-Reply-To:MIME-Version:References: 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=427NAD3CCSD9Y4pVM/QteBI3Sg33Mun+gVd1z5rDvWk=; b=VXLjTCT532iHg9 oI2JjfvRKoj7mScF+OjW34uiGgaaeBDrpf6IvvKFkWrL0iR5RhOI+WiSzMc+avmLoln07AYw1JSCX 8cuNjVwp+CvG2zzlcNiyeFEU0TUGJw0dlzDrh5Y4Nslf0tB9W+WqPmXatdX2G3rff9XrrlK7KB3pM 8ZcJ04mfFcOJJ4igfvS6mnMdNEcmw5VK9T+CeuB9tVuBWRWKdFQ3Ex7Y9AMJE8cdWaQ6CMX5e4prY LBIL/iCNooV2X/sO4bVSvmzvon1ETuZCjlkMXOS8g8leXEVpCoESVsQ6KvBHZTrqUDPcjuJ97n/hK rt5sff8ulfBCKM63Jjrw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rhwPu-00000001Y6I-1zFU; Wed, 06 Mar 2024 18:55:02 +0000 Received: from sin.source.kernel.org ([2604:1380:40e1:4800::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rhwPq-00000001Y57-11VW for linux-arm-kernel@lists.infradead.org; Wed, 06 Mar 2024 18:55:00 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id BDD73CE2336; Wed, 6 Mar 2024 18:54:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B25FFC433C7; Wed, 6 Mar 2024 18:54:53 +0000 (UTC) Date: Wed, 6 Mar 2024 18:54:51 +0000 From: Catalin Marinas To: Mark Brown Cc: Will Deacon , Benjamin Herrenschmidt , Dave Martin , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4] arm64/fpsimd: Suppress SVE access traps when loading FPSIMD state Message-ID: References: <20240122-arm64-sve-trap-mitigation-v4-1-54e0d78a3ae9@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240122-arm64-sve-trap-mitigation-v4-1-54e0d78a3ae9@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240306_105458_475445_50926FD4 X-CRM114-Status: GOOD ( 19.96 ) 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, Jan 22, 2024 at 07:42:14PM +0000, Mark Brown wrote: > This indicates that there should be some useful benefit from reducing the > number of SVE access traps for blocking system calls like we did for non > blocking system calls in commit 8c845e273104 ("arm64/sve: Leave SVE enabled > on syscall if we don't context switch"). Let's do this by counting the > number of times we have loaded FPSIMD only register state for SVE tasks > and only disabling traps after some number of times, otherwise leaving > traps disabled and flushing the non-shared register state like we would on > trap. It looks like some people complain about SVE being disabled, though I assume this is for kernels prior to 6.2 and commit 8c845e273104 ("arm64/sve: Leave SVE enabled on syscall if we don't context switch"): https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/1999551/comments/52 I assume we may see the other camp complaining about the additional state saving on context switch. Anyway, I don't see why we should treat blocking syscalls differently from non-blocking ones (addressed by the commit above). I guess the difference is that one goes through a context switch but, from a user perspective, it's still a syscall. The SVE state is expected to be discarded and there may be a preference for avoiding the subsequent fault. > I pulled 64 out of thin air for the number of flushes to do, there is > doubtless room for tuning here. Ideally we would be able to tell if the > task is actually using SVE but without using performance counters (which > would be substantial work) we can't currently tell. I picked the number > because so many of the tasks using SVE used it so frequently. So I wonder whether we should make the timeout disabling behaviour the same for both blocking and non-blocking syscalls. IOW, ignore the context switching aspect. Every X number of returns, disable SVE irrespective of whether it was context switched or not. Or, if the number of returns has a variation in time, just use a jiffy (or other time based figure), it would time out in the same way for all types of workloads. -- Catalin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel