From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.4 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6DAACC11F64 for ; Mon, 28 Jun 2021 22:27:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3DFD161CF9 for ; Mon, 28 Jun 2021 22:27:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234746AbhF1W36 (ORCPT ); Mon, 28 Jun 2021 18:29:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232124AbhF1W35 (ORCPT ); Mon, 28 Jun 2021 18:29:57 -0400 Received: from mail-oi1-x233.google.com (mail-oi1-x233.google.com [IPv6:2607:f8b0:4864:20::233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3376C061574 for ; Mon, 28 Jun 2021 15:27:30 -0700 (PDT) Received: by mail-oi1-x233.google.com with SMTP id a133so21651663oib.13 for ; Mon, 28 Jun 2021 15:27:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=TgjFclLl3YiwZ1dvSuW0oahhgKHX84plROL9LLmzJUY=; b=E2jzXv9x2Xn5ysIZar9e7StLyhdDjER9sGF4aZY6o3ZeN0gbOGSRCC/qdoWK6PWu+a Q/bG6EODzIW9NRLyfB1UG0qUFH4Mdcgag7Ffii59TopoDKue5/hQu0fGFq1Iy1vGwioG s35vaAjIfd8sh95GdhkHe24Q+qF4zcTGNJbqNhyNGC6ZfPp3kzf5QFMeYml6w5XH0HT+ FbHtcH2KY7uyfglrBJX9mYtI0gU4r96+kC6hqhqsNG2JIf6xdib+exukQhmjOVcPGkka /2VThAGGUXCRHWcfoOIWnKjb1gX3U0NdZHaZvSs7GbTd+xXwsoz3yalqUXaSeZksegxc SphQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=TgjFclLl3YiwZ1dvSuW0oahhgKHX84plROL9LLmzJUY=; b=F1/F0zrUlPkRbyX7Mi+VbqZecXsVLo1qLlD4hiA4Bqnas6xvmK/hL+lp9ubkcFFa48 iSlseUNWP3ZkKbGE33UX/nblWZmDQp5k9KxFJHDidZY2UMvsP2br5lS389NiA6iDuVGf +38IGaLkIty1DrZfiK8TOmzAnN4GOKyVa9IiNm0FyfEKDaHI51er3D0mBPVWEc4V3u7f xwNRFkeu5Vt6t0+zQ3DaaI4N2Qbbk5568bTh4PEkypmI8SO65lsYVE/v9R49gJZHM7pe JaVjhCEM5830t71izqKlZpMobsN9R4CciqRKZ3dSSlDBzQm4L3TCwp+8gY3ExfpgQ0CQ lJQQ== X-Gm-Message-State: AOAM532KhBGK0NaUZ7v+6Kt76xJGfTOa+zT6AUgujLmrFPudLI583sCt 1QrSQGTv0i/tccut6TqIgO0H+DZrsH7jJ4DV9H51FQ== X-Google-Smtp-Source: ABdhPJw9ILZlrn6oZrvBbHKhe+MwhRs7HI7CVYCe3cSKnkyTeh5kAuQnVyh/K0VlOGQ63oQhAYpDzsudJZ8d6aoQ5H4= X-Received: by 2002:aca:1e07:: with SMTP id m7mr18538259oic.28.1624919249454; Mon, 28 Jun 2021 15:27:29 -0700 (PDT) MIME-Version: 1.0 References: <73f1f90e-f952-45a4-184e-1aafb3e4a8fd@yandex.ru> <23b00d8a-1732-0b0b-cd8d-e802f7aca87c@yandex.ru> In-Reply-To: From: Jim Mattson Date: Mon, 28 Jun 2021 15:27:18 -0700 Message-ID: Subject: Re: exception vs SIGALRM race (was: Re: guest/host mem out of sync on core2duo?) To: stsp , Paolo Bonzini Cc: Sean Christopherson , kvm@vger.kernel.org, David Woodhouse , "ntsironis@arrikto.com" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Mon, Jun 28, 2021 at 3:00 PM stsp wrote: > > 29.06.2021 00:47, Jim Mattson =D0=BF=D0=B8=D1=88=D0=B5=D1=82: > > On Mon, Jun 21, 2021 at 5:27 PM stsp wrote: > >> 22.06.2021 01:33, Jim Mattson =D0=BF=D0=B8=D1=88=D0=B5=D1=82: > >>> Maybe what you want is run->ready_for_interrupt_injection? And, if > >>> that's not set, try KVM_RUN with run->request_interrupt_window set? > >> static int kvm_vcpu_ready_for_interrupt_injection(struct kvm_vcpu *vcp= u) > >> { > >> return kvm_arch_interrupt_allowed(vcpu) && > >> !kvm_cpu_has_interrupt(vcpu) && > >> !kvm_event_needs_reinjection(vcpu) && > >> kvm_cpu_accept_dm_intr(vcpu); > >> > >> } > >> > >> > >> So judging from this snippet, > >> I wouldn't bet on the right indication > >> from run->ready_for_interrupt_injection > > In your case, vcpu->arch.exception.injected is true, so > > kvm_event_needs_reinjection() returns true. Hence, > > kvm_vcpu_ready_for_interrupt_injection() returns false. > > > > Are you seeing that run->ready_for_interrupt_injection is true, or are > > you just speculating? > > OK, please see this commit: > https://www.lkml.org/lkml/2020/12/1/324 > > There is simply no such code > any longer. I don't know where > I got the above snippet, but its > not valid. The code is currently: > > --- > > static int kvm_vcpu_ready_for_interrupt_injection(struct kvm_vcpu *vcpu) > { > return kvm_arch_interrupt_allowed(vcpu) && > kvm_cpu_accept_dm_intr(vcpu); > } It looks like Paolo may have broken this in commit 71cc849b7093 ("KVM: x86: Fix split-irqchip vs interrupt injection window request"). The commit message seems focused only on vcpu->arch.interrupt.injected. Perhaps he overlooked vcpu->arch.exception.injected.