Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1636417imm; Wed, 26 Sep 2018 23:28:07 -0700 (PDT) X-Google-Smtp-Source: ACcGV62e41I+XjSSp/+ucEoXU5XvLwVhFXU4jP+6TU4Q0IgbX7ulQs830jTz2uLki3KPOWdQoNTG X-Received: by 2002:a63:1064:: with SMTP id 36-v6mr8637891pgq.254.1538029687228; Wed, 26 Sep 2018 23:28:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538029687; cv=none; d=google.com; s=arc-20160816; b=EbkMw105hUogemkOZYcP3McmQISuAM2Nhyw0IRjOerO8QeExE6gO0Nubu0UUlfedO3 eaa5IJzMUvi2/3VGiyodp59EgwvOlP+GhSZlAijv5XlzlRN9xVcM/UR7U+fl2891GYk8 Le7WcbLKPQlrslV8f1EiRxibSqbOQW17TFcpKlXtRriC0p/XLhObZ+fsc/3aBRij+glF iByul2ZYnYTIhgxAgi/ljSh2c84PNw8vPnDDdfdfzvoeZ9bbKctZKDVdJ27XyZMzJmrv YG0YMfiG0iF1DJpEYzPirUbFyOF+gtFAJmM++KXFB6aUjImG36o+BbvYChIX3+BOrf2P uvYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=Oqi3RA10ns0+5hq90snULHOHgj8CuH2iNtOIRyvL3Y8=; b=OjPatS6DCrDo0XUFaY8Qmn33qpBCTpMGPHvuQSMbkmcBAIZgvubjcSfsVyOLhO/ftR H1WGP8Gw88+gRzWKMbCCK87ZQboT0ml9qmw1epKXQlKuAyDh+CRBDjBpJnHHIyDXU3zl EoHrrhxIaS9/92X1DJP5eskFDMGPck6co2JGoyuWXGYa7LYF1kvroz/JYiMGegCr+Zrz ARhOsT+zDhiW3RUbvsU3MVED/MnXo6F9ik3VVfwULdjpPJB5W5O9rnQd/9p7N1ADFZG6 sRCESX0Q10n1pLUx7pLbwn9+U9E085LvouVIXdQYfiqiXcrKB7I4iKJ+op8/jaK6lr62 RKJA== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o5-v6si1167579pgh.643.2018.09.26.23.27.51; Wed, 26 Sep 2018 23:28:07 -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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726948AbeI0MnI (ORCPT + 99 others); Thu, 27 Sep 2018 08:43:08 -0400 Received: from mga02.intel.com ([134.134.136.20]:18432 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726687AbeI0MnI (ORCPT ); Thu, 27 Sep 2018 08:43:08 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Sep 2018 23:26:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,309,1534834800"; d="scan'208";a="74048245" Received: from svm-s2600wft.bj.intel.com ([10.240.193.45]) by fmsmga008.fm.intel.com with ESMTP; 26 Sep 2018 23:26:28 -0700 From: Yi Sun To: linux-kernel@vger.kernel.org Cc: x86@kernel.org, tglx@linutronix.de, chao.p.peng@intel.com, chao.gao@intel.com, isaku.yamahata@intel.com, michael.h.kelley@microsoft.com, tianyu.lan@microsoft.com, Yi Sun , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Jonathan Corbet , "Michael Kelley (EOSG)" Subject: [PATCH v3 0/2] Enable PV qspinlock for Hyper-V Date: Thu, 27 Sep 2018 14:01:42 +0800 Message-Id: <1538028104-114050-1-git-send-email-yi.y.sun@linux.intel.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org v2->v3: - use "Hyper-V: " as the message prefix - remove unnecessary header files - remove unnecessary check in 'hv_qlock_wait' - fix compilation error on different platforms v1->v2: - compile hv_spinlock.c only when CONFIG_PARAVIRT_SPINLOCKS enabled - merge v1 patch 2/3 to single patch - remove part of the boilerplate in hv_spinlock.c - declare hv_pvspin as __initdata - remove spin_wait_info and hv_notify_long_spin_wait because SpinWaitInfo is a standalone feature. - add comments for reading HV_X64_MSR_GUEST_IDLE - replace pr_warn to pr_info - use pr_fmt instead of the 'hv:' prefix - register callback function for smp_ops.smp_prepare_boot_cpu to initialize hyper-v spinlock This patch adds the necessary Hyper-V specific code to allow PV qspinlock work on Hyper-V. In wait callback function, read HV_X64_MSR_GUEST_IDLE MSR to trigger the guest's transition to the idle power state which can be exited by an IPI even if IF flag is disabled. In kick callback function, just send platform IPI to make waiting vcpu exit idle state. In vcpu_is_preempted callback function, return false directly because Hyper-V does not provide such interface so far. Cc: "K. Y. Srinivasan" Cc: Haiyang Zhang Cc: Stephen Hemminger Cc: Jonathan Corbet Cc: Thomas Gleixner Cc: Michael Kelley (EOSG) Yi Sun (2): X86/Hyper-V: Add Guest IDLE MSR support locking/pvqspinlock, hv: Enable PV qspinlock for Hyper-V Documentation/admin-guide/kernel-parameters.txt | 5 ++ arch/x86/hyperv/Makefile | 4 ++ arch/x86/hyperv/hv_spinlock.c | 76 +++++++++++++++++++++++++ arch/x86/include/asm/hyperv-tlfs.h | 5 ++ arch/x86/include/asm/mshyperv.h | 1 + arch/x86/kernel/cpu/mshyperv.c | 14 +++++ 6 files changed, 105 insertions(+) create mode 100644 arch/x86/hyperv/hv_spinlock.c -- 1.9.1