Received: by 10.223.164.202 with SMTP id h10csp3471905wrb; Sun, 19 Nov 2017 23:06:04 -0800 (PST) X-Google-Smtp-Source: AGs4zMa8e+AKMOwnB2uu+7YnPqYxFqM9MzVF+8oWJ6uyxK/bDtKJKrZR0uQoELqcabLs1sF114hJ X-Received: by 10.84.224.5 with SMTP id r5mr12987377plj.341.1511161564213; Sun, 19 Nov 2017 23:06:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511161564; cv=none; d=google.com; s=arc-20160816; b=xf5YoYq8JZplIQWfXZIALXBmc4bJDQ+/UxW90uGzj6ROqkXfRLD+atyyE1CVlFSnkh g851TamLr29YJFl7X1uSr6ZHQRSEbmf8HZ/MClW/mgPLAFK4L4ikJ7IdIC4rUr1p0d6N h6zVgFrdfNaX31CgpCkI+0FRtf27rVGv+QHw8QSGBYsstUnj//7BlIkPY4c11t+QgmUs Y93blv+KCwi5ZNdtsjXRy1UihEiHF3tfjxSqZ6qMznOS/vagFyTUy/a9h+6+mkHYPdi0 ge1fnCONBltnUbJr/E1yct5gKBMnkR5VTeBLviwtdlE/pgiTUAgd7OAZUlSd16JezGlb Vaug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=ePwxsrLiWQVBFfVVNdKSBoiSbb2FaAPS1krC1kUH5tY=; b=ordIBwHgWMpZWsZ88F0zJtAfcsirPcqu3FTtYOIuJ73+3cZsDc6r7cCtkIZ4/pBCrn jHbL72GB0NToASB30ayPG1OXV/bNElmnZE5874ovBC6TU9LV5OMkn3yvptiaJmAJNT9v 9xENqTH31Qjug9Xu1B9NX0nBCNX1BUQActn46tUxOX2f0YGFzVcSWv84FXJnMxE7Krh/ p1rrffQiF+9iQEJR88px76HhLilt96GEa0sycTf23b4i155cBaGTCROvTn5Unx0/GGrw YyIEE9hYTWAu92xchvDO9FL2ZYQWSaqJA3YKWXFvCJei8bU+Wpz30u6DLqSsreLknumO vO4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=sovhVbUJ; 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=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w15si7367898pgc.761.2017.11.19.23.05.53; Sun, 19 Nov 2017 23:06:04 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=sovhVbUJ; 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=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751113AbdKTHFR (ORCPT + 68 others); Mon, 20 Nov 2017 02:05:17 -0500 Received: from mail-ot0-f196.google.com ([74.125.82.196]:33502 "EHLO mail-ot0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751049AbdKTHFO (ORCPT ); Mon, 20 Nov 2017 02:05:14 -0500 Received: by mail-ot0-f196.google.com with SMTP id s12so6847041otc.0; Sun, 19 Nov 2017 23:05:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=ePwxsrLiWQVBFfVVNdKSBoiSbb2FaAPS1krC1kUH5tY=; b=sovhVbUJErb5zl4Yb+236zDB/stzt5/5LK5XAQqPSAkGwe6GVGF5i1GdVChMMX2zEz yB4V/gXk5a8GRMJDa7k7Eznt3IAdQ0/HqobxA2/akW+2ulXEh5QBZ8EAUS2uVagqCtsR RDMieNlprZdY3uU2zcWp9OQCzQMvCrcXawL8Pe1fkRmso1mRT9HrUDpD0ZtkQvdbZse5 0a/2u5glce5zKIiy9lU+Htmk8Ci/M0v0Ec1UShPUqi7j4c1v55NMSOyhT2qN7V5KHbel Mw+KJ9XdlNxE8T+0v/zOBsT2bRnfindDNt5sbSfDA0qTne8/pi/use0apCOYScoYcJT7 EQ6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=ePwxsrLiWQVBFfVVNdKSBoiSbb2FaAPS1krC1kUH5tY=; b=Bnr3RjOC/G6YdlDyrJp49nb2et8vHVHZT2qKwOO0NhiK6eXfwAF3TxeHJC8iPxjTjY dtUWgNsbcNS6i9JdCVoJX25al1kAk17I2DPohn1XMo7B7T5de8+L8G1TIErnpK8Bafj6 jyhH/3LVqYcRsj6J6G/kcGp0+Z4upkbJnG3OQ9lNun42uQqN7V0NaFUig364xxWOowXR RXQgExbh73jZtgCZcXnuFttqJ6NOI0osPprPP5w2GpLvGdBwxiTrQ5uep4obLFxrUNdm bzDq8N27ejz44ojYPEjN+vLjiNJxHvyLAyfMM3S9jy8J/YGSiOdhAVo/8jhCTtwTkfjR ud3Q== X-Gm-Message-State: AJaThX7EYwyu36yOa14CIkgogcovLdXsZfgprzXCPxjclko4x75bjhWb 9xSYiHOrY9N/pv+ohvo0pac= X-Received: by 10.157.37.229 with SMTP id q92mr7508978ota.57.1511161513652; Sun, 19 Nov 2017 23:05:13 -0800 (PST) Received: from [0.0.0.0] ([47.89.242.186]) by smtp.gmail.com with ESMTPSA id o206sm4176632oia.25.2017.11.19.23.05.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 19 Nov 2017 23:05:12 -0800 (PST) Subject: Re: [PATCH RFC v3 3/6] sched/idle: Add a generic poll before enter real idle path To: Daniel Lezcano , Thomas Gleixner , Peter Zijlstra Cc: Quan Xu , kvm@vger.kernel.org, linux-doc@vger.kernel.org, linux-fsdevel@vger.kernel.org, LKML , virtualization@lists.linux-foundation.org, x86@kernel.org, xen-devel@lists.xenproject.org, Yang Zhang , Ingo Molnar , "H. Peter Anvin" , Borislav Petkov , Kyle Huey , Len Brown , Andy Lutomirski , Tom Lendacky , Tobias Klauser References: <1510567565-5118-1-git-send-email-quan.xu0@gmail.com> <1510567565-5118-4-git-send-email-quan.xu0@gmail.com> <20171115121152.gqug5wzerlo3eimd@hirez.programming.kicks-ass.net> <46086489-5a01-16e1-9314-70ae53c01952@gmail.com> <93a26005-aa37-82e1-5c04-a82c9027bac8@linaro.org> From: Quan Xu Message-ID: <5deab1e9-cef2-0511-09d8-cef8e4323f02@gmail.com> Date: Mon, 20 Nov 2017 15:05:01 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <93a26005-aa37-82e1-5c04-a82c9027bac8@linaro.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2017-11-16 17:45, Daniel Lezcano wrote: > On 16/11/2017 10:12, Quan Xu wrote: >> >> On 2017-11-16 06:03, Thomas Gleixner wrote: >>> On Wed, 15 Nov 2017, Peter Zijlstra wrote: >>> >>>> On Mon, Nov 13, 2017 at 06:06:02PM +0800, Quan Xu wrote: >>>>> From: Yang Zhang >>>>> >>>>> Implement a generic idle poll which resembles the functionality >>>>> found in arch/. Provide weak arch_cpu_idle_poll function which >>>>> can be overridden by the architecture code if needed. >>>> No, we want less of those magic hooks, not more. >>>> >>>>> Interrupts arrive which may not cause a reschedule in idle loops. >>>>> In KVM guest, this costs several VM-exit/VM-entry cycles, VM-entry >>>>> for interrupts and VM-exit immediately. Also this becomes more >>>>> expensive than bare metal. Add a generic idle poll before enter >>>>> real idle path. When a reschedule event is pending, we can bypass >>>>> the real idle path. >>>> Why not do a HV specific idle driver? >>> If I understand the problem correctly then he wants to avoid the heavy >>> lifting in tick_nohz_idle_enter() in the first place, but there is >>> already >>> an interesting quirk there which makes it exit early.  See commit >>> 3c5d92a0cfb5 ("nohz: Introduce arch_needs_cpu"). The reason for this >>> commit >>> looks similar. But lets not proliferate that. I'd rather see that go >>> away. >> agreed. >> >> Even we can get more benifit than commit 3c5d92a0cfb5 ("nohz: Introduce >> arch_needs_cpu") >> in kvm guest. I won't proliferate that.. >> >>> But the irq_timings stuff is heading into the same direction, with a more >>> complex prediction logic which should tell you pretty good how long that >>> idle period is going to be and in case of an interrupt heavy workload >>> this >>> would skip the extra work of stopping and restarting the tick and >>> provide a >>> very good input into a polling decision. >> >> interesting. I have tested with IRQ_TIMINGS related code, which seems >> not working so far. > I don't know how you tested it, can you elaborate what you meant by > "seems not working so far" ? Daniel, I tried to enable IRQ_TIMINGS* manually. used irq_timings_next_event() to return estimation of the earliest interrupt. However I got a constant. > There are still some work to do to be more efficient. The prediction > based on the irq timings is all right if the interrupts have a simple > periodicity. But as soon as there is a pattern, the current code can't > handle it properly and does bad predictions. > > I'm working on a self-learning pattern detection which is too heavy for > the kernel, and with it we should be able to detect properly the > patterns and re-ajust the period if it changes. I'm in the process of > making it suitable for kernel code (both math and perf). > > One improvement which can be done right now and which can help you is > the interrupts rate on the CPU. It is possible to compute it and that > will give an accurate information for the polling decision. > > As tglx said, talk to each other / work together to make it usable for all use cases. could you share how to enable it to get the interrupts rate on the CPU? I can try it in cloud scenario. of course, I'd like to work with you to improve it. Quan Alibaba Cloud From 1584339366176773476@xxx Fri Nov 17 18:36:01 +0000 2017 X-GM-THRID: 1584141070007959176 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread