Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp626819ybc; Tue, 19 Nov 2019 06:47:30 -0800 (PST) X-Google-Smtp-Source: APXvYqy1mHDxuncv6PXK0F9s1FmBsYfwPKX+pvHl60aheE7Bb1NBcTfugTwLfNEAbit9nnHfDCpY X-Received: by 2002:a17:906:57c3:: with SMTP id u3mr30291146ejr.254.1574174849885; Tue, 19 Nov 2019 06:47:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574174849; cv=none; d=google.com; s=arc-20160816; b=vdtUjKr0FyUkp2QYMUCE5jx6fB3IZXyxpw6yf0PALrzopfYLH5EZHlcuRPlJ6Zn8YR 0kUzoEgV64yvg4dOypb0khk4a+aDnkJI5Q+cAiht5u6yj9NTVE7HmpP8t8GJoqdmNlrT xXrJxz9Rsczp07+ki06NXXPLnPiQX7iORakoel0+viMpjPcXwh7VnyH6r2Wkrsw9w97W lr2M3Zj1pTKhelfRg1EW0iYCXAaYIJMRW1q4xz6sFrCG6ueuRt4Y9hGGGlsf026uilA/ 8YaRlBMpP/UNWHfDOJ3Dpx/xP8gK0l0CtvTtIqgLIgXPqAbVZ2GpRQIFPUNdh6Qsmdve yqnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:date:message-id:from :references:cc:to:subject:dkim-signature; bh=KyULXMqBuw+BBUz3KfOuulONWiy+9k5YMKxdr3Y2jng=; b=hu2jzotgvdP651KIC0Szr37vBuZwqSFam/SpZ0ErDi9+fSzX5HfE6OD5TkdwkKzyVg gm4xAP5EjqfAh4l/htH9nBADecDZMOxU4qm9rutlaVEFbMfQL6AM4ucy25/lxWpINpE5 GnzDMjB63Y2vOYGkeUVFqAJTjVttapCuwnPLQJ1PdPTxzx1gfryt49do2UJfNNVWp3Ui ggCSdBwVs1D8/NqgHU23L9OVqb+TtsvEN8sEVSijYjUkgYjI46SCJ0Q7i4oeZvXIH8GW YOSNikxg9RSVy0QeZnxxWqx2ts9FOFqjDt0EG4lCoFNH50ncN9JpQqW4ExZkWu5rO8Cz tQdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2019-08-05 header.b=D50jOauu; 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=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v13si14164660eju.409.2019.11.19.06.47.06; Tue, 19 Nov 2019 06:47:29 -0800 (PST) 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; dkim=pass header.i=@oracle.com header.s=corp-2019-08-05 header.b=D50jOauu; 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=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728238AbfKSOpm (ORCPT + 99 others); Tue, 19 Nov 2019 09:45:42 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:40734 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727124AbfKSOpm (ORCPT ); Tue, 19 Nov 2019 09:45:42 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id xAJEdWqK177168; Tue, 19 Nov 2019 14:44:35 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2019-08-05; bh=KyULXMqBuw+BBUz3KfOuulONWiy+9k5YMKxdr3Y2jng=; b=D50jOauubj4oZP7fPhc5xjTiqd5rjhiK8fcjZFX7JtrtHR997ILtuMgkrvmdyMfxeAnl bl2kbnnyDRVPZJo39wPWkqTsuL5qQsnfqabquloo2EG6s+Zkumdhu3cQwVRqs6rbG7RR 74sgKNiZMjO657E+ltSzO8+mB8M+5d3wXGwyIXT6rZ1tbfkc37leZXG4qmfNNhk6J7bw YmN1UHwrLYWdSZmmscNkVbXLa2Mej/5PCQ7A16yuK0JKjfRFVZagXXLIEbree+WszRNE VdsFa1DXwFxgceJT4G4ymR5yKbfjMCdC/NXT+fwLGdk7cGn0ek3DWNtAc8uLBuBABrHF lg== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2120.oracle.com with ESMTP id 2wa9rqf8aw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 19 Nov 2019 14:44:34 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id xAJEdWGT055757; Tue, 19 Nov 2019 14:44:34 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userp3020.oracle.com with ESMTP id 2wc09xga8g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 19 Nov 2019 14:44:34 +0000 Received: from abhmp0002.oracle.com (abhmp0002.oracle.com [141.146.116.8]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id xAJEiWFh031935; Tue, 19 Nov 2019 14:44:32 GMT Received: from [192.168.1.67] (/94.61.1.144) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 19 Nov 2019 06:44:31 -0800 Subject: Re: [PATCH v2 2/3] KVM: VMX: Do not change PID.NDST when loading a blocked vCPU To: Wanpeng Li Cc: kvm , LKML , Paolo Bonzini , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Liran Alon , Jag Raman References: <20191111172012.28356-1-joao.m.martins@oracle.com> <20191111172012.28356-3-joao.m.martins@oracle.com> From: Joao Martins Message-ID: <6b6acdee-f080-241f-8a6e-89708f746944@oracle.com> Date: Tue, 19 Nov 2019 14:44:27 +0000 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9445 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=2 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1911140001 definitions=main-1911190134 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9445 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1911140001 definitions=main-1911190134 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/19/19 11:36 AM, Wanpeng Li wrote: > On Tue, 12 Nov 2019 at 01:23, Joao Martins wrote: >> >> While vCPU is blocked (in kvm_vcpu_block()), it may be preempted which >> will cause vmx_vcpu_pi_put() to set PID.SN. If later the vCPU will be > > How can this happen? See the prepare_to_swait_exlusive() in > kvm_vcpu_block(), the task will be set in TASK_INTERRUPTIBLE state, > kvm_sched_out will set vcpu->preempted to true iff current->state == > TASK_RUNNING. You're right. But preemption (thus setting PID.SN) can still happen before vcpu_block(), or otherwise scheduled out if we are already in vcpu_block() (with task in TASK_INTERRUPTIBLE). The right term we should have written in that sentence above would have been 'scheduled out' and drop the vcpu_block mention and it would encompass both cases. A better sentence would perhaps be: "While vCPU is blocked (or about to block) it may be scheduled out which will cause vmx_vcpu_pi_put() to be called." But setting or not preempted/PID.SN doesn't change the rest and was mentioned for completeness. Joao