Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1426828imm; Wed, 19 Sep 2018 19:00:25 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYCSIS3PqpEdgUGIyVSXE0ZsF3/Zz5G/2CYYqAtLmtOR7rV55IVetOHJ/C+6sSGa1P4BJsX X-Received: by 2002:a65:6104:: with SMTP id z4-v6mr8173822pgu.361.1537408825666; Wed, 19 Sep 2018 19:00:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537408825; cv=none; d=google.com; s=arc-20160816; b=ffkuKXqheIY7lxmrKHQzcG7NUJhuGWDRP8nYnSiuyYxReafai12qQ6y1unZeV/W98M zl01llDuaCDtmVlYdKp5BT5bsNho1aq9m7KKFG26uvxuDfbk1AsCU1077Bls/V+LndnD g4hjTo9fYiEEWmdd7FnKYyqDpUWww0ZyLvDUqjcTV2Mdhkz3BZh18Ei/THHQ3xJZMqn/ jM3xb2YDUsvZBhmad8Q4BV4dU7gSroyYzN2pKYm9Q9DYDxd7pZ4vU68jDSVVAVI5FnP+ pTFG7iRmUiLZRGA0GnxY81SyejNP7/B6FKR4D51t29mT1pdH/+xut/TYifP0x5Em1tpB l/zA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=PetFle8XYV+6UZhkybsoCqI2RWeZoZOfEsizycb65Rc=; b=jXnokI4+/AiI6wM8fH86zYCvdqu3jfUF75x+tNuiCmzr73vLU6GQf1UgS7Si/KmYid 9k7Aba9PxMosK3UCTty0ZI+ICl+UnpRQcc2lf1VhwXS/VAIf6PozO7dh+eoLcVlnUynd v1qUJ0f7qwz57P+zEcndF0zXZcqu54d54iY/r2ubR3Pj2Vpqqd57/E5d+P64dmt93Qw0 /SQ6QzjcIg/2ozWxARdLNdcijKCOj0nwgPL6v9CihTiEEdT+MkdLtUr4pmz8WXrySQ2g EZxdAp/Vy9EYSh4LJvyzx6hIcPYQIYlSmbsKA68oQUhcEVufgXAOQIGcBA7RibGhbIB9 0TaQ== 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 o33-v6si23142953pld.180.2018.09.19.19.00.09; Wed, 19 Sep 2018 19:00:25 -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 S1732784AbeITHkH (ORCPT + 99 others); Thu, 20 Sep 2018 03:40:07 -0400 Received: from mga03.intel.com ([134.134.136.65]:33655 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726014AbeITHkH (ORCPT ); Thu, 20 Sep 2018 03:40:07 -0400 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Sep 2018 18:59:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,396,1531810800"; d="scan'208";a="265074941" Received: from yisun1-ubuntu.bj.intel.com (HELO localhost) ([10.238.156.104]) by fmsmga006.fm.intel.com with ESMTP; 19 Sep 2018 18:59:18 -0700 Date: Thu, 20 Sep 2018 09:56:44 +0800 From: Yi Sun To: Thomas Gleixner Cc: linux-kernel@vger.kernel.org, x86@kernel.org, chao.p.peng@intel.com, chao.gao@intel.com, isaku.yamahata@intel.com, michael.h.kelly@microsoft.com, tianyu.lan@microsoft.com, "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger Subject: Re: [PATCH v1 2/3] locking/pvqspinlock, hv: Enable PV qspinlock for Hyper-V Message-ID: <20180920015644.GE11769@yi.y.sun> References: <1536830005-37260-1-git-send-email-yi.y.sun@linux.intel.com> <1536830005-37260-3-git-send-email-yi.y.sun@linux.intel.com> <20180914090440.GB11769@yi.y.sun> <20180917125452.GC11769@yi.y.sun> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180917125452.GC11769@yi.y.sun> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 18-09-17 20:54:52, Yi Sun wrote: > On 18-09-14 12:42:33, Thomas Gleixner wrote: > > On Fri, 14 Sep 2018, Yi Sun wrote: > > > > > +static void hv_notify_long_spin_wait(void) > > > > > +{ > > > > > + u64 input = spin_wait_info | 0x00000000ffffffff; > > > > > > > > What? The result is always 0x00000000ffffffff ..... > > > > > > > Oh, sorry for such error. > > > > > > > > + spin_wait_info++; > > > > > + hv_do_fast_hypercall8(HVCALL_NOTIFY_LONG_SPIN_WAIT, input); > > > > > +} > > > > > + > > > > > +static void hv_qlock_kick(int cpu) > > > > > +{ > > > > > + spin_wait_info--; > > > > > > > > Looking at the above this is completely pointless and I have no idea what > > > > that variable is supposed to do. > > > > > > > Per Microsoft Hypervisor Top Level Functional Specification, the input > > > parameter of HVCALL_NOTIFY_LONG_SPIN_WAIT is defined as below: > > > > > > SpinwaitInfo – Specifies the accumulated count the guest was spinning. > > > > > > So, it is increased when guest is spinning and reduced when spinlock is > > > released. > > > > But that's a global variable, so it might be incremented and decremented by > > several CPUs at once. I don't have the spec and have no time to study it > > either, but global does not make any sense to me. The spin wait info comes > > from a single guest CPU and the wakeup is targeted at that guest CPU as > > well. So why global? It might be defined that way, but then you really want > > to explain it proper. > > > > Thanks, > > > > tglx > > > Let me check this more. Will reply to you later. Thanks! > > BRs, > Yi Sun I have got the details from Microsoft. Notify_Long_Spin_Wait hypercall should be called after a specific times spinning which can be got through CPUID. When hypervisor receives this, it will try to ensure that all vcpus are scheduled. Notify_Long_Spin_Wait is a standalone feature which should be split out as a new patch set. So I would like split it into a new patch set and submit it after PV Hyper-V Spinlock patch set merged.