Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp3439554imm; Fri, 25 May 2018 05:52:25 -0700 (PDT) X-Google-Smtp-Source: AB8JxZocmmrNlYIPeJGd5nX0jg3L5znCg96umSfETwfC0p9gT5f7wCITcSPvTGGdKKtfiUFVk3Pm X-Received: by 2002:a63:5fcb:: with SMTP id t194-v6mr1883513pgb.176.1527252745866; Fri, 25 May 2018 05:52:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527252745; cv=none; d=google.com; s=arc-20160816; b=Igxy6Xr9+lem6R33R9UesrEZ1ub0ybu5I5ST4I3MjJMSVy9ougjubcJSz7Shf86h03 zQhXCepg3p5hfg1gDVyFu/mx19uIWR9KPQlFfVwVCtCV+EFXBKZEZQsl3JYv9UHhV50V s/T7+Oxd+q3u8q5mnqmqikEd/RXwszbRa6q7zT6YzQEKiMpRQDAMXjXpsDnM9UDolSUg U1j42xXLwgTfnSU//CSRCuyD3cNHsbYxQgPGmhlUno1Z2N40G08akXox8ew5ACzpQhCl d7PzLQLhCJOzo6npdE4HuMKaHcp728f49Ml4eVsV7Bl9TIC1kv4QmXtn3NE4SCiBkx7S iCXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:arc-authentication-results; bh=3PWqm+f2wBBGugxCSrK1lrvp+/AMcg9E47j94HJf36Y=; b=j6gvmnKLm08FsxhhV8w0DdwZHRMPk1r+VZHymKbz2lGLQ/ulIDmhYH0b/QnkUw8j0O HhK0lRxpTx5a9p5ZQEO0oQM4n0uIu1PV2kXcyx0ug9y0gTcpVN9R9zIuXEPMgyzO0PJU rNvXGWSHR+evmvQ/wTs7em56M5LLJhjQCQ6uCA8B+MZZYqYfqTdzHJITF32DmI8kHY9/ s5WI3RAiCG9P+f8YD6YjgapeublSU8NcKO0HYVL2dYJ0qLGAEBUdMInopsPv9Xo7TbNM pE4A64aPCYbIAThzaQ8mW3mbRO+FS9VHgZoeEQJor/3Ali4bIamiiI7mWcm7bpSyiQVI RNjw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b9-v6si18513767pgu.27.2018.05.25.05.52.11; Fri, 25 May 2018 05:52:25 -0700 (PDT) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936009AbeEYMv3 (ORCPT + 99 others); Fri, 25 May 2018 08:51:29 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:59472 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933152AbeEYMv1 (ORCPT ); Fri, 25 May 2018 08:51:27 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BBD41195462; Fri, 25 May 2018 12:51:26 +0000 (UTC) Received: from doriath (ovpn-116-63.phx2.redhat.com [10.3.116.63]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4E428946BE; Fri, 25 May 2018 12:51:21 +0000 (UTC) Date: Fri, 25 May 2018 08:51:20 -0400 From: Luiz Capitulino To: Frederic Weisbecker Cc: Yauheni Kaliuta , Ingo Molnar , LKML , Peter Zijlstra , Chris Metcalf , Thomas Gleixner , Christoph Lameter , "Paul E . McKenney" , Wanpeng Li , Mike Galbraith , Rik van Riel Subject: Re: [GIT PULL] isolation: 1Hz residual tick offloading v4 Message-ID: <20180525085120.08493f53@doriath> In-Reply-To: <20180525025624.GB22082@lerouge> References: <1516320140-13189-1-git-send-email-frederic@kernel.org> <20180124104608.038fb212@redhat.com> <20180129011024.GA2942@lerouge> <20180525025624.GB22082@lerouge> Organization: Red Hat MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 25 May 2018 12:51:26 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 25 May 2018 12:51:26 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'lcapitulino@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 25 May 2018 04:56:25 +0200 Frederic Weisbecker wrote: > On Tue, May 22, 2018 at 10:10:19PM +0300, Yauheni Kaliuta wrote: > > Hi, Frederic! > > > > >>>>> On Mon, 29 Jan 2018 02:10:26 +0100, Frederic Weisbecker wrote: > > > On Wed, Jan 24, 2018 at 10:46:08AM -0500, Luiz Capitulino wrote: > > > > [...] > > > > >> Since the 1Hz tick offload worked for you, I must be missing > > >> a way to disable this timer or the kernel is thinking my CPU > > >> has unstable TSC (which it doesn't AFAIK). > > > > > It's beyond the scope of this patchset but indeed that's > > > right, I run my kernels with tsc=reliable because my CPUs > > > don't have the TSC_RELIABLE flag. That's the only way I found > > > to shutdown the tick completely on my test machine, otherwise > > > I keep having that clocksource watchdog. > > > > [...] > > > > Thanks, it helps. But I have accounting problem: > > > > if I run user busy loop on the nohz cpu, the task accounting works > > correctly (top shows the task takes 100% cpu), but cpu accounting is > > wrong (cpu is 100% idle, in the per-core view as well). > > > > If I understand correctly, the stats are updated by account_user_time() > > -> task_group_account_field() but there is no call for it in case of > > offloading (it is called from irqtime_account_process_tick, > > account_process_tick, vtime_user_exit). > > Ah I forgot about kcpustat accounting. I remember I wanted to fix that a > few years ago but I forgot about it when I removed the last tick. That > thing was lurking behind 1Hz. > > > > > Moreover, task_group_account_field() uses __this_cpu_add() which will be > > wrong for offloading. > > > > For testing I used kcpustat_cpu(task_cpu(p)) in > > task_group_account_field() and added call account_user_time(curr, delta) > > to the sched_tick_remote() what fixes it for me, but what would be the > > proper fix? > > Yeah unfortunately that's unsafe. Task accounting is not designed for remote > update. You could race with an update from another CPU, especially the local > updater. > > I fear we need to take the same approach than task cputime, which is using a seqcount > for updates. Then the reader would fetch the kcpustat values + the delta > vtime from the task executing. > > Things can get complicated once we dive into corner cases: CPUTIME_IRQ, > CPUTIME_SOFTIRQ, and CPUTIME_STEAL. At least we don't need to care about CPUTIME_IDLE > and CPUTIME_IOWAIT that have their own delta. > > I'm trying that. Cool! Needless to say, but we can help testing once you have patches.