From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753696AbbIPJcU (ORCPT ); Wed, 16 Sep 2015 05:32:20 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58473 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752348AbbIPJcT (ORCPT ); Wed, 16 Sep 2015 05:32:19 -0400 Subject: Re: [PATCH v8 11/13] KVM: Update Posted-Interrupts Descriptor when vCPU is blocked To: Feng Wu , alex.williamson@redhat.com, joro@8bytes.org, mtosatti@redhat.com References: <1442393409-2623-1-git-send-email-feng.wu@intel.com> <1442393409-2623-12-git-send-email-feng.wu@intel.com> Cc: eric.auger@linaro.org, kvm@vger.kernel.org, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org From: Paolo Bonzini Message-ID: <55F9371E.8030701@redhat.com> Date: Wed, 16 Sep 2015 11:32:14 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <1442393409-2623-12-git-send-email-feng.wu@intel.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 16/09/2015 10:50, Feng Wu wrote: > * are two possible cases: > - * 1. After running 'pi_pre_block', context switch > + * 1. After running 'pre_block', context switch Please fold this in the previous patch. > * happened. For this case, 'sn' was set in > * vmx_vcpu_put(), so we need to clear it here. > - * 2. After running 'pi_pre_block', we were blocked, > + * 2. After running 'pre_block', we were blocked, > * and woken up by some other guy. For this case, (Same). > + spin_lock(&per_cpu(blocked_vcpu_on_cpu_lock, cpu)); > + list_for_each_entry(vcpu, &per_cpu(blocked_vcpu_on_cpu, cpu), > + blocked_vcpu_list) { > + struct pi_desc *pi_desc = vcpu_to_pi_desc(vcpu); > + > + if (pi_test_on(pi_desc) == 1) > + kvm_vcpu_kick(vcpu); > + } > + spin_unlock(&per_cpu(blocked_vcpu_on_cpu_lock, cpu)); > +} Please document the lock in Documentation/virtual/kvm/locking.txt. Paolo