Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp3403747ybz; Mon, 4 May 2020 02:16:11 -0700 (PDT) X-Google-Smtp-Source: APiQypI9yTth30MC33oID+FiKSdc6rZYv3BW+XoVSEhZsrAzufq4fPkdqr64BzQ+aLDkAmHN+N2H X-Received: by 2002:a50:ec95:: with SMTP id e21mr13805227edr.253.1588583771503; Mon, 04 May 2020 02:16:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588583771; cv=none; d=google.com; s=arc-20160816; b=aizljUTwRJn03ntPfGGlLAKfKmvlDuI5th6BYknA4FLRqya+zg7j34n+O8c/YJPUj9 hK8iDwerASbGMOVGvZccPTk7T/m8lgt6EoD3SsVI3WBFBLn8Cgcc2g/NolN45SnCX3o4 RoOfmW26+XeBb0YCJs4gVBNnrhjhyjKLJWz6MwBvF3Pmx1ulnj6MBdWtIVWsnKyVZkDP kmqXjKf1bIBASt4OopMesGCn/CnMdFbvr9kxspPUUHa0SdLSOzDPAoEl9ppdJsTLCLiE 1BMUFD9N+zDi/iVzpAqP5QANhNNxxruzbquAbOZrfYiAHsqcEIyHQ12994AYd5EdOCz3 meTA== 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:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :dkim-signature; bh=84FYeu+Y/BZJ25AptG7IThNwoOt4gkPs9yl7t+IFJuc=; b=B9CXIZ/JarQLYZidpn8F6N2Tn2xfsn4sdnsEHSplpt82nCHHS5aTndSY2/qJQHdMKi J4z+KK35OkfveuU4j7ynX8LtB0nf865v6u4FnicOo8nHxtdyJG/fWGxjYSxHryoxTDnJ OP4Vhn3BL6UBBIm9QVPeJq3GZbt1IfO1DR2kDt9oQyEtczhOOSowmI6mGTrgwOXt/MsO atkxt5N8Z2+OMz120NqvSNDajNlbIxuIG6/wSa7EjczoZgynIs/nXppmheO34V9QkIFq W21+pr9TDTOUG8CQTjRkRXu1ruS+GgA+vsNFBtkTBMzN6vlCqBJ75bhC4n3bKSrUw50k gBsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ilRGt2zT; 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 oz14si6429416ejb.51.2020.05.04.02.15.47; Mon, 04 May 2020 02:16:11 -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=ilRGt2zT; 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 S1728317AbgEDJNz (ORCPT + 99 others); Mon, 4 May 2020 05:13:55 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:39660 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727801AbgEDJNz (ORCPT ); Mon, 4 May 2020 05:13:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588583633; 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=84FYeu+Y/BZJ25AptG7IThNwoOt4gkPs9yl7t+IFJuc=; b=ilRGt2zTaLdrqY09+IEfCBEl+ylffendz5gXMaTApB1MrNhdYcR2vUc5/gKhW+Ju9N4EJJ gkz1gT5UVcSEqODPqz5T9hCIWAAhj2MBvl2+18M9n6pEWzVv+KQr90Bo4kbPRCW+4BBrUF tWFUnCnC87ru/j8gRcyVvcoQI71sPYg= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-221-ahw7Sc6jNv2Od3h0BoWisA-1; Mon, 04 May 2020 05:13:51 -0400 X-MC-Unique: ahw7Sc6jNv2Od3h0BoWisA-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 508138014C0; Mon, 4 May 2020 09:13:50 +0000 (UTC) Received: from maximlenovopc.usersys.redhat.com (unknown [10.35.206.43]) by smtp.corp.redhat.com (Postfix) with ESMTP id 14766100239A; Mon, 4 May 2020 09:13:48 +0000 (UTC) Message-ID: <159382e7fdf0f9b50d79e29554842289e92e1ed7.camel@redhat.com> Subject: Re: AVIC related warning in enable_irq_window From: Maxim Levitsky To: Suravee Suthikulpanit , Paolo Bonzini , kvm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Date: Mon, 04 May 2020 12:13:47 +0300 In-Reply-To: References: <9ce7bb5c4fb8bcc4ac21103f7534a6edfcbe195d.camel@redhat.com> <758b27a8-74c0-087d-d90b-d95faee2f561@redhat.com> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2020-05-04 at 15:46 +0700, Suravee Suthikulpanit wrote: > Paolo / Maxim, > > On 5/2/20 11:42 PM, Paolo Bonzini wrote: > > On 02/05/20 15:58, Maxim Levitsky wrote: > > > The AVIC is disabled by svm_toggle_avic_for_irq_window, which calls > > > kvm_request_apicv_update, which broadcasts the KVM_REQ_APICV_UPDATE vcpu request, > > > however it doesn't broadcast it to CPU on which now we are running, which seems OK, > > > because the code that handles that broadcast runs on each VCPU entry, thus > > > when this CPU will enter guest mode it will notice and disable the AVIC. > > > > > > However later in svm_enable_vintr, there is test 'WARN_ON(kvm_vcpu_apicv_active(&svm->vcpu));' > > > which is still true on current CPU because of the above. > > > > Good point! We can just remove the WARN_ON I think. Can you send a patch? > > Instead, as an alternative to remove the WARN_ON(), would it be better to just explicitly > calling kvm_vcpu_update_apicv(vcpu) to update the apicv_active flag right after > kvm_request_apicv_update()? > > Thanks, > Suravee > This should work IMHO, other that the fact kvm_vcpu_update_apicv will be called again, when this vcpu is entered since the KVM_REQ_APICV_UPDATE will still be pending on it. It shoudn't be a problem, and we can even add a check to do nothing when it is called while avic is already in target enable state. Best regards, Maxim Levitsky