Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1385336iob; Fri, 29 Apr 2022 04:27:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwykCRf+Wx7f23JiPRi7RMBWv1vIsmjXEafFHa7AuMFtZxne4USd2I2vpUHfCKGPB6D38Gm X-Received: by 2002:a65:5acd:0:b0:399:24bc:bbfd with SMTP id d13-20020a655acd000000b0039924bcbbfdmr31853633pgt.323.1651231632024; Fri, 29 Apr 2022 04:27:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651231632; cv=none; d=google.com; s=arc-20160816; b=JYKs6q3SP4FNXnnIzoPViUmdxdBJo/aPWKBcy3O2QEjL9+exLgXC6CFh0MjK5yGzTq B+zGaH4fvLD3iabJyAyli/e4P3woYhjv1THvHZ06RLgJukcYGbwEL182M7NbpjfVoVdy MF9WGlWIH965E5A85jsDNjPxzAL0QTrvCz5i7JPY5rKRgbkhXxni8jUWnOYAU2pYRgeo JfatwulsLcN/955z7x85n4BpFc/aAIiRaHPUGZMCap+6fecg/P+siFF8b9T/j3uFEO2f ber+hZ5LRZJaWmLCw4Csre0euJvEIQETCTvHYU4vr/tOHFHsOXl9VsEOHIbT9vaPoPFy G65w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:dkim-signature; bh=5PDm4tHCHPYdLQ9C5vAO9ilNtVAoyTm1UBO+qRDuy2I=; b=ymtHskf+rYhj3BLKqC1yu0eVpyDx4gDscpZfSDJZowrtwSmJhksL8Y6zbw1lWQHS8g oSX/Zp3SnPUpnKGufgssNRy5hBbAVX2izqz0/TSQ5XgzzyjI/f22UMTqjCNQdcs1Ei4I ZnH6/AV3VYHfLNikl7ndCxOr3dCjQBj8qsnwQ0EshiVQ/Kc2Zw+BQpCNkU1f1rgxMV2Z w7Ja5PSwyfk6RQwYvXg53Va2adDN5tg7Dug2EmOpQusBVqEl1zHtq0WmwFTiQLpZmXUD 9JOJPSwHxoSN06hEdnOv7umPcGAsfAPbsUja3nft/HJaUSqSDuKvFzD8TfxbdhAAzC2A DhmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Z9+g9fYP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o17-20020a637e51000000b003aa36aa1f45si3249555pgn.754.2022.04.29.04.26.57; Fri, 29 Apr 2022 04:27:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Z9+g9fYP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S1348452AbiD1OiJ (ORCPT + 99 others); Thu, 28 Apr 2022 10:38:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232699AbiD1OiI (ORCPT ); Thu, 28 Apr 2022 10:38:08 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3F117B7155 for ; Thu, 28 Apr 2022 07:34:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1651156492; 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=5PDm4tHCHPYdLQ9C5vAO9ilNtVAoyTm1UBO+qRDuy2I=; b=Z9+g9fYP4oDChYLW8P0eDJKHW2SxSHmZToAJO3FSgf6ZxykueIP2ffrHGi7n32VTFwhpXV wU5ynEMSxHy/FF2pb6E6g/JPeecXrXi8QreY5NWt9MlM1GrOZ+wmr7NkOex+3PBMd5lZOU XqEOsuOVgUStFRCA4cCG3n842YmTbPA= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-259-mXTDc8oQPDqKujQj-mWFaQ-1; Thu, 28 Apr 2022 10:34:48 -0400 X-MC-Unique: mXTDc8oQPDqKujQj-mWFaQ-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8B9328001EA; Thu, 28 Apr 2022 14:34:47 +0000 (UTC) Received: from starship (unknown [10.40.192.41]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8C3242166B4D; Thu, 28 Apr 2022 14:34:45 +0000 (UTC) Message-ID: Subject: Re: [PATCH v2 02/11] KVM: SVM: Don't BUG if userspace injects a soft interrupt with GIF=0 From: Maxim Levitsky To: "Maciej S. Szmigiero" Cc: Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Sean Christopherson , Paolo Bonzini Date: Thu, 28 Apr 2022 17:34:44 +0300 In-Reply-To: <4baa5071-3fb6-64f3-bcd7-2ffc1181d811@maciej.szmigiero.name> References: <20220423021411.784383-1-seanjc@google.com> <20220423021411.784383-3-seanjc@google.com> <61ad22d6de1f6a51148d2538f992700cac5540d4.camel@redhat.com> <4baa5071-3fb6-64f3-bcd7-2ffc1181d811@maciej.szmigiero.name> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.5 (3.36.5-2.fc32) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2022-04-28 at 15:27 +0200, Maciej S. Szmigiero wrote: > On 28.04.2022 09:35, Maxim Levitsky wrote: > > On Sat, 2022-04-23 at 02:14 +0000, Sean Christopherson wrote: > > > From: Maciej S. Szmigiero > > > > > > Don't BUG/WARN on interrupt injection due to GIF being cleared if the > > > injected event is a soft interrupt, which are not actually IRQs and thus > > > > Are any injected events subject to GIF set? I think that EVENTINJ just injects > > unconditionaly whatever hypervisor puts in it. > > That's right, EVENTINJ will pretty much always inject, even when the CPU > is in a 'wrong' state (like for example, injecting a hardware interrupt > or a NMI with GIF masked). > > But KVM as a L0 is not supposed to inject a hardware interrupt into guest > with GIF unset since the guest is obviously not expecting it then. > Hence this WARN_ON(). If you mean L0->L1 injection, that sure, but if L1 injects interrupt to L2, then it should always be allowed to do so. I am not sure that I am right here, just noticed something odd. I'll take a better look at this next week. Best regards, Maxim levitsky > > > Best regards, > > Maxim Levitsky > > Thanks, > Maciej >