Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9093772pxu; Mon, 28 Dec 2020 06:29:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJyko3cH1uEq6WZKdJ11dDFSPrx35dwvxNLKkPUiosPyiVpFoE+MyvlS6ac04k+cfig3dqPy X-Received: by 2002:a05:6402:2292:: with SMTP id cw18mr43080583edb.336.1609165780721; Mon, 28 Dec 2020 06:29:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609165780; cv=none; d=google.com; s=arc-20160816; b=z30nmNE7R4bKWvitKfJZT7Aogv8GJ+3z2BKSHMuU8n4tyhaBHPkvc10NAz5uHLDlTe MkQP2i58YrCfn0M42MABIl4WZ92B29ukiT4oAFlUb/roE4decyY7IZkpS4bHqYc+jz28 HieoLOE7GiEEt5uU2hL2hKptIJj7EEQXdtyH8LORhieHynmDRYy2z6KfJ99LW9ivXTHc RXEBOjgx47qXpE2fnwv6rIpJZe7FkoGBu+jQwTp9ZzSktdii/0k8wd1YmMJq44ggRwzc ZUEfld079ANQQoDDRyUKiFfZiOtuDPKntg0nnwlAowKPZpBxamw1BWXba74uZeh52oHP aY2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=wgK4O7nGIGSE7zdUPoVkauFOyABZXYxiRWayscrhBZc=; b=fppnnBPjVfApDW7hS2U5uTHK+7BgU34NkQFRoTW1oAfcGa7If4VowGqqaFBzEOdGdm 9TsLUnrvldAOzo3YZ2l8m4GP6qPqROowd310PPkk5KzNyIb46gQkDRrRMkgfyVW0Fjwy ZkWeZl2ZWXxN4NEOmqQjCw/g4/VBiN9okaOscOD2IDvsqa1v+gbG+qJbemsNc04Hifub Ct8XHEOrT3ZCqhWpLkJXEEuJzCQ9HfGEtWwxvVsaFhOtfOfJoPOaK+h2wKqr1PUyXgsY WChvEYQuaLDet3w8qcd9hrmtyC3lAB1h1dM2soFSFPZVGDEU7gbMmPPFAcE0uoJKIBZy 5DTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Vf/EOlr5"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j13si18614776ejc.454.2020.12.28.06.29.17; Mon, 28 Dec 2020 06:29:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Vf/EOlr5"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2503269AbgL1OZm (ORCPT + 99 others); Mon, 28 Dec 2020 09:25:42 -0500 Received: from mail.kernel.org ([198.145.29.99]:33572 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2503250AbgL1OZi (ORCPT ); Mon, 28 Dec 2020 09:25:38 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 510F120731; Mon, 28 Dec 2020 14:24:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609165497; bh=YsNWC9QPj/tB4tfx3OBGJz9UKKByDqFrrZuimQ/Tfko=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Vf/EOlr5TI1TrYAc17gG/5a+qYZhFgEEO/eUqpxHmaDSrprYyrT/xsyPvSLxKLM+4 q19Ooq3XVGTXV9kK7VT5fVhSsl7UT3iy166Zz2LDieyztB5pr89Vj579VOv2p438zP YsiNDBnqUUgrbgt20J/ULByGShMWV7eYoqemrVFA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Heiko Carstens , Sven Schnelle Subject: [PATCH 5.10 553/717] s390/idle: add missing mt_cycles calculation Date: Mon, 28 Dec 2020 13:49:11 +0100 Message-Id: <20201228125047.431022393@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sven Schnelle commit e259b3fafa7de362b04ecd86e7fa9a9e9273e5fb upstream. During removal of the critical section cleanup the calculation of mt_cycles during idle was removed. This causes invalid accounting on systems with SMT enabled. Fixes: 0b0ed657fe00 ("s390: remove critical section cleanup from entry.S") Cc: # 5.8 Reviewed-by: Heiko Carstens Signed-off-by: Sven Schnelle Signed-off-by: Heiko Carstens Signed-off-by: Greg Kroah-Hartman --- arch/s390/kernel/entry.S | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) --- a/arch/s390/kernel/entry.S +++ b/arch/s390/kernel/entry.S @@ -112,7 +112,7 @@ _LPP_OFFSET = __LC_LPP .macro SWITCH_ASYNC savearea,timer tmhh %r8,0x0001 # interrupting from user ? - jnz 2f + jnz 4f #if IS_ENABLED(CONFIG_KVM) lgr %r14,%r9 larl %r13,.Lsie_gmap @@ -125,9 +125,25 @@ _LPP_OFFSET = __LC_LPP #endif 0: larl %r13,.Lpsw_idle_exit cgr %r13,%r9 - jne 1f + jne 3f - mvc __CLOCK_IDLE_EXIT(8,%r2), __LC_INT_CLOCK + larl %r1,smp_cpu_mtid + llgf %r1,0(%r1) + ltgr %r1,%r1 + jz 2f # no SMT, skip mt_cycles calculation + .insn rsy,0xeb0000000017,%r1,5,__SF_EMPTY+80(%r15) + larl %r3,mt_cycles + ag %r3,__LC_PERCPU_OFFSET + la %r4,__SF_EMPTY+16(%r15) +1: lg %r0,0(%r3) + slg %r0,0(%r4) + alg %r0,64(%r4) + stg %r0,0(%r3) + la %r3,8(%r3) + la %r4,8(%r4) + brct %r1,1b + +2: mvc __CLOCK_IDLE_EXIT(8,%r2), __LC_INT_CLOCK mvc __TIMER_IDLE_EXIT(8,%r2), __LC_ASYNC_ENTER_TIMER # account system time going idle ni __LC_CPU_FLAGS+7,255-_CIF_ENABLED_WAIT @@ -146,17 +162,17 @@ _LPP_OFFSET = __LC_LPP mvc __LC_LAST_UPDATE_TIMER(8),__TIMER_IDLE_EXIT(%r2) nihh %r8,0xfcfd # clear wait state and irq bits -1: lg %r14,__LC_ASYNC_STACK # are we already on the target stack? +3: lg %r14,__LC_ASYNC_STACK # are we already on the target stack? slgr %r14,%r15 srag %r14,%r14,STACK_SHIFT - jnz 3f + jnz 5f CHECK_STACK \savearea aghi %r15,-(STACK_FRAME_OVERHEAD + __PT_SIZE) - j 4f -2: UPDATE_VTIME %r14,%r15,\timer + j 6f +4: UPDATE_VTIME %r14,%r15,\timer BPENTER __TI_flags(%r12),_TIF_ISOLATE_BP -3: lg %r15,__LC_ASYNC_STACK # load async stack -4: la %r11,STACK_FRAME_OVERHEAD(%r15) +5: lg %r15,__LC_ASYNC_STACK # load async stack +6: la %r11,STACK_FRAME_OVERHEAD(%r15) .endm .macro UPDATE_VTIME w1,w2,enter_timer