X-Received: by 2002:a17:90a:69c1:b0:1bc:3e97:e585 with SMTP id s59-20020a17090a69c100b001bc3e97e585mr15393575pjj.89.1645721862876; Thu, 24 Feb 2022 08:57:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645721862; cv=none; d=google.com; s=arc-20160816; b=hHS9Hz4+d1K26SRTncpNtL9x60EsZCJI+XGzk6g6RdqxAS5Cz7ryx09UZDKA1s2zEs lbOLj3z5q2UonH81CDGi6p9rcC+JmGVbO1Gcuk1+9mSToY1hJ4QUynXJPME5Nzbu9U0F /8Mjt8wXm4dnHnuG4er3ayg+1WeoRhBAFzfGUFsQ0yiSlJ/CnV6geXNLPLonowmu6rg1 SPT+7gMN4mJ+OqDXOqu4gUq1Rm3TcllMb9klZjURIQWedqKTNFgKi3XKQNPdnujqy2W9 e5OSM8OdYF3LUR2rX2LxVNoTulWZmTTHJtSwfFvZZcYVlho+hzFOHaSeNagglBv1FLN3 rk4g== 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=prgZNdV4s/mPu6PlnmJr/hT5U+BTnmvKi0C0dZguK/8=; b=LepRq1HHG42nMxm7Ksme7sfildHDvBN4JG4f/2Km9IhfB1jjzpIhn4NG00idykhFML UsghL4/05IX33sPxy+6uoKMWNH7mEnAUzSPWT2JK7excvbiOKjV9ojQgzwvNpEnJujq+ DPAUVo8EOP4DtYraxFnG3iWojyaq6K/AUlgxWLrWt9+w44VERXBsJp1Qkk6fJgquqbtM rKX7sKp3qeqrALzxgZe3BDsgMIK2WP2UJB7LrF3fg10gVhSRuduMtuPDAGcXL8fZW4vg 3ka0dc9+wxlsxUmqagOv2QJ20wbowyJW3anfGQwK/svlHH8GjsR+pb84gMo1aGcKTtTu 5avQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=YLpBltOE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id t188si2907099pgc.856.2022.02.24.08.57.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Feb 2022 08:57:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=YLpBltOE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0C5271D9B72; Thu, 24 Feb 2022 08:32:06 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229803AbiBXQbW (ORCPT + 99 others); Thu, 24 Feb 2022 11:31:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229674AbiBXQbU (ORCPT ); Thu, 24 Feb 2022 11:31:20 -0500 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 2639E28D386 for ; Thu, 24 Feb 2022 08:30:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1645720239; 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=prgZNdV4s/mPu6PlnmJr/hT5U+BTnmvKi0C0dZguK/8=; b=YLpBltOEnyXqzsjhQWnvDLFHAZVZaNF0IKHtePrFeGGHaDvauxVsLCI1QMMAgv8yOXqD7h zqYfPUjLdQug/8AGhxq8sS0GKO2lxbvexoMBlcCpdyB7SQcgvOmB0MP5h0kW+AgjEWXUNk vji3xGhj3FnxOibYTy85O6xxD+h63Eo= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-215-wNvCV_4TOIWtOCStLWJrxA-1; Thu, 24 Feb 2022 11:30:36 -0500 X-MC-Unique: wNvCV_4TOIWtOCStLWJrxA-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 AEE551854E21; Thu, 24 Feb 2022 16:30:34 +0000 (UTC) Received: from starship (unknown [10.40.195.190]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0B5AF10016F2; Thu, 24 Feb 2022 16:30:31 +0000 (UTC) Message-ID: Subject: Re: [RFC PATCH 01/13] KVM: SVM: Add warning when encounter invalid APIC ID From: Maxim Levitsky To: Suravee Suthikulpanit , linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: pbonzini@redhat.com, seanjc@google.com, joro@8bytes.org, jon.grimm@amd.com, wei.huang2@amd.com, terry.bowman@amd.com Date: Thu, 24 Feb 2022 18:30:30 +0200 In-Reply-To: <20220221021922.733373-2-suravee.suthikulpanit@amd.com> References: <20220221021922.733373-1-suravee.suthikulpanit@amd.com> <20220221021922.733373-2-suravee.suthikulpanit@amd.com> 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.84 on 10.5.11.22 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Sun, 2022-02-20 at 20:19 -0600, Suravee Suthikulpanit wrote: > Current logic checks if avic_get_physical_id_entry() fails to > get the entry, and return error. This could silently cause > AVIC to fail to operate. Therefore, add WARN_ON to help > report this error. > > Signed-off-by: Suravee Suthikulpanit > --- > arch/x86/kvm/svm/avic.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/arch/x86/kvm/svm/avic.c b/arch/x86/kvm/svm/avic.c > index f07956f15d3b..472445aaaf42 100644 > --- a/arch/x86/kvm/svm/avic.c > +++ b/arch/x86/kvm/svm/avic.c > @@ -447,8 +447,10 @@ static int avic_handle_apic_id_update(struct kvm_vcpu *vcpu) > > old = avic_get_physical_id_entry(vcpu, vcpu->vcpu_id); > new = avic_get_physical_id_entry(vcpu, id); > - if (!new || !old) > + if (!new || !old) { > + WARN_ON(1); > return 1; > + } > > /* We need to move physical_id_entry to new offset */ > *new = *old; I about to purge all of this code, and disallow setting the apicid regardles if x2apic, or plain xapic was used at least when AVIC is enabled. I really hope for this to be accepted, so we won't need to fix this code. Best regards, Maxim Levitsky