From patchwork Tue Sep 1 21:41:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Matlack X-Patchwork-Id: 7106931 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 22EC6BF036 for ; Tue, 1 Sep 2015 21:41:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 48E0A20525 for ; Tue, 1 Sep 2015 21:41:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5EE37205D1 for ; Tue, 1 Sep 2015 21:41:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753792AbbIAVll (ORCPT ); Tue, 1 Sep 2015 17:41:41 -0400 Received: from mail-pa0-f45.google.com ([209.85.220.45]:35516 "EHLO mail-pa0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753279AbbIAVlh (ORCPT ); Tue, 1 Sep 2015 17:41:37 -0400 Received: by pacfv12 with SMTP id fv12so8321116pac.2 for ; Tue, 01 Sep 2015 14:41:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Mqi9nCc4GAA2yU3jtD/v9d/syEiQuKoWwR9PHg5x5yM=; b=MbX7tK7s7JECc+SggIOsMEdQ3FaTREcWxBhv+j/FX3R3+fDy4JiU1kLIeSTTl+/nrO qBNmyAI2nBjm238VyAaI9nMpALCEE4LyRF0TGhIEx/4aD5C60x2IOPRJ30NJDICFqFUJ gK3foHwwo3u4WdfpVzUiUqebBQOKjBloaMzaSCgLJQfEoUeY2slwf8Oe/jQMO+N6XWCb BHybcw2RB6E4j62TgRIGRi71ve3ka9m75pv8t3ScLrIjqXbC0ERX1zsk9pyZ9jEA91PT MkMWY4A6Hj5NmjLbbrJmyGJO13AcjQ7aS12WkXwUndLKGPylnasi2LhCy25CHKp5ODpe mVvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Mqi9nCc4GAA2yU3jtD/v9d/syEiQuKoWwR9PHg5x5yM=; b=Qg44MPsojU7FSRIoOa65KKEKP+K7/UVC04b8EGBpf4dpM9IMV5hAGoj1UTI+5wJywg eHX1zDHGIHdI9AsggRhZ9y4ORWVlw8+B4zcuE35u6/ZhzVkHlEs3Kf9sDycwnyZWeuPt v+jzE5yMBg/I1eDk70JySJO54/WMNJ+v1yNzA+TsUBm5i5Xyzy9r2TeKzuIilyn3XDuD 5aE5UgUD5gLPDNakFIwmTN/3irFO9Cxx4eLmQ0/7ZeeWQ23wCIb9m4g2DPQ62OmoEtaO 69su5ZB1/hD9sqvKdTbOQ/JDa23lGqeBBasv1Ou86pdDsTtXLTGKp2ZHfS0hh8v0dCMi qbrQ== X-Gm-Message-State: ALoCoQkIMTbDrKRUi88rjTl6OxQpQ2P6mmFr0Lq2x4nhsD6m66YsUQJMVEKvipVX6XiBheCW0sfe X-Received: by 10.66.245.142 with SMTP id xo14mr48007763pac.151.1441143697144; Tue, 01 Sep 2015 14:41:37 -0700 (PDT) Received: from dmatlack-linux.kir.corp.google.com ([172.31.88.63]) by smtp.gmail.com with ESMTPSA id yu2sm19381125pac.33.2015.09.01.14.41.36 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 01 Sep 2015 14:41:36 -0700 (PDT) From: David Matlack To: kvm@vger.kernel.org Cc: linux-kernel@vger.kernel.org, pbonzini@redhat.com, wanpeng.li@hotmail.com, peter@kieser.ca Subject: [PATCH 1/2] KVM: make halt_poll_ns per-VCPU Date: Tue, 1 Sep 2015 14:41:15 -0700 Message-Id: <1441143676-9375-2-git-send-email-dmatlack@google.com> X-Mailer: git-send-email 2.5.0.457.gab17608 In-Reply-To: <1441143676-9375-1-git-send-email-dmatlack@google.com> References: <1441143676-9375-1-git-send-email-dmatlack@google.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Wanpeng Li Change halt_poll_ns into per-VCPU variable, seeded from module parameter, to allow greater flexibility. Signed-off-by: Wanpeng Li --- include/linux/kvm_host.h | 1 + virt/kvm/kvm_main.c | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index 05e99b8..382cbef 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h @@ -241,6 +241,7 @@ struct kvm_vcpu { int sigset_active; sigset_t sigset; struct kvm_vcpu_stat stat; + unsigned int halt_poll_ns; #ifdef CONFIG_HAS_IOMEM int mmio_needed; diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 8b8a444..977ffb1 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -217,6 +217,7 @@ int kvm_vcpu_init(struct kvm_vcpu *vcpu, struct kvm *kvm, unsigned id) vcpu->kvm = kvm; vcpu->vcpu_id = id; vcpu->pid = NULL; + vcpu->halt_poll_ns = 0; init_waitqueue_head(&vcpu->wq); kvm_async_pf_vcpu_init(vcpu); @@ -1930,8 +1931,8 @@ void kvm_vcpu_block(struct kvm_vcpu *vcpu) bool waited = false; start = cur = ktime_get(); - if (halt_poll_ns) { - ktime_t stop = ktime_add_ns(ktime_get(), halt_poll_ns); + if (vcpu->halt_poll_ns) { + ktime_t stop = ktime_add_ns(ktime_get(), vcpu->halt_poll_ns); do { /*