Received: by 10.223.185.111 with SMTP id b44csp780096wrg; Fri, 9 Mar 2018 13:37:25 -0800 (PST) X-Google-Smtp-Source: AG47ELv89UL2CumHkgbl//KZbQNtw4DAEoU4ihXnEoUc4ozFjo7tCycWdql3sui7JDhrshKhlYti X-Received: by 2002:a17:902:24a5:: with SMTP id w34-v6mr28633454pla.221.1520631445017; Fri, 09 Mar 2018 13:37:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520631444; cv=none; d=google.com; s=arc-20160816; b=WwW6ktsOvt7B4yrAjhBc6IS2P2ZgfMu/2ItRZ8cfhFsRpD3AZNYz0oU8aRbouMWPfM VXB32GpKLZRyAx2hyZHqbiwpGifPJQVFvFHXHgdMhJ2c+uG5py20t0D8uJ21rKysvty0 MDd3J6fodgNV/IZ83sZFZtbzz9d5Gnyf58zerR+F/1LFLbERQ/vFtwQZLEexLKaTSitE WG6zuzXGQq3pdXcI744kLEtigE9lBdlCA3spMZwd1WpO7Osi5+PohjH5wmAY9r3p+IVk cI+QrM04dmX+4N0j7chbWd83JQRvWZf2IR2D8Og4CW9W+fhLU7UXsb0q2sxYwYyX/ara LIoQ== 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-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=fWgfdtaTbL/6iGpoXUOoWkNpWZidzX0gc7mSXc1OYco=; b=hr9Wpfh+IbCwUKUaGeZteqHuafT7z7OPHo45ccG3ENWvPrUKgWreIHziJaWpjvKG8r pf1HcwK6/Lfy40jBJhJgNXBmBga9+6yL5Su695UijOvYvWd/hk+Ny+fajMZIMzshiVE/ 4xyOESXFMsK8wBSCSn7SAI+yEb3eTIYgg07cxrUyb8hSgf2XfB3FDoCy4DAHgNf4uoO3 4dqfgeJQOVpEZZfun0HWglaxy5F3ko+kISudM4tfjWfGangWAkXW/VQ+Nklif+9olYfS XEXBGnNJy3ZCOqCPpvn4OjyVoeO6cxu23gxIyhgUwEia5tJnIMJFPf5UCGtqmTsBpJxv BHtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@christofferdall-dk.20150623.gappssmtp.com header.s=20150623 header.b=TyLZNukK; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c9-v6si31555plz.556.2018.03.09.13.37.10; Fri, 09 Mar 2018 13:37:24 -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=@christofferdall-dk.20150623.gappssmtp.com header.s=20150623 header.b=TyLZNukK; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932580AbeCIVgS (ORCPT + 99 others); Fri, 9 Mar 2018 16:36:18 -0500 Received: from mail-vk0-f46.google.com ([209.85.213.46]:45680 "EHLO mail-vk0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932157AbeCIVgR (ORCPT ); Fri, 9 Mar 2018 16:36:17 -0500 Received: by mail-vk0-f46.google.com with SMTP id k187so2988264vke.12 for ; Fri, 09 Mar 2018 13:36:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=christofferdall-dk.20150623.gappssmtp.com; s=20150623; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=fWgfdtaTbL/6iGpoXUOoWkNpWZidzX0gc7mSXc1OYco=; b=TyLZNukKJIHYcedMzjyod2Mo+hQOHMljmCBaOvzV0IdMCBc1BXm/5Bac/OEL3qwMma 2d0wkb1ZnMCZHXe6uw1MW6+AUdWlZlkEMeuY9/pT5BWh8cRKhjPX9OwiCRupkyiVo9tf CFRHQwysSOWNPDUS6pYy5hM1pGKq76lv3H/b1KZeOaNgRGy1dXN93/KDlE9lvQohLOQi YsiYeREHJGm2SsVaLPrqmXPvJj9suK3jGgqBeB2gBEMiAn3QuAwDabdDJRmSMDe/5DQx TnlzQE7i5wDS+VOvUL0w7QH3kYGte4PNPXycz0EWhHsCFqwrBS330Yq95fAaAWCL1499 ejNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=fWgfdtaTbL/6iGpoXUOoWkNpWZidzX0gc7mSXc1OYco=; b=LscVY2CxDuzCbeHeNfOods2m7S/6K0BluDilLtlAe5liNX59WJQzl24TrQPR1N8wWj JP82TFX6eUOrWeJ8hkcg/ARjmuo8/iD+THD8MBVHx2f3eK0audKQeAXcOOEKGGfPXNIC Bjh5dbD3s0cgWw96blSaXqKrAlXDcphYjd7QKqc4dxgZrkAT44g71/gKXJLPFCuV0lm1 8z5Ic5opjykAHOwMUQTpQqYPQkL+3SL1U3LhJSU+H3Dxhd4ru8iD0UXDFHMsRVDNa5WT ivsDxgqxSau8LU5UsKnCT0zMhh+81UDw9ZNspp1tA4mfwbgafISWGy8UnuikN13OXmB/ z12A== X-Gm-Message-State: APf1xPBbFw4HdGxkBC50RSIV3dJfRiolDzmFnsZEvyTCx7xpbfQLft7J l2wrlvOzymXMMybBmRf6G8PubQ== X-Received: by 10.31.115.197 with SMTP id o188mr22445130vkc.106.1520631376335; Fri, 09 Mar 2018 13:36:16 -0800 (PST) Received: from localhost ([187.153.112.39]) by smtp.gmail.com with ESMTPSA id 191sm783696vkv.45.2018.03.09.13.36.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Mar 2018 13:36:15 -0800 (PST) Date: Fri, 9 Mar 2018 13:36:12 -0800 From: Christoffer Dall To: Marc Zyngier Cc: Shunyong Yang , ard.biesheuvel@linaro.org, will.deacon@arm.com, eric.auger@redhat.com, david.daney@cavium.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, Joey Zheng Subject: Re: [RFC PATCH] KVM: arm/arm64: vgic: change condition for level interrupt resampling Message-ID: <20180309213612.GD1917@lvm> References: <1520492490-7943-1-git-send-email-shunyong.yang@hxt-semitech.com> <9ad47673-068e-f732-d2ca-9c76a8fbdfbc@arm.com> <0a15633d-8944-cb9b-3e6b-b08ee5ec42b9@arm.com> <20180308161900.GC1917@lvm> <86r2oubho3.wl-marc.zyngier@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <86r2oubho3.wl-marc.zyngier@arm.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 08, 2018 at 05:28:44PM +0000, Marc Zyngier wrote: > On Thu, 08 Mar 2018 16:19:00 +0000, > Christoffer Dall wrote: > > > > On Thu, Mar 08, 2018 at 11:54:27AM +0000, Marc Zyngier wrote: > > > On 08/03/18 09:49, Marc Zyngier wrote: [...] > > > The state is now pending, we've really EOI'd the interrupt, and > > > yet lr_signals_eoi_mi() returns false, since the state is not 0. > > > The result is that we won't signal anything on the corresponding > > > irqfd, which people complain about. Meh. > > > > So the core of the problem is that when we've entered the guest with > > PENDING+ACTIVE and when we exit (for some reason) we don't signal the > > resamplefd, right? The solution seems to me that we don't ever do > > PENDING+ACTIVE if you need to resample after each deactivate. What > > would be the point of appending a pending state that you only know to be > > valid after a resample anyway? > > The question is then to identify that a given source needs to be > signalled back to VFIO. Calling into the eventfd code on the hot path > is pretty horrid (I'm not sure if we can really call into this with > interrupts disabled, for example). > This feels like a bad layering violation to me as well. > > > > > > > > Example 2: > > > P+A -> guest EOI -> P -> delayed MI -> guest IAR -> A -> MI fires > > > > We could be more clever and do the following calculation on every exit: > > > > If you enter with P, and exit with either A or 0, then signal. > > > > If you enter with P+A, and you exit with either P, A, or 0, then signal. > > > > Wouldn't that also solve it? (Although I have a feeling you'd miss some > > exits in this case). > > I'd be more confident if we did forbid P+A for such interrupts > altogether, as they really feel like another kind of HW interrupt. How about a slightly bigger hammer: Can we avoid doing P+A for level interrupts completely? I don't think that really makes much sense, and I think we simply everything if we just come back out and resample the line. For an edge, something like a network card, there's a potential performance win to appending a new pending state, but I doubt that this is the case for level interrupts. The timer would be unaffected, because it's a HW interrupt. Thanks, -Christoffer