From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.groups.io with SMTP id smtpd.web10.1257.1612380030574611894 for ; Wed, 03 Feb 2021 11:20:32 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=d6WoVRjo; spf=pass (domain: redhat.com, ip: 63.128.21.124, mailfrom: lersek@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612380029; 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=qb+6TVlku9j92wnkfKay8X5GoaoGT+bDDG1joT5Jm/4=; b=d6WoVRjoOpXeeQmCCl53QPD0OQdV8GmbnlauFVlyzYnIcfPgAeR2b/eUvDNbHnXJ5ztAGF KX/a71OwIWBEH2EIrvhRA0Qwj8Jb6taC0ECC8KPcOAffqim0RqbfE8OYfC5Bw2yUtnHoi4 TvkVLeU/vJb8OF8SJEOI5Bz6tN4+QU8= 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-410-SIeEnqviMsejULr4-PeBKg-1; Wed, 03 Feb 2021 14:20:25 -0500 X-MC-Unique: SIeEnqviMsejULr4-PeBKg-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 07E5FCE647; Wed, 3 Feb 2021 19:20:24 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-113-32.ams2.redhat.com [10.36.113.32]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3433A6091B; Wed, 3 Feb 2021 19:20:21 +0000 (UTC) Subject: Re: [PATCH v6 4/9] OvmfPkg/CpuHotplugSmm: introduce UnplugCpus() To: Ankur Arora , devel@edk2.groups.io Cc: imammedo@redhat.com, boris.ostrovsky@oracle.com, Jordan Justen , Ard Biesheuvel , Aaron Young References: <20210129005950.467638-1-ankur.a.arora@oracle.com> <20210129005950.467638-5-ankur.a.arora@oracle.com> <06503fdc-a609-455d-2269-38491e8a9408@redhat.com> <9d08c280-6092-41a2-4448-8a51a669c672@oracle.com> From: "Laszlo Ersek" Message-ID: <9bd3eab8-87bb-6290-0496-4a98fa9e84f7@redhat.com> Date: Wed, 3 Feb 2021 20:20:21 +0100 MIME-Version: 1.0 In-Reply-To: <9d08c280-6092-41a2-4448-8a51a669c672@oracle.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=lersek@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit On 02/03/21 05:28, Ankur Arora wrote: > On 2021-01-31 7:13 p.m., Laszlo Ersek wrote: >> On 01/29/21 01:59, Ankur Arora wrote: >>> +**/ >>> +STATIC >>> +EFI_STATUS >>> +UnplugCpus ( >>> +  IN APIC_ID                      *ToUnplugApicIds, >>> +  IN UINT32                       ToUnplugCount >>> +  ) >>> +{ >>> +  EFI_STATUS Status; >>> +  UINT32     ToUnplugIdx; >>> +  UINTN      ProcessorNum; >>> + >>> +  ToUnplugIdx = 0; >>> +  while (ToUnplugIdx < ToUnplugCount) { >>> +    APIC_ID    RemoveApicId; >>> + >>> +    RemoveApicId = ToUnplugApicIds[ToUnplugIdx]; >>> + >>> +    // >>> +    // mCpuHotPlugData->ApicId maps ProcessorNum -> ApicId. Use it >>> to find >>> +    // the ProcessorNum for the APIC ID to be removed. >>> +    // >>> +    for (ProcessorNum = 0; >>> +         ProcessorNum < mCpuHotPlugData->ArrayLength; >>> +         ProcessorNum++) { >>> +      if (mCpuHotPlugData->ApicId[ProcessorNum] == RemoveApicId) { >>> +        break; >>> +      } >>> +    } >>> + >>> +    // >>> +    // Ignore the unplug if APIC ID not found >>> +    // >>> +    if (ProcessorNum == mCpuHotPlugData->ArrayLength) { >>> +      DEBUG ((DEBUG_INFO, "%a: did not find APIC ID " FMT_APIC_ID >>> +          " to unplug\n", __FUNCTION__, RemoveApicId)); >> >> (2) Please use DEBUG_VERBOSE here. >> >> (I agree that we should have *one* DEBUG_INFO message that relates to >> the removal of an individual processor; however, I think we should emit >> that message when we finally signal QEMU to eject the processor.) > > Based on our discussion around establishing the correspondence between > The ProcessorNum, APIC-ID and CPU selector, I'll change this to > DEBUG_VERBOSE and add a new DEBUG_INFO print after successfully > putting it in the APICIdMap. Thanks! [...] Laszlo