From patchwork Tue Aug 29 11:46:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Zhang X-Patchwork-Id: 9927195 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 D46356022E for ; Tue, 29 Aug 2017 11:48:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BFFC328874 for ; Tue, 29 Aug 2017 11:48:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B450A288B6; Tue, 29 Aug 2017 11:48:17 +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 64C3328874 for ; Tue, 29 Aug 2017 11:48:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753502AbdH2Lr2 (ORCPT ); Tue, 29 Aug 2017 07:47:28 -0400 Received: from mail-pg0-f65.google.com ([74.125.83.65]:35629 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753493AbdH2LrZ (ORCPT ); Tue, 29 Aug 2017 07:47:25 -0400 Received: by mail-pg0-f65.google.com with SMTP id r133so2551201pgr.2; Tue, 29 Aug 2017 04:47:25 -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=p1u+oLWsVrPCC7NvSH5X60sIoNFIUf1osPQv0mFjyyE=; b=J39rSr4BNIpiuLOePzRrAaJuogU5aAVO7bY5lhckcgK6ouzvcGwDBmzEquHNgey3id mQojzJlahiRTGe11nh30b/G3NzWMplE+RYHsaaLMfIIsHfpU12Q6QdvV2LUCbeYlXVfl /BGa2s6l+U09TpoxxHftOe8ESqUUCfE9vddumPbobJU3ss+KRstI1tkqXKFmA7xTP++7 cJcyycImq1ueNt3aq6YckXnNrMGQFj9VzhIW15HsVsYtIE6Cl7IEn1tL/zh+uv/qFTnx acOR+a4rbAtnegz5h2B2t61mS9xRuPl3CjcCl16O0UfVyMCK8xjDVAYmhIwAXkmqgr0i TPow== 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=p1u+oLWsVrPCC7NvSH5X60sIoNFIUf1osPQv0mFjyyE=; b=i9QzNUt0w4062PndrAJuezAyrv1Xk099plmmOdNZGVErhcnXN3Gp2l79/ouTxeqqYs 8oiiLpgtkDnalcIQtQ7ZWxDnfjfgmn1XFldhVfUfAEq6XdS+n0J/wXX+Q2VEXu7tLPSA q0ZmSlGlZPepkDa5mh0rBbJjCaIw674DlxuHb0+yF7jA18miZxOOeul+JGomyHmedNk6 EYV2M9ZDbdIRVcqJlDGoOGCOcL84suCTUt+bSexhWmBjxsKEkdU7fzlccd2ypHsRKjKs U8bpw6+3arm+/GYXyAVbFIkeaSKYAW3XDLYW6UJyIzZ69Am/QwRwfklcxLn+KR1/sd7y u+6w== X-Gm-Message-State: AHYfb5gabouaU0q0rk+lNvcteLzu/ltEaA9aqYegwN2z8ChSKg3xxhGy Wln+Yc605qWCAEVuoW8= X-Received: by 10.98.93.21 with SMTP id r21mr12836pfb.207.1504007244778; Tue, 29 Aug 2017 04:47:24 -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.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 29 Aug 2017 04:47:24 -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 , Jeremy Fitzhardinge , Chris Wright , Alok Kataria , Rusty Russell , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, Andy Lutomirski , "Kirill A. Shutemov" , Pan Xinhui , Kees Cook , virtualization@lists.linux-foundation.org Subject: [RFC PATCH v2 4/7] x86/paravirt: Add update in x86/paravirt pv_idle_ops Date: Tue, 29 Aug 2017 11:46:38 +0000 Message-Id: <1504007201-12904-5-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 .update is used to adjust the next poll time. Signed-off-by: Yang Zhang Signed-off-by: Quan Xu Cc: Jeremy Fitzhardinge Cc: Chris Wright Cc: Alok Kataria Cc: Rusty Russell Cc: Thomas Gleixner Cc: Ingo Molnar Cc: "H. Peter Anvin" Cc: x86@kernel.org Cc: Peter Zijlstra Cc: Andy Lutomirski Cc: "Kirill A. Shutemov" Cc: Pan Xinhui Cc: Kees Cook Cc: virtualization@lists.linux-foundation.org Cc: linux-kernel@vger.kernel.org --- arch/x86/include/asm/paravirt.h | 5 +++++ arch/x86/include/asm/paravirt_types.h | 1 + arch/x86/kernel/paravirt.c | 1 + 3 files changed, 7 insertions(+) diff --git a/arch/x86/include/asm/paravirt.h b/arch/x86/include/asm/paravirt.h index 6d46760..32e1c06 100644 --- a/arch/x86/include/asm/paravirt.h +++ b/arch/x86/include/asm/paravirt.h @@ -207,6 +207,11 @@ static inline void paravirt_idle_poll(void) PVOP_VCALL0(pv_idle_ops.poll); } +static inline void paravirt_idle_update_poll_duration(unsigned long duration) +{ + PVOP_VCALL1(pv_idle_ops.update, duration); +} + static inline void paravirt_alloc_ldt(struct desc_struct *ldt, unsigned entries) { PVOP_VCALL2(pv_cpu_ops.alloc_ldt, ldt, entries); diff --git a/arch/x86/include/asm/paravirt_types.h b/arch/x86/include/asm/paravirt_types.h index cf45726..3b4f95a 100644 --- a/arch/x86/include/asm/paravirt_types.h +++ b/arch/x86/include/asm/paravirt_types.h @@ -326,6 +326,7 @@ struct pv_lock_ops { struct pv_idle_ops { void (*poll)(void); + void (*update)(unsigned long); } __no_randomize_layout; /* This contains all the paravirt structures: we get a convenient diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c index 1b5b247..a11b2c2 100644 --- a/arch/x86/kernel/paravirt.c +++ b/arch/x86/kernel/paravirt.c @@ -315,6 +315,7 @@ struct pv_time_ops pv_time_ops = { struct pv_idle_ops pv_idle_ops = { .poll = paravirt_nop, + .update = paravirt_nop, }; __visible struct pv_irq_ops pv_irq_ops = {