Received: by 2002:a25:5b86:0:0:0:0:0 with SMTP id p128csp1737783ybb; Fri, 29 Mar 2019 10:15:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqwQ79/Wr+HjIhWwr8QsUDPQlxAp+OmPuliDjMoaPuLmj/LJ59s7uJmeDe21K456LE+I2de6 X-Received: by 2002:a17:902:e382:: with SMTP id ch2mr25287897plb.94.1553879758383; Fri, 29 Mar 2019 10:15:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553879758; cv=none; d=google.com; s=arc-20160816; b=xag02dPKR3ojDftiI1QW8duYFErp8Z2jje4FvItGmGC4dTe07oPBvUHihAN2e24962 G4juSNC/8ygniJloqCUv3e+N8+MP0ablzav2UKokjaxib0bcbhfHxVACCYnDHrvuPII5 wGB78ORIvW/di4pd75797I2uPIjG+t7rCRczUQZtvuMDI3/G0xZaYIjiB716f9ciGRr4 /rGSyzNq6k6AbdCIAcIPEMOA/27OagPzXjiamLUHWlI1tyI7dmvPxKxYy3/TedpnVW0a rEb3npRJTWppUAoTQEKPR4Gn3HzS+JKSLWEhQGRCcDfxW+Gicjr18629s81Iq22VlWeE HORw== 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:user-agent:date :message-id:autocrypt:openpgp:from:references:cc:to:subject; bh=dMXNZZCd8jBhO0eB3XxFfoKf38cQGau3Apu+LDT69wo=; b=X6RELjQineLpoRPDiNpCctP5xLVFzmLd+AgLrS1Vn4TGvECY7NRvJWriyrxMh38Uit Bcco6aLIZJX4tQkzV2WJO/mEVPH409NjYowfLDfEeK3cR+zwD0hfDhF5UJT/3cmfYAC+ C1VMl+oHSIxpuc1l+3uv7QEesdzZjpqKkG6nPi/tmKhtyGe8BF+UtXjlcBk71BTGErLS hdy0SwdOMGeTlCBsT75ifbmmEr27ktCwewyEDbSSJieaT3H4T8cQQl1tYrt1oJMRXQZD IKMD013WeGoFFheA07I5yEIXVYK1YPNxXhht14gp/Hh320LSnC/8ojCp/gDQdZhG9Z9p V3Hg== 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d132si2217314pgc.482.2019.03.29.10.15.42; Fri, 29 Mar 2019 10:15:58 -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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729814AbfC2RPH (ORCPT + 99 others); Fri, 29 Mar 2019 13:15:07 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59076 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729584AbfC2RPG (ORCPT ); Fri, 29 Mar 2019 13:15:06 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 23BBD3099FD1; Fri, 29 Mar 2019 17:15:06 +0000 (UTC) Received: from [10.36.112.74] (ovpn-112-74.ams2.redhat.com [10.36.112.74]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AD172600C7; Fri, 29 Mar 2019 17:15:03 +0000 (UTC) Subject: Re: [PATCH RFC] KVM: x86: vmx: throttle immediate exit through preemtion timer to assist buggy guests To: Liran Alon Cc: Vitaly Kuznetsov , kvm@vger.kernel.org, =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , Sean Christopherson , linux-kernel@vger.kernel.org References: <20190328203110.20655-1-vkuznets@redhat.com> <87d0m93frp.fsf@vitty.brq.redhat.com> <89d4189b-de6a-7634-de8b-29a044a86e12@redhat.com> <63F1B6AE-F7A0-40D9-9582-558723800682@oracle.com> From: Paolo Bonzini Openpgp: preference=signencrypt Autocrypt: addr=pbonzini@redhat.com; prefer-encrypt=mutual; keydata= mQHhBFRCcBIBDqDGsz4K0zZun3jh+U6Z9wNGLKQ0kSFyjN38gMqU1SfP+TUNQepFHb/Gc0E2 CxXPkIBTvYY+ZPkoTh5xF9oS1jqI8iRLzouzF8yXs3QjQIZ2SfuCxSVwlV65jotcjD2FTN04 hVopm9llFijNZpVIOGUTqzM4U55sdsCcZUluWM6x4HSOdw5F5Utxfp1wOjD/v92Lrax0hjiX DResHSt48q+8FrZzY+AUbkUS+Jm34qjswdrgsC5uxeVcLkBgWLmov2kMaMROT0YmFY6A3m1S P/kXmHDXxhe23gKb3dgwxUTpENDBGcfEzrzilWueOeUWiOcWuFOed/C3SyijBx3Av/lbCsHU Vx6pMycNTdzU1BuAroB+Y3mNEuW56Yd44jlInzG2UOwt9XjjdKkJZ1g0P9dwptwLEgTEd3Fo UdhAQyRXGYO8oROiuh+RZ1lXp6AQ4ZjoyH8WLfTLf5g1EKCTc4C1sy1vQSdzIRu3rBIjAvnC tGZADei1IExLqB3uzXKzZ1BZ+Z8hnt2og9hb7H0y8diYfEk2w3R7wEr+Ehk5NQsT2MPI2QBd wEv1/Aj1DgUHZAHzG1QN9S8wNWQ6K9DqHZTBnI1hUlkp22zCSHK/6FwUCuYp1zcAEQEAAbQj UGFvbG8gQm9uemluaSA8cGJvbnppbmlAcmVkaGF0LmNvbT6JAg0EEwECACMFAlRCcBICGwMH CwkIBwMCAQYVCAIJCgsEFgIDAQIeAQIXgAAKCRB+FRAMzTZpsb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NqxUQRUZJEWbx2CRwkMHtOmzQiQ2tSLjKh/c HeyFH68xjeLcinR7jXMrHQK+UCEw6jqi1oeZzGvfmxarUmS0uRuffAb589AJW50kkQK9VD/9 QC2FJISSUDnRC0PawGSZDXhmvITJMdD4TjYrePYhSY4uuIV02v028TVAaYbIhxvDY0hUQE4r 8ZbGRLn52bEzaIPgl1p/adKfeOUeMReg/CkyzQpmyB1TSk8lDMxQzCYHXAzwnGi8WU9iuE1P 0wARAQABiQHzBBgBAgAJBQJUQnHuAhsMAAoJEH4VEAzNNmmxp1EOoJy0uZggJm7gZKeJ7iUp eX4eqUtqelUw6gU2daz2hE/jsxsTbC/w5piHmk1H1VWDKEM4bQBTuiJ0bfo55SWsUNN+c9hh IX+Y8LEe22izK3w7mRpvGcg+/ZRG4DEMHLP6JVsv5GMpoYwYOmHnplOzCXHvmdlW0i6SrMsB Dl9rw4AtIa6bRwWLim1lQ6EM3PWifPrWSUPrPcw4OLSwFk0CPqC4HYv/7ZnASVkR5EERFF3+ 6iaaVi5OgBd81F1TCvCX2BEyIDRZLJNvX3TOd5FEN+lIrl26xecz876SvcOb5SL5SKg9/rCB ufdPSjojkGFWGziHiFaYhbuI2E+NfWLJtd+ZvWAAV+O0d8vFFSvriy9enJ8kxJwhC0ECbSKF Y+W1eTIhMD3aeAKY90drozWEyHhENf4l/V+Ja5vOnW+gCDQkGt2Y1lJAPPSIqZKvHzGShdh8 DduC0U3xYkfbGAUvbxeepjgzp0uEnBXfPTy09JGpgWbg0w91GyfT/ujKaGd4vxG2Ei+MMNDm S1SMx7wu0evvQ5kT9NPzyq8R2GIhVSiAd2jioGuTjX6AZCFv3ToO53DliFMkVTecLptsXaes uUHgL9dKIfvpm+rNXRn9wAwGjk0X/A== Message-ID: <32296de3-8ce0-c20a-5948-a7eef267a328@redhat.com> Date: Fri, 29 Mar 2019 18:14:58 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 MIME-Version: 1.0 In-Reply-To: <63F1B6AE-F7A0-40D9-9582-558723800682@oracle.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Fri, 29 Mar 2019 17:15:06 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 29/03/19 16:32, Liran Alon wrote: > Paolo I am not sure this is the case here. Please read my other > replies in this email thread. > > I think this is just a standard issue of a level-triggered interrupt > handler in L1 (Hyper-V) that performs EOI before it lowers the > irq-line. I don’t think vector 96 is even related to the issue at > hand here. This is why after it was already handled, the loop of > EXTERNAL_INTERRUPT happens on vector 80 and not vector 96. Hmm... Vitaly, what machine were you testing on---does it have APIC-v? If not, then you should have seen either an EOI for irq 96 or a TPR below threshold vmexit. However, if it has APIC-v then you wouldn't have seen any of this (you only see the EOI for irq 80 because it's level triggered) and Liran is probably right. Paolo > In addition, there is a missing optimisation from Hyper-V that after > it handles an EXTERNAL_INTERRUPT exit, it doesn’t enable interrupts > to receive other pending host interrupts (In our case, the pending > vector 80) and will therefore only receive it once it enters back to > L2 which will cause another EXTERNAL_INTERRUPT exit but this time on > vector 80.