From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750851AbdAWJpN (ORCPT ); Mon, 23 Jan 2017 04:45:13 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:51175 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750729AbdAWJpK (ORCPT ); Mon, 23 Jan 2017 04:45:10 -0500 Date: Mon, 23 Jan 2017 10:44:56 +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 37/37] s390: Prevent from cputime leaks In-Reply-To: <1485109213-8561-38-git-send-email-fweisbec@gmail.com> References: <1485109213-8561-1-git-send-email-fweisbec@gmail.com> <1485109213-8561-38-git-send-email-fweisbec@gmail.com> 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: 17012309-0040-0000-0000-0000031B875A X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17012309-0041-0000-0000-000023E72909 Message-Id: <20170123104456.74cb2ef3@mschwideX1> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-01-23_07:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=2 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1612050000 definitions=main-1701230140 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 22 Jan 2017 19:20:13 +0100 Frederic Weisbecker wrote: > The s390 clock has a higher granularity than nanoseconds. 1 nanosec > equals 4.096 in s390 cputime_t. Therefore we leak a remainder while > flushing the cputime through cputime_to_nsecs(). > > For more precision, make sure we keep that remainder on cputime > accumulators for later accounting. > > Reported-by: Martin Schwidefsky > Cc: Benjamin Herrenschmidt > Cc: Paul Mackerras > Cc: Michael Ellerman > Cc: Heiko Carstens > Cc: Martin Schwidefsky > Cc: Tony Luck > Cc: Fenghua Yu > Cc: Peter Zijlstra > Cc: Rik van Riel > Cc: Thomas Gleixner > Cc: Ingo Molnar > Cc: Stanislaw Gruszka > Cc: Wanpeng Li > Signed-off-by: Frederic Weisbecker NAK. Good intention but the patch is just broken. with 36 of the 37 patches applied all looks good but the last one completely breaks the accounting for s390. This is from an idle system: top - 10:39:33 up 0 min, 1 user, load average: 0,00, 0,00, 0,00 Tasks: 106 total, 1 running, 105 sleeping, 0 stopped, 0 zombie %Cpu0 : 8,9 us, 21,6 sy, 0,0 ni, 0,0 id, 0,0 wa, 10,8 hi, 4,3 si, 54,4 st %Cpu1 : 0,0 us, 23,5 sy, 0,0 ni, 0,0 id, 0,0 wa, 19,0 hi, 13,1 si, 44,3 st %Cpu2 : 0,0 us, 30,3 sy, 0,0 ni, 0,0 id, 0,0 wa, 14,7 hi, 14,8 si, 40,2 st KiB Mem : 1009304 total, 818808 free, 57284 used, 133212 buff/cache KiB Swap: 1048556 total, 1048556 free, 0 used. 917356 avail Mem There is another issue that affects precision, there is no s390 specific version of cputime_to_nsecs. The generic version uses cputime_to_usecs and mulitplies by 1000 to get nano-seconds. That already looses precision. For now just drop that last patch please. -- blue skies, Martin. "Reality continues to ruin my life." - Calvin.