From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [PART1 V5 13/13] svm: Manage vcpu load/unload when enable AVIC Date: Wed, 1 Jun 2016 20:37:34 +0200 Message-ID: References: <1462388992-25242-1-git-send-email-Suravee.Suthikulpanit@amd.com> <1462388992-25242-14-git-send-email-Suravee.Suthikulpanit@amd.com> <573201AB.2050006@redhat.com> <573B0A08.7040604@redhat.com> <574F26E2.8020803@amd.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, wei@redhat.com, sherry.hurwitz@amd.com To: Suravee Suthikulpanit , rkrcmar@redhat.com, joro@8bytes.org, bp@alien8.de, gleb@kernel.org, alex.williamson@redhat.com Return-path: Received: from mail-wm0-f51.google.com ([74.125.82.51]:36385 "EHLO mail-wm0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750740AbcFASiL (ORCPT ); Wed, 1 Jun 2016 14:38:11 -0400 In-Reply-To: <574F26E2.8020803@amd.com> Sender: kvm-owner@vger.kernel.org List-ID: On 01/06/2016 20:18, Suravee Suthikulpanit wrote: >>> >>> + svm->avic_is_running = is_run; > > Shouldn't we do this below ---> >>> >>> /* ID = 0xff (broadcast), ID > 0xff (reserved) */ >>> - if (h_physical_id >= AVIC_MAX_PHYSICAL_ID_COUNT) >>> - return -EINVAL; >>> + if (WARN_ON(h_physical_id >= AVIC_MAX_PHYSICAL_ID_COUNT)) >>> + return; > > <--- HERE It doesn't really matter because these physical APIC IDs are not reachable anyway so they don't have the IS_RUNNING field. The avic_is_running field is only used in avic_vcpu_load, and again only when h_physical_id is in range. I left the assignment before the warning so that avic_vcpu_load does the right thing after a (hypothetical) migration from an out-of-range physical CPU to an in-range physical CPU. Paolo