Received: by 10.223.164.202 with SMTP id h10csp191073wrb; Mon, 13 Nov 2017 05:02:45 -0800 (PST) X-Google-Smtp-Source: AGs4zMbqkuaUQDdxxIVMN15hcX3EMuAXt72eQZ9RZkP4pVczOaWbQGPvi741NUwXrkLI4UCupeh2 X-Received: by 10.98.222.197 with SMTP id h188mr117847pfg.132.1510578165617; Mon, 13 Nov 2017 05:02:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510578165; cv=none; d=google.com; s=arc-20160816; b=XqpkJvIneqY+kIMeLQ7z+1oczb3U4IiyPplSFNSZ5CXyBcQt0717k6e29RgqZ08Egr qUEoQRmhkT9lqQ86GvmCkBY7+SljoTMQPpaCf+DzQNtYiPl+W8yBefMq2vCA7nC21eEM 9hhdL3kxhelN/v2j1chhSY7YulmLbpPwGZRdxaZNeWxTg+jpqUYOtZSDx7EuEOjkzIBS iQDUJVUD666zciD7+fuFFgMyqPdwl1+oMZcfiAaUaRAQf2qivXjdWKw9Vn9va5KMen/b PvyXZyH8Ad9e1sjISqJO46o0G9npfxNOuVK+G1CCe4sESFgp6Og6DvD9QsAAYaxwUYI9 G3Qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=GsEQK9iSpSFG91Jt/R3yFSXLpg9eCnIU9PJ06NO3q+o=; b=u2blecsNH7HZ106ZdleW24DIOHoWTz7j6Uc4bh3zthwRkljPjVmfPoIR4kt0ARP/Fn MDC0d8PCW1Muy2bUWcfD604FFpgefEEjUk10KsAEuFFVXmAaVqmY1+6h4oxDdysvKcV2 EV3jXBIOdByQhiw51wbYZFwNWU4WXnIfphKYCdfy7Tg7lIXBlguyaHEPFA3wGX3EOkIe wPCP6uDrtlrI5BOkEOhfSz8XnpHI0cqLj+MvudPgWZQsZeZ5MrIvC8X3i69c+BS6d1Pn gRlLH2XEmmlACVICgFG0gW67CSuP5ck40FaixauZdRJrEU+OKIxaHv9wGcwJuaX5147z CAnw== 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 o128si15327605pfg.292.2017.11.13.05.02.32; Mon, 13 Nov 2017 05:02:45 -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 S1754763AbdKMNB6 (ORCPT + 95 others); Mon, 13 Nov 2017 08:01:58 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:50338 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752944AbdKMNBy (ORCPT ); Mon, 13 Nov 2017 08:01:54 -0500 Received: from localhost (LFbn-1-12253-150.w90-92.abo.wanadoo.fr [90.92.67.150]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 32E6F9C; Mon, 13 Nov 2017 13:01:53 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Frederic Weisbecker , Thomas Gleixner , Benjamin Herrenschmidt , Christian Borntraeger , Fenghua Yu , Heiko Carstens , Linus Torvalds , Martin Schwidefsky , Michael Ellerman , Paul Mackerras , Peter Zijlstra , Rik van Riel , Stanislaw Gruszka , Tony Luck , Wanpeng Li , Ingo Molnar , Sasha Levin Subject: [PATCH 4.9 40/87] sched/cputime, powerpc32: Fix stale scaled stime on context switch Date: Mon, 13 Nov 2017 13:55:57 +0100 Message-Id: <20171113125619.007448157@linuxfoundation.org> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20171113125615.304035578@linuxfoundation.org> References: <20171113125615.304035578@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Frederic Weisbecker [ Upstream commit 90d08ba2b9b4be4aeca6a5b5a4b09fbcde30194d ] On context switch with powerpc32, the cputime is accumulated in the thread_info struct. So the switching-in task must move forward its start time snapshot to the current time in order to later compute the delta spent in system mode. This is what we do for the normal cputime by initializing the starttime field to the value of the previous task's starttime which got freshly updated. But we are missing the update of the scaled cputime start time. As a result we may be accounting too much scaled cputime later. Fix this by initializing the scaled cputime the same way we do for normal cputime. Signed-off-by: Frederic Weisbecker Acked-by: Thomas Gleixner Cc: Benjamin Herrenschmidt Cc: Christian Borntraeger Cc: Fenghua Yu Cc: Heiko Carstens Cc: Linus Torvalds Cc: Martin Schwidefsky Cc: Michael Ellerman Cc: Paul Mackerras Cc: Peter Zijlstra Cc: Rik van Riel Cc: Stanislaw Gruszka Cc: Tony Luck Cc: Wanpeng Li Link: http://lkml.kernel.org/r/1483636310-6557-2-git-send-email-fweisbec@gmail.com Signed-off-by: Ingo Molnar Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/kernel/time.c | 1 + 1 file changed, 1 insertion(+) --- a/arch/powerpc/kernel/time.c +++ b/arch/powerpc/kernel/time.c @@ -407,6 +407,7 @@ void arch_vtime_task_switch(struct task_ struct cpu_accounting_data *acct = get_accounting(current); acct->starttime = get_accounting(prev)->starttime; + acct->startspurr = get_accounting(prev)->startspurr; acct->system_time = 0; acct->user_time = 0; } From 1586058160479252344@xxx Wed Dec 06 17:55:31 +0000 2017 X-GM-THRID: 1585925607716387478 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread