Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935096AbcLTOOF (ORCPT ); Tue, 20 Dec 2016 09:14:05 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:46636 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933997AbcLTOOD (ORCPT ); Tue, 20 Dec 2016 09:14:03 -0500 Date: Tue, 20 Dec 2016 15:13:53 +0100 From: Martin Schwidefsky To: Frederic Weisbecker Cc: LKML , Tony Luck , Wanpeng Li , Peter Zijlstra , Michael Ellerman , Heiko Carstens , Benjamin Herrenschmidt , Thomas Gleixner , Paul Mackerras , Ingo Molnar , Fenghua Yu , Rik van Riel , Stanislaw Gruszka Subject: Re: [PATCH 09/10] s390/cputime: delayed accounting of system time In-Reply-To: <20161214014445.GA4102@lerouge> References: <1480991543-6557-1-git-send-email-fweisbec@gmail.com> <1480991543-6557-10-git-send-email-fweisbec@gmail.com> <20161210014804.GA3023@lerouge> <20161212112754.5ad104cf@mschwideX1> <20161212150228.GA17032@lerouge> <20161213121322.5fdbbb28@mschwideX1> <20161213142121.382ce2ef@mschwideX1> <20161214014445.GA4102@lerouge> X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16122014-0032-0000-0000-0000025EA745 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16122014-0033-0000-0000-00001E389531 Message-Id: <20161220151353.655be5ab@mschwideX1> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-12-20_09:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1612050000 definitions=main-1612200176 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2892 Lines: 62 On Wed, 14 Dec 2016 02:44:46 +0100 Frederic Weisbecker wrote: > On Tue, Dec 13, 2016 at 02:21:21PM +0100, Martin Schwidefsky wrote: > > On Tue, 13 Dec 2016 12:13:22 +0100 > > Martin Schwidefsky wrote: > > > > > On Mon, 12 Dec 2016 16:02:30 +0100 > > > Frederic Weisbecker wrote: > > > > > > > On Mon, Dec 12, 2016 at 11:27:54AM +0100, Martin Schwidefsky wrote: > > > > > 3) The call to vtime_flush in account_process_tick is done in irq context from > > > > > update_process_times. hardirq_offset==1 is also correct. > > > > > > > > Let's see this for example: > > > > > > > > + if ((tsk->flags & PF_VCPU) && (irq_count() - hardirq_offset == 0)) > > > > + S390_lowcore.guest_timer += timer; > > > > > > > > If the tick is interrupting guest, we have accounted the guest time on tick IRQ entry. > > > > Now we are in the middle of the tick interrupt and since hardirq_offset is 1, we > > > > are taking the above path by accounting half of the tick-IRQ time as guest, which is wrong, > > > > it's actually IRQ time. > > > > > > Hmm, you got me there. The system time from irq_enter until account_process_tick > > > is reached is indeed IRQ time. It is not much but it is incorrect. The best fix > > > would be to rip out the accounting of the system time from account_process_tick > > > as irq_enter / irq_exit will do system time accounting anyway. To do that > > > do_account_vtime needs to be split, because for the task switch we need to > > > account the system time of the previous task. > > > > New patch for the delayed cputime account. I can not just rip out system time > > accounting from account_process_tick after all, I need a sync point for the > > steal time calculation. It basically is the same patch as before but with a new > > helper update_tsk_timer, the removal of hardirq_offset and a simplification > > for do_account_vtime: the last accounting delta is either hardirq time for > > the tick or system time for the task switch. > > > > Keeping my finger crossed.. > > The patch looks good. But you might want to remove the hardirq_offset in a > separate patch to queue for this merge window (I'm not sure if it needs a > stable tag, the argument may be there since the beginning). > > Because the rest depends on the series that is unlikely to be queued in this > merge window at this stage. I just pushed two fixes to the linux-s390:fixes tree which will be merged eventually after the first -rc candidate for 4.10 is released. This includes "s390/vtime: correct system time accounting" which fixes the hardirq_offset bug for s390. The link to the fixes-tree in case you want to look at the patch: git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux.git fixes -- blue skies, Martin. "Reality continues to ruin my life." - Calvin.