From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.7 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4FD9CC3A5A3 for ; Tue, 27 Aug 2019 13:13:14 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1F8152077B for ; Tue, 27 Aug 2019 13:13:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1F8152077B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:51378 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i2bHd-0000lJ-3D for qemu-devel@archiver.kernel.org; Tue, 27 Aug 2019 09:13:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57018) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i2bGf-0008Lz-IG for qemu-devel@nongnu.org; Tue, 27 Aug 2019 09:12:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i2bGc-00034D-Pt for qemu-devel@nongnu.org; Tue, 27 Aug 2019 09:12:12 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60378) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i2bGc-00033x-I9 for qemu-devel@nongnu.org; Tue, 27 Aug 2019 09:12:10 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B705630832C0; Tue, 27 Aug 2019 13:12:09 +0000 (UTC) Received: from localhost (unknown [10.43.2.182]) by smtp.corp.redhat.com (Postfix) with ESMTP id E7C095D713; Tue, 27 Aug 2019 13:12:07 +0000 (UTC) Date: Tue, 27 Aug 2019 15:12:06 +0200 From: Igor Mammedov To: Tao Xu Message-ID: <20190827151206.7b2ddce5@redhat.com> In-Reply-To: References: <20190809065731.9097-1-tao3.xu@intel.com> <20190809065731.9097-6-tao3.xu@intel.com> <20190813170027.0617b129@redhat.com> <789df028-9dd9-884a-2493-aecc9a646e63@intel.com> <20190816165758.47042712@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Tue, 27 Aug 2019 13:12:09 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: Re: [Qemu-devel] [PATCH v9 05/11] numa: Extend CLI to provide initiator information for numa nodes X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eduardo Habkost , "Liu, Jingqi" , "Du, Fan" , Qemu Developers , "daniel@linux.ibm.com" , Jonathan Cameron , Dan Williams Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On Tue, 20 Aug 2019 16:34:44 +0800 Tao Xu wrote: > On 8/16/2019 10:57 PM, Igor Mammedov wrote: > > On Wed, 14 Aug 2019 19:31:27 -0700 > > Dan Williams wrote: > > > >> On Wed, Aug 14, 2019 at 6:57 PM Tao Xu wrote: > >>> > >>> On 8/15/2019 5:29 AM, Dan Williams wrote: > >>>> On Tue, Aug 13, 2019 at 10:14 PM Tao Xu wrote: > >>>>> > >>>>> On 8/14/2019 10:39 AM, Dan Williams wrote: > >>>>>> On Tue, Aug 13, 2019 at 8:00 AM Igor Mammedov wrote: > >>>>>>> > >>>>>>> On Fri, 9 Aug 2019 14:57:25 +0800 > >>>>>>> Tao wrote: > >>>>>>> > >>>>>>>> From: Tao Xu > >>>>>>>> > >>> [...] > >>>>>>>> + for (i = 0; i < machine->numa_state->num_nodes; i++) { > >>>>>>>> + if (numa_info[i].initiator_valid && > >>>>>>>> + !numa_info[numa_info[i].initiator].has_cpu) { > >>>>>>> ^^^^^^^^^^^^^^^^^^^^^^ possible out of bounds read, see bellow > >>>>>>> > >>>>>>>> + error_report("The initiator-id %"PRIu16 " of NUMA node %d" > >>>>>>>> + " does not exist.", numa_info[i].initiator, i); > >>>>>>>> + error_printf("\n"); > >>>>>>>> + > >>>>>>>> + exit(1); > >>>>>>>> + } > >>>>>>> it takes care only about nodes that have cpus or memory-only ones that have > >>>>>>> initiator explicitly provided on CLI. And leaves possibility to have > >>>>>>> memory-only nodes without initiator mixed with nodes that have initiator. > >>>>>>> Is it valid to have mixed configuration? > >>>>>>> Should we forbid it? > >>>>>> > >>>>>> The spec talks about the "Proximity Domain for the Attached Initiator" > >>>>>> field only being valid if the memory controller for the memory can be > >>>>>> identified by an initiator id in the SRAT. So I expect the only way to > >>>>>> define a memory proximity domain without this local initiator is to > >>>>>> allow specifying a node-id that does not have an entry in the SRAT. > >>>>>> > >>>>> Hi Dan, > >>>>> > >>>>> So there may be a situation for the Attached Initiator field is not > >>>>> valid? If true, I would allow user to input Initiator invalid. > >>>> > >>>> Yes it's something the OS needs to consider because the platform may > >>>> not be able to meet the constraint that a single initiator is > >>>> associated with the memory controller for a given memory target. In > >>>> retrospect it would have been nice if the spec reserved 0xffffffff for > >>>> this purpose, but it seems "not in SRAT" is the only way to identify > >>>> memory that is not attached to any single initiator. > >>>> > >>> But As far as I konw, QEMU can't emulate a NUMA node "not in SRAT". I am > >>> wondering if it is effective only set Initiator invalid? > >> > >> You don't need to emulate a NUMA node not in SRAT. Just put a number > >> in this HMAT entry larger than the largest proximity domain number > >> found in the SRAT. > >>> > >> > > > > So behavior is really not defined in the spec > > (well I wasn't able to convince myself that above behavior is in the spec). > > > > In this case I'd go with a strict check for now not allowing invalid initiator > > (we can easily relax check and allow it point to nonsense later but no other way around) > > > > So let me summarize the solution, in order to avoid misunderstanding, if > there are something wrong, pls tell me: > > 1) > -machine,hmat=yes > -object memory-backend-ram,size=1G,id=m0 \ > -object memory-backend-ram,size=1G,id=m1 \ > -object memory-backend-ram,size=1G,id=m2 \ > -numa node,nodeid=0,memdev=m0 \ > -numa node,nodeid=1,memdev=m1,initiator=0 \ > -numa node,nodeid=2,memdev=m2,initiator=0 \ > -numa cpu,node-id=0,socket-id=0 \ > -numa cpu,node-id=0,socket-id=1 > > then qemu can use HMAT. > > 2) > if initiator this case: > > -numa node,nodeid=0,memdev=m0 \ > -numa node,nodeid=1,memdev=m1,initiator=0 \ > -numa node,nodeid=2,memdev=m2 > > then qemu can't boot and show error message. > > 3) > if initiator this case: > > -numa node,nodeid=0,memdev=m0 \ > -numa node,nodeid=1,memdev=m1,initiator=0 \ > -numa node,nodeid=2,memdev=m2,initiator=1 > > then qemu can boot and the initiator of nodeid=2 is invalid. In this last case I'd error out instead of booting with invalid config.