Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp511085pxb; Wed, 14 Apr 2021 23:08:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw4YtQCmvKKrMykF7JMZlEpBNSRK/bLWawlqmCLR7/XSUn1mx/QbZOdu8wt5zDg5B5Fvp/p X-Received: by 2002:a05:6402:26c9:: with SMTP id x9mr2107121edd.322.1618466911449; Wed, 14 Apr 2021 23:08:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618466911; cv=none; d=google.com; s=arc-20160816; b=BtFFmD8n25icPwZ5LzWDeWxYE4GCkXxFB4RUad3YlDbDxXVSdz87kuWO8OLBoWwWry ffh8WaowRe0dVNIvYERUYewJzGlkYRmEZTxII21PqnrxS0Nl6urpixwCYxwRvYUb8i6X c05p604eTIp4p9pH9++pNY8ch9XeyK5k5A8MAf2DCew0Gbi53yeewf4Z1pyK6y6xxrO/ Xi4sFNF8VZtdJkWvPixdppkfzSfgF5yuHUmpL/k6ix5lD68+wXruSDP+WGmAl84OriwF KhfTo/wPL6SnwdnD91DEAat3djAFzN4S//E0xoBCjzMSlK3ubU+0tCQMTXMV17IyUOl4 FOMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:subject:from :references:cc:to:dkim-signature; bh=+zQpfJqpx9ouYTivVYHq0zZnLNXpxnHkEi/8kwyW1R0=; b=hP24jX6T585q+00+C7JQpPW8YEcuZehuGPxRA6cLyqUFKc4yMHzfDy3GYD26Q0Sg0p OXf0rksH2rlcytlEUlDvu6B+Inz+gUYtEAtZkFZBavJOXN0/r9o9qziBQ6pX+J02KTiY BJcjShH9rQJiXPaR6m1c7nbyow3Pp/OQiJGH7S9pnLwLhOIuYRHILeSSX2qp/IpVywmG Mm+/OPAeXhxSz2iGs2256kQQzoUtdyVadMKiNZh/MS32CqkOPDtZwSmO93O8wWM+bU3u fHaqU+1b4IGKGP+IAuDwf4U/eSHeIbnq/0/Q8TMPcyQk2k1s/32lmrCk+zy5qblAnyGo nLuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="a0v1mNj/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g9si1480551edq.131.2021.04.14.23.08.08; Wed, 14 Apr 2021 23:08:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="a0v1mNj/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230407AbhDOGHh (ORCPT + 99 others); Thu, 15 Apr 2021 02:07:37 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:25740 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229793AbhDOGHe (ORCPT ); Thu, 15 Apr 2021 02:07:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618466831; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+zQpfJqpx9ouYTivVYHq0zZnLNXpxnHkEi/8kwyW1R0=; b=a0v1mNj/cgE58K7k80u+PLWYSEpOGbbSEr2S8zSxzQ77fG9rSL6nH3ZSvomZTSaq/gzHis rkNCE+4q2E90VDqb2TFKjZgwNIeLzaLTaQqhK9LA2HeKhOhTi3QhzrBvqn1/vUfeAG44zn WSn61MF6IiBcAQHx1B2fFcnUelcJR3E= Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-412-JQoklg8MOzuDJUNEbGyAsQ-1; Thu, 15 Apr 2021 02:07:09 -0400 X-MC-Unique: JQoklg8MOzuDJUNEbGyAsQ-1 Received: by mail-ej1-f70.google.com with SMTP id j25-20020a1709060519b029037cb8ca241aso537138eja.19 for ; Wed, 14 Apr 2021 23:07:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:cc:references:from:subject:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=+zQpfJqpx9ouYTivVYHq0zZnLNXpxnHkEi/8kwyW1R0=; b=CYKgopsRNM5g2G7Z+7TGQoDlr9U9pDGD0y7OyFZQNnL6B5AbbVv9MDfiexGMSUVWHl pameKHpf9NQzZPeSU7bVjqhmJyrVNQ5j379G2aCHbeqwfHWCXeyN+n55ttoibL81G48s yPqYUbpxDpbhKDWJZ0JetMziIbUeciRTYSBxutC+wqbyXrqGxHrEBdrJA1EMb/IVLKyp rmEZuGHMWXbmRlHDB8mO3b8mBxWfjFJthUc6B5LvLulNn/fNBKUi189uZyXBpSQ8F0F2 J4VU0mbdTqYqDQx6Pi1W2Xynfdfydg1D71z1l7XC+eX1I7YPpAiLFlhKBlRK5I8HO+4y c6iQ== X-Gm-Message-State: AOAM533cz6VCoCSM+dmhZfU1e5kqHTYwH9CdTfbHYiG3IbFKrxSe5XdK mBUQGi3J7a/andKRuvEEaMPQT2sK7iP6w89VwdG0H09XfSWH4bBagEZttaOzg5++slEd9mqWuTn ye4cxdlsOMQeImuq3Ru2jI+Ow X-Received: by 2002:a17:906:5052:: with SMTP id e18mr1711345ejk.112.1618466828689; Wed, 14 Apr 2021 23:07:08 -0700 (PDT) X-Received: by 2002:a17:906:5052:: with SMTP id e18mr1711322ejk.112.1618466828430; Wed, 14 Apr 2021 23:07:08 -0700 (PDT) Received: from ?IPv6:2001:b07:6468:f312:5e2c:eb9a:a8b6:fd3e? ([2001:b07:6468:f312:5e2c:eb9a:a8b6:fd3e]) by smtp.gmail.com with ESMTPSA id f11sm1113767ejc.62.2021.04.14.23.07.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 14 Apr 2021 23:07:07 -0700 (PDT) To: Lai Jiangshan Cc: Sean Christopherson , LKML , kvm@vger.kernel.org, Filippo Sironi , David Woodhouse , "v4.7+" , Wanpeng Li References: <20201127112114.3219360-1-pbonzini@redhat.com> <20201127112114.3219360-3-pbonzini@redhat.com> <80b013dc-0078-76f4-1299-3cff261ef7d8@redhat.com> <6d9dafb1-b8ff-82ef-93dc-da869fe7ba0f@redhat.com> From: Paolo Bonzini Subject: Re: [PATCH 2/2] KVM: x86: Fix split-irqchip vs interrupt injection window request Message-ID: <5b422691-ffc5-d73a-1bda-f1ee61116756@redhat.com> Date: Thu, 15 Apr 2021 08:07:06 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 15/04/21 02:59, Lai Jiangshan wrote: > The next call to inject_pending_event() will reach here AT FIRST with > vcpu->arch.exception.injected==false and vcpu->arch.exception.pending==false > >> ... if (!vcpu->arch.exception.pending) { >> if (vcpu->arch.nmi_injected) { >> static_call(kvm_x86_set_nmi)(vcpu); >> can_inject = false; >> } else if (vcpu->arch.interrupt.injected) { >> static_call(kvm_x86_set_irq)(vcpu); >> can_inject = false; > > And comes here and vcpu->arch.interrupt.injected is true for there is > an interrupt queued by KVM_INTERRUPT for pure user irqchip. It then does > the injection of the interrupt without checking the EFLAGS.IF. Ok, understood now. Yeah, that could be a problem for userspace irqchip so we should switch it to use pending_external_vector instead. Are you going to write the patch or should I? Thanks! Paolo > My question is that what stops the next call to inject_pending_event() > to reach here when KVM_INTERRUPT is called with exepction pending.