From patchwork Tue Aug 29 11:46:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Zhang X-Patchwork-Id: 9927187 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 092E86022E for ; Tue, 29 Aug 2017 11:47:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E87742881D for ; Tue, 29 Aug 2017 11:47:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DD0EA28895; Tue, 29 Aug 2017 11:47:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 932C32881D for ; Tue, 29 Aug 2017 11:47:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753519AbdH2Lr3 (ORCPT ); Tue, 29 Aug 2017 07:47:29 -0400 Received: from mail-pg0-f65.google.com ([74.125.83.65]:35626 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751356AbdH2LrY (ORCPT ); Tue, 29 Aug 2017 07:47:24 -0400 Received: by mail-pg0-f65.google.com with SMTP id r133so2551175pgr.2; Tue, 29 Aug 2017 04:47:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=M+ydzhOz7/d9AgNWAjgTavTzbw9o2NNAWX5lFg86iP0=; b=qBouxyRxwhYp5IfK6gvC0CTDngJooS64Po18342jS/awtJBu2bGjfV/giG4kHshKuO xttbc1Vy/MmyqJy6kseQsm8EfM/a2juFPaa83UI28gFJaLZhCq45hMnk04uveOfZ7Rwe WSZWSn4Ewv0a1h5nt4vxVIPWcHRupORm+hYMS0EWR9fcJLoEaMB4IgZQp9WYbA1N0BNC 3u2PHJVsQ0uvvfs5nq055pyrIjbX1Fq2kXWMiYfZsHU0Z2GHW3Oxy9Dvxmsi4JiF2Qe6 vhCdf/NZgns0cvCtKyKk1cI7WWIajsP+cVXzR+Miw+HZN9PxF4qNHYATXKdxBj7TJove chUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=M+ydzhOz7/d9AgNWAjgTavTzbw9o2NNAWX5lFg86iP0=; b=gjYLs5RRzI8m0/nbMMiREsRB82qAnAwXpmfHwgl8daEL+JfHbyESEnfzQiOun+E+pj oDWoG0lpF3du24EI3q88xAUGQKoKRsXhf2rVXe66YZgjqPDp3DZfm0kXM72Gt1l4tDrO 5fYLS/ajkx7MJ/2CUZk6yss6GC3HhQSDtEh1t7Xo1xG/1m9qmktQ+Z6DgrwkUKXOoRTR T6DkB+l0nXMQCOI8TcaI05BQom6d+lnDFFvUHXXjIPMJgmv4YiBQWZ4Ly84+wuZpPxXS sbLWZmex8SvB7VXrOvYf6Tm2gpAOxOzZk5Ojg74TIORkqeXQUApHlVSTSdgZPE2ar33X zSsw== X-Gm-Message-State: AHYfb5guZpP8tboBXTYA5/kmFRBMSchUp7HdKSpXx1rtbboCrvJAJAe2 ISUUVZ7Wl3jhAXZr X-Received: by 10.98.139.70 with SMTP id j67mr24857pfe.41.1504007243758; Tue, 29 Aug 2017 04:47:23 -0700 (PDT) Received: from ip-172-31-39-62.us-west-2.compute.internal (ec2-52-40-99-241.us-west-2.compute.amazonaws.com. [52.40.99.241]) by smtp.googlemail.com with ESMTPSA id e90sm2550747pfb.172.2017.08.29.04.47.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 29 Aug 2017 04:47:23 -0700 (PDT) From: Yang Zhang To: linux-kernel@vger.kernel.org Cc: kvm@vger.kernel.org, wanpeng.li@hotmail.com, mst@redhat.com, pbonzini@redhat.com, tglx@linutronix.de, rkrcmar@redhat.com, dmatlack@google.com, agraf@suse.de, peterz@infradead.org, linux-doc@vger.kernel.org, Yang Zhang , Quan Xu , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, Borislav Petkov , Kyle Huey , Andy Lutomirski , Len Brown Subject: [RFC PATCH v2 3/7] sched/idle: Add poll before enter real idle path Date: Tue, 29 Aug 2017 11:46:37 +0000 Message-Id: <1504007201-12904-4-git-send-email-yang.zhang.wz@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1504007201-12904-1-git-send-email-yang.zhang.wz@gmail.com> References: <1504007201-12904-1-git-send-email-yang.zhang.wz@gmail.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add poll in do_idle. For UP VM, if there are running task, it will not goes into idle path, so we only enable poll in SMP VM. Signed-off-by: Yang Zhang Signed-off-by: Quan Xu Cc: Thomas Gleixner Cc: Ingo Molnar Cc: "H. Peter Anvin" Cc: x86@kernel.org Cc: Peter Zijlstra Cc: Borislav Petkov Cc: Kyle Huey Cc: Andy Lutomirski Cc: Len Brown Cc: linux-kernel@vger.kernel.org --- arch/x86/kernel/process.c | 7 +++++++ kernel/sched/idle.c | 2 ++ 2 files changed, 9 insertions(+) diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c index 3ca1980..def4113 100644 --- a/arch/x86/kernel/process.c +++ b/arch/x86/kernel/process.c @@ -332,6 +332,13 @@ void arch_cpu_idle(void) x86_idle(); } +#if defined(CONFIG_SMP) && defined(CONFIG_PARAVIRT) +void arch_cpu_idle_poll(void) +{ + paravirt_idle_poll(); +} +#endif + /* * We use this if we don't have any better idle routine.. */ diff --git a/kernel/sched/idle.c b/kernel/sched/idle.c index 6c23e30..b374744 100644 --- a/kernel/sched/idle.c +++ b/kernel/sched/idle.c @@ -74,6 +74,7 @@ static noinline int __cpuidle cpu_idle_poll(void) } /* Weak implementations for optional arch specific functions */ +void __weak arch_cpu_idle_poll(void) { } void __weak arch_cpu_idle_prepare(void) { } void __weak arch_cpu_idle_enter(void) { } void __weak arch_cpu_idle_exit(void) { } @@ -219,6 +220,7 @@ static void do_idle(void) */ __current_set_polling(); + arch_cpu_idle_poll(); quiet_vmstat(); tick_nohz_idle_enter();