From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932183AbcDFHr0 (ORCPT ); Wed, 6 Apr 2016 03:47:26 -0400 Received: from cn.fujitsu.com ([59.151.112.132]:4921 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1752731AbcDFHrZ convert rfc822-to-8bit (ORCPT ); Wed, 6 Apr 2016 03:47:25 -0400 X-IronPort-AV: E=Sophos;i="5.22,518,1449504000"; d="scan'208";a="5315545" From: Zhao Lei To: "'Ingo Molnar'" , "'Srikar Dronamraju'" CC: , , , , , , , , References: <20160404140312.GA28495@linux.vnet.ibm.com> <20160406065436.GB3078@gmail.com> In-Reply-To: <20160406065436.GB3078@gmail.com> Subject: RE: [tip:sched/core] sched/cpuacct: Split usage accounting into user_usage and sys_usage Date: Wed, 6 Apr 2016 15:47:18 +0800 Message-ID: <007901d18fd8$8c1e7810$a45b6830$@cn.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Mailer: Microsoft Outlook 15.0 Thread-Index: AQJv7eQQvUiXwYUH3DrsRFUSXIIVxAIjY5GlAurW/AEBVS8Bc54Mtjrw Content-Language: zh-cn X-yoursite-MailScanner-ID: CD430408D261.AE414 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: zhaolei@cn.fujitsu.com Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Ingo and Srikar, > -----Original Message----- > From: Ingo Molnar [mailto:mingo.kernel.org@gmail.com] On Behalf Of Ingo > Molnar > Sent: Wednesday, April 06, 2016 2:55 PM > To: Srikar Dronamraju > Cc: tglx@linutronix.de; efault@gmx.de; htejun@gmail.com; > linux-kernel@vger.kernel.org; tj@kernel.org; torvalds@linux-foundation.org; > zhaolei@cn.fujitsu.com; peterz@infradead.org; yangds.fnst@cn.fujitsu.com; > hpa@zytor.com > Subject: Re: [tip:sched/core] sched/cpuacct: Split usage accounting into > user_usage and sys_usage > > > * Srikar Dronamraju wrote: > > > * tip-bot for Dongsheng Yang [2016-03-31 02:27:39]: > > > > > Commit-ID: d740037fac7052e49450f6fa1454f1144a103b55 > > > Gitweb: > http://git.kernel.org/tip/d740037fac7052e49450f6fa1454f1144a103b55 > > > Author: Dongsheng Yang > > > AuthorDate: Tue, 22 Mar 2016 16:37:08 +0800 > > > Committer: Ingo Molnar > > > CommitDate: Thu, 31 Mar 2016 10:48:54 +0200 > > > > > > sched/cpuacct: Split usage accounting into user_usage and sys_usage > > > > > > Sometimes, cpuacct.usage is not detailed enough to see how much CPU > > > usage a group had. We want to know how much time it used in user mode > > > and how much in kernel mode. > > > > > > > Unfortunately this commit causes boot to fail on my power 7 box. > > > > > @@ -238,10 +316,18 @@ static struct cftype files[] = { > > > void cpuacct_charge(struct task_struct *tsk, u64 cputime) > > > { > > > struct cpuacct *ca; > > > + int index; > > > + > > > + if (user_mode(task_pt_regs(tsk))) > > > + index = CPUACCT_USAGE_USER; > > > + else > > > + index = CPUACCT_USAGE_SYSTEM; > > > > > > rcu_read_lock(); > > > + > > > for (ca = task_ca(tsk); ca; ca = parent_ca(ca)) > > > - *this_cpu_ptr(ca->cpuusage) += cputime; > > > + this_cpu_ptr(ca->cpuusage)->usages[index] += cputime; > > > > The above line seems to be the cause of oops. Attached the complete console > log below. > Thanks for reporting this bug. I'll take over this patch. > Weird - not much changed wrt. the cpuusage logic, we only increased its size. > Thanks for concern. I trying to review this patch, but had not found something strange, except: > If you change the above loop to something like: > > for (ca = task_ca(tsk); ca; ca = parent_ca(ca)) { > if (WARN_ON_ONCE(!ca->cpuusage)) > continue; > this_cpu_ptr(ca->cpuusage)->usages[index] += cputime; Or s/ this_cpu_ptr/get_cpu_var to avoid preempt? But preempt problem should not cause problem in every boot, And Srikar's bisect means it failed in every boot. > } > > then do you get the warning and the bootup succeeds? > I also building a power7 vm for test, still in building... Thanks Zhaolei