Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3537838imu; Wed, 7 Nov 2018 11:52:57 -0800 (PST) X-Google-Smtp-Source: AJdET5edxqnEDNFjWXvuWb+6BiO1GCbRUQtKVzl5X7+6LL3aOtPSzEMJz0xjXoHnDT5GnvJ8IJRA X-Received: by 2002:a62:5a47:: with SMTP id o68-v6mr1598258pfb.31.1541620377828; Wed, 07 Nov 2018 11:52:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541620377; cv=none; d=google.com; s=arc-20160816; b=gBCpI45OV1sceFyZUwqxSkGGHTA/8qPECtTk1HuPuonYW55mUG5GAwcVDY6mkOWoMU PdCd8HwboH8ZQU8GWKyEGpvrSAgFCI/87yXlkdMgveuOzMuIY9p3J1NOX6Ko5wMLDwDH ULTDlYND1W/e0LH4ypjQDwoy/I3RpL5tupJh/Z6NNS1JPRXMY+j0QqWpdit8laUlocrM NYE1qYdiS8P8LEx3vZUEFJIHT7pwg2sxk3b3DPixzoGZqwPy7mffqSX2tmMs6CFH8+rc YipucyIiciayJfvDGPtKDXUhK3FhfGvYfCJvymOi+rpnIlJOOy2PBtC0bB2uAn6qyrtC XE6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=mvaSOx+q7BDedqZshy3LpvXTlHUtfxTs0SLogQnFnpU=; b=z7NHvMxULvt9sD0WVyO2dZ4z4MtzDtJ5SJFFJo/JF550dJt0GQH5XuODZjypiwLxoG 021f6u9Uanz9pRiHeqsqxp27Vc8Wa+QGaFrCYfdHji1nuerj8/+A6IJ5nbw1RkUgfez3 BtFChy8pVMWLXE0tf+GfwqO84xt2btsthaM44/6yQPtNRnNrAgt9gMHQOOSdRQGSfquS bgzkEF3BB8Q9SBGdlXH8sHazG48z14QH9km1bhrVIcdOE/V4ON8CK+SLb8FFtKTCDk3T JNc1NNbWTlERvTSlSqMpNSXXu87NjweJJxMOuDn4hmLV+cfr/095Ektr2frAfQb8nEwd fL7w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i63si1401651pge.515.2018.11.07.11.52.42; Wed, 07 Nov 2018 11:52:57 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727128AbeKHFVE (ORCPT + 99 others); Thu, 8 Nov 2018 00:21:04 -0500 Received: from Galois.linutronix.de ([146.0.238.70]:41841 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725953AbeKHFVD (ORCPT ); Thu, 8 Nov 2018 00:21:03 -0500 Received: from localhost ([127.0.0.1] helo=bazinga.breakpoint.cc) by Galois.linutronix.de with esmtp (Exim 4.80) (envelope-from ) id 1gKTp7-00070Q-NO; Wed, 07 Nov 2018 20:49:09 +0100 From: Sebastian Andrzej Siewior To: linux-kernel@vger.kernel.org Cc: x86@kernel.org, Andy Lutomirski , Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= , kvm@vger.kernel.org, "Jason A. Donenfeld" , Rik van Riel , Dave Hansen , Sebastian Andrzej Siewior Subject: [PATCH 05/23] x86/fpu: Remove preempt_disable() in fpu__clear() Date: Wed, 7 Nov 2018 20:48:40 +0100 Message-Id: <20181107194858.9380-6-bigeasy@linutronix.de> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181107194858.9380-1-bigeasy@linutronix.de> References: <20181107194858.9380-1-bigeasy@linutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The preempt_disable() section was introduced in commit a10b6a16cdad8 ("x86/fpu: Make the fpu state change in fpu__clear() scheduler-atomic") and it was said to be temporary. fpu__initialize() initializes the FPU struct to its "init" value and then sets ->initialized to 1. The last part is the important one. The content of the `state' does not matter because it gets set via copy_init_fpstate_to_fpregs(). A preemption here has little meaning because the register will always be set to the same content after copy_init_fpstate_to_fpregs(). A softirq with a kernel_fpu_begin() could also force to save FPU's register after fpu__initialize() without changing the outcome here. Remove the preempt_disable() section in fpu__clear(), preemption here does not hurt. Signed-off-by: Sebastian Andrzej Siewior --- arch/x86/kernel/fpu/core.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/arch/x86/kernel/fpu/core.c b/arch/x86/kernel/fpu/core.c index 9387e0fec7d17..b7d9b19ab8116 100644 --- a/arch/x86/kernel/fpu/core.c +++ b/arch/x86/kernel/fpu/core.c @@ -368,11 +368,9 @@ void fpu__clear(struct fpu *fpu) * Make sure fpstate is cleared and initialized. */ if (static_cpu_has(X86_FEATURE_FPU)) { - preempt_disable(); fpu__initialize(fpu); user_fpu_begin(); copy_init_fpstate_to_fpregs(); - preempt_enable(); } } -- 2.19.1