Received: by 2002:ac0:8c8e:0:0:0:0:0 with SMTP id r14csp432014ima; Wed, 6 Feb 2019 02:31:58 -0800 (PST) X-Google-Smtp-Source: AHgI3IYyrA2ZH2jaWERqFmxpJcteXjzbXv+GUmSCIoQVNO4u4VhXjcsQk0kksAvbxk7KI9xB2KAT X-Received: by 2002:a17:902:1101:: with SMTP id d1mr9940442pla.136.1549449118211; Wed, 06 Feb 2019 02:31:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549449118; cv=none; d=google.com; s=arc-20160816; b=zlil9QZsWWPX5mVHOrKp/7CRquA5w+dcqWmteH26CsiQ09h1srrFUNHAJnMGbuQYHP Idw/+2Bce9xVix5f5FYFz5ZEtm9ue5iKGJ18pDVhvTtEw2SOjj8Zx2NFVPn1CE1A8eCu YIAQ/VWGlbZczH+5RZWzVtd8e6W3Ivq24JGRyE+6UBeFZ+35eQza57Mk+P1jQupDeGeH yNfHyorloST/YQdfxPTfwEZp0UqTsv5olqzzYAbcjRFu+z3RPXbtIVUaXCIXXANxHEOi xjajFmlZvQgmZrZI7P/XL5AtmgQE3avz6dsXmKpOcUItBmhecde/4Jv8ycAH7aRFRERI likg== 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 :dkim-signature; bh=dsFh6M05FTa1HqYbD/4s+4kgJRw7zdkrrtt/zNsiACs=; b=1LkrBIrMKYNSjuBiw6BDz6LzZRjSj/5AFCMxdAcmm4JbeTz79z+TZaoP+lQGjGKiZt cAR7rnmIpnarzzzhfW63M5xycDwl4VzGne2gyjClXfQmwDELD2DEgSMP/tZLbZgEmBzr B8k38hFZNs+zgxIOKi/TEykrBrXz2mVr6i3uscf/FoBs3tzHy8kme4XU82o1ak7nEKNP e0x7u1lBfowvl4XFOGOR59n26tBW8LdFmaJieafIYsU1Lby2qAcSnGQfvAK7jdtJBcQX HfxirpuJYM0dR5fIyg3y/Mu4ARhnM2STykE3KsyIi4yOjjdnVGZWQrTvov0f1PX3ZUZn IHQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=ZktpcLN9; 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 cc2si6334790plb.231.2019.02.06.02.31.42; Wed, 06 Feb 2019 02:31:58 -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=fail header.i=@gmail.com header.s=20161025 header.b=ZktpcLN9; 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 S1729490AbfBFK3X (ORCPT + 99 others); Wed, 6 Feb 2019 05:29:23 -0500 Received: from mail-wm1-f66.google.com ([209.85.128.66]:37046 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726977AbfBFK3W (ORCPT ); Wed, 6 Feb 2019 05:29:22 -0500 Received: by mail-wm1-f66.google.com with SMTP id g67so2039858wmd.2; Wed, 06 Feb 2019 02:29:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:openpgp:autocrypt:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=dsFh6M05FTa1HqYbD/4s+4kgJRw7zdkrrtt/zNsiACs=; b=ZktpcLN91U0UgF8PQujPWH2ZXW3PERhxMzdaVO2TjvMznBszVXcMzV+PA2kOOLKRRE L6W0dICXV9AeASGsMBvSH1fq5547GCl/yF8u+VN9tudwZ9SdwykFQh4M3WAQO1977YHW 3f0ExuBYyd0YRHmA0BCJUZznLmv4pjKRoZhXTtKrQOta5DIeIO0xH7pOzi2tK8URtBQZ E9wl0h8RLhCzG3OnrusjWpMgekTjDCgmOjw4BRDdI4Pk4B65Y5Kbvl5QpGEij8ICn4/T Xtc/yJoqacyHMT+EAOkmuCuRYIJj9EnHLqYu0OJVHPk2UvNSmoQ4G3Wbhi1TyXNaekWC AYLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:openpgp :autocrypt:message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=dsFh6M05FTa1HqYbD/4s+4kgJRw7zdkrrtt/zNsiACs=; b=fgvuO/k/utBWVhdSOgO1OIiCtv/juxnbvfPSI+99gQJtjhMh+bWqYeaLUS4KdhH1Yq qr/eaQzNDyXd4OIk7mPlJucY4Jm8MeQtAOwKKOOLBvBG6QOpExlPMm3NeQvrAnGU/epB TO3Cmhseu+/9YfG7r2lVADmzxgMZ1gH3RQCTsB8rBzX3l5AqkNxLPKkw3fODHYGkiWI3 V3lY2qy0OQQS1iag4TUjeXxYq/fHc4cMPp0mD+APVs8e47pNgvAI7DXouMZb8jqsN8V6 xZu2C1ZkU4A1PgWtNxlRaw8GBSnJi1v7oLLDDfQiZxyzlyEbkpyZ1aaQWMOFuSpd+Rbh kAhw== X-Gm-Message-State: AHQUAuaOeTvYqBuB3OGYu+0sJ4vY+4MGmvu+DCwVfUl+72GUzgXVErqs SdF7yutpPrCUqSPPlK7UFrg= X-Received: by 2002:a1c:c181:: with SMTP id r123mr2596668wmf.8.1549448959835; Wed, 06 Feb 2019 02:29:19 -0800 (PST) Received: from ?IPv6:2001:b07:6468:f312:942c:94db:9853:9c8f? ([2001:b07:6468:f312:942c:94db:9853:9c8f]) by smtp.googlemail.com with ESMTPSA id s8sm22855324wrn.44.2019.02.06.02.29.17 (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Wed, 06 Feb 2019 02:29:18 -0800 (PST) Subject: Re: [RFC PATCH 7/8] KVM: i8254: Remove need for irq ack notifier To: "Suthikulpanit, Suravee" , "linux-kernel@vger.kernel.org" , "kvm@vger.kernel.org" , "x86@kernel.org" Cc: "joro@8bytes.org" , "rkrcmar@redhat.com" , "tglx@linutronix.de" , "mingo@redhat.com" , "bp@alien8.de" , "hpa@zytor.com" , "jsteckli@amazon.de" , "sironi@amazon.de" , "wawei@amazon.de" References: <20190204144128.9489-1-suravee.suthikulpanit@amd.com> <20190204144128.9489-8-suravee.suthikulpanit@amd.com> From: Paolo Bonzini Openpgp: preference=signencrypt Autocrypt: addr=pbonzini@redhat.com; keydata= mQHhBFRCcBIBDqDGsz4K0zZun3jh+U6Z9wNGLKQ0kSFyjN38gMqU1SfP+TUNQepFHb/Gc0E2 CxXPkIBTvYY+ZPkoTh5xF9oS1jqI8iRLzouzF8yXs3QjQIZ2SfuCxSVwlV65jotcjD2FTN04 hVopm9llFijNZpVIOGUTqzM4U55sdsCcZUluWM6x4HSOdw5F5Utxfp1wOjD/v92Lrax0hjiX DResHSt48q+8FrZzY+AUbkUS+Jm34qjswdrgsC5uxeVcLkBgWLmov2kMaMROT0YmFY6A3m1S P/kXmHDXxhe23gKb3dgwxUTpENDBGcfEzrzilWueOeUWiOcWuFOed/C3SyijBx3Av/lbCsHU Vx6pMycNTdzU1BuAroB+Y3mNEuW56Yd44jlInzG2UOwt9XjjdKkJZ1g0P9dwptwLEgTEd3Fo UdhAQyRXGYO8oROiuh+RZ1lXp6AQ4ZjoyH8WLfTLf5g1EKCTc4C1sy1vQSdzIRu3rBIjAvnC tGZADei1IExLqB3uzXKzZ1BZ+Z8hn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ei+MMNDm S1SMx7wu0evvQ5kT9NPzyq8R2GIhVSiAd2jioGuTjX6AZCFv3ToO53DliFMkVTecLptsXaes uUHgL9dKIfvpm+rNXRn9wAwGjk0X/A== Message-ID: <8ecf791c-d850-25d9-562e-aa2ff5944d2e@redhat.com> Date: Wed, 6 Feb 2019 11:29:15 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.1 MIME-Version: 1.0 In-Reply-To: <20190204144128.9489-8-suravee.suthikulpanit@amd.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/02/19 15:42, Suthikulpanit, Suravee wrote: > From: Julian Stecklina > > ACK notifiers don't work with AMD AVIC when the PIT interrupt is > delivered as edge-triggered fixed interrupt via the IOAPIC. AMD > processors cannot exit on EOI for these interrupts. The ACK notifiers do > work when the interrupt is delivered via PIC as ExtINT, because the ACK > comes as PIO write that KVM sees. > > Change the PIT code to not rely on the ACK notifiers. The IRQ ACK > notifier in the PIT emulation re-schedules pit->expired to reinject any > pending PIT interrupt. This seems useless, because we can pulse the PIT > interrupt even when the interrupt is not ACKed yet. This means any timer > expiry when the interrupt was being handled by the guest, will cause an > interrupt to be injected automatically when the interrupt is ACKed. The difference is that with the irq ack notifier *all* the pending PIT interrupts will be delivered. Without, only one will. If you don't want the ack notifier, you can do that with the KVM_REINJECT_CONTROL ioctl. Unfortunately, reinject is enabled by default and that is part of the userspace ABI and we cannot change it. It's possible to enable AVIC when reinject is disabled, and we fix that at the QEMU level by changing the default reinject behavior, basically with this one-line change: diff --git a/hw/i386/kvm/i8254.c b/hw/i386/kvm/i8254.c index d4d4a85..1d82860 100644 --- a/hw/i386/kvm/i8254.c +++ b/hw/i386/kvm/i8254.c @@ -305,7 +305,7 @@ static void kvm_pit_realizefn(DeviceState *dev, Error **errp) static Property kvm_pit_properties[] = { DEFINE_PROP_UINT32("iobase", PITCommonState, iobase, -1), DEFINE_PROP_LOSTTICKPOLICY("lost_tick_policy", KVMPITState, - lost_tick_policy, LOST_TICK_POLICY_DELAY), + lost_tick_policy, LOST_TICK_POLICY_DISCARD), DEFINE_PROP_END_OF_LIST(), }; plus the corresponding change to compat properties in hw/i386/pc.c. Alternatively, it is probably a good time to switch the default to split irqchip in QEMU. Split irqchip was introduced in kernel 4.5, which was released about three years ago. Paolo > Reviewed-by: Filippo Sironi > Signed-off-by: Julian Stecklina > Signed-off-by: Suravee Suthikulpanit