From nobody Fri May 17 05:54:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1598004371; cv=none; d=zohomail.com; s=zohoarc; b=SX9JlNMWJaMQ7ZAwHJiMUy/D6YlPoK7jADG/pwv77rk4IGt3eT94/YQAh/F02PT9SxDL36RneYJ9BPkB3K9zA40Z7B0xD96ShPR4D/e330H1JzcCIt7QRBombMCqHQuiS9shiTN5KxvtgLK67k4MFTyvP+RFLqzEtihc+9Jx54w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1598004371; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=Fhb5To+Ttj21y3yRy/23iibfl/9NI9yBxf4rvHBGA68=; b=UqJmQQziUIGIZq4doVdgTUvjpcY6XLrJs64s9ohElaDD0EUZiuqyUthftoW0ara187VZp0vs8SvLcu9ez2qS8pk0h+xkpTPa/B456bvTneSZLxzHc6/JjJ8IigL+xSjwZGXM6NPkHP2NCSyl8xewoHOogoRjECWGgZJDARB0Vac= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1598004371817958.8660715697799; Fri, 21 Aug 2020 03:06:11 -0700 (PDT) Received: from localhost ([::1]:43352 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k93w2-0007Kn-Ly for importer@patchew.org; Fri, 21 Aug 2020 06:06:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55348) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k93vM-0006av-3L for qemu-devel@nongnu.org; Fri, 21 Aug 2020 06:05:28 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:33040) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1k93vK-0007eW-Cw for qemu-devel@nongnu.org; Fri, 21 Aug 2020 06:05:27 -0400 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-575-Xyv00I7yN2KaAXsLprzQlQ-1; Fri, 21 Aug 2020 06:05:23 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E446F81F03C; Fri, 21 Aug 2020 10:05:22 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id BD6335DA74; Fri, 21 Aug 2020 10:05:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1598004325; 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; bh=Fhb5To+Ttj21y3yRy/23iibfl/9NI9yBxf4rvHBGA68=; b=hI9BTjeuBAEKAsCoyb5aSETo43IpTHZzewNc1O2KmqiyCYDJqA/sKY9vUCM5/jjABRoiFJ hQZig/DAendpeBu/+7DkiaFszy0CzgMBj2h2PSYIlV0ua8Btpx+OOduzLgfZMVVjY5J91b uwfyZMLgHBfZHzOuJNAbGNOYGlktcPo= X-MC-Unique: Xyv00I7yN2KaAXsLprzQlQ-1 From: Igor Mammedov To: qemu-devel@nongnu.org Subject: [PATCH] numa: hmat: fix cache size check Date: Fri, 21 Aug 2020 06:05:19 -0400 Message-Id: <20200821100519.1325691-1-imammedo@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=imammedo@redhat.com X-Mimecast-Spam-Score: 0.001 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=imammedo@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/21 04:26:32 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -40 X-Spam_score: -4.1 X-Spam_bar: ---- X-Spam_report: (-4.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=-1, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: mprivozn@redhat.com, ehabkost@redhat.com, jingqi.liu@intel.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" when QEMU is started like: qemu-system-x86_64 -smp 2 -machine hmat=3Don \ -m 2G \ -object memory-backend-ram,size=3D1G,id=3Dm0 \ -object memory-backend-ram,size=3D1G,id=3Dm1 \ -numa node,nodeid=3D0,memdev=3Dm0 \ -numa node,nodeid=3D1,memdev=3Dm1,initiator=3D0 \ -numa cpu,node-id=3D0,socket-id=3D0 \ -numa cpu,node-id=3D0,socket-id=3D1 \ -numa hmat-lb,initiator=3D0,target=3D0,hierarchy=3Dmemory,data-type=3Dacce= ss-latency,latency=3D5 \ -numa hmat-lb,initiator=3D0,target=3D0,hierarchy=3Dmemory,data-type=3Dacce= ss-bandwidth,bandwidth=3D200M \ -numa hmat-lb,initiator=3D0,target=3D1,hierarchy=3Dmemory,data-type=3Dacce= ss-latency,latency=3D10 \ -numa hmat-lb,initiator=3D0,target=3D1,hierarchy=3Dmemory,data-type=3Dacce= ss-bandwidth,bandwidth=3D100M \ -numa hmat-cache,node-id=3D0,size=3D8K,level=3D1,associativity=3Ddirect,po= licy=3Dwrite-back,line=3D5 \ -numa hmat-cache,node-id=3D0,size=3D16K,level=3D2,associativity=3Ddirect,p= olicy=3Dwrite-back,line=3D5 it errors out with: -numa hmat-cache,node-id=3D0,size=3D16K,level=3D2,associativity=3Ddirect,p= olicy=3Dwrite-back,line=3D5: Invalid size=3D16384, the size of level=3D2 should be less than the= size(8192) of level=3D1 which doesn't look right as one would expect that L1 < L2 < L3 ... Fix it by sawpping relevant size checks. Fixes: c412a48d4d91 (numa: Extend CLI to provide memory side cache informat= ion) Signed-off-by: Igor Mammedov Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- CC: jingqi.liu@intel.com hw/core/numa.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/core/numa.c b/hw/core/numa.c index d1a94a14f8..f9593ec716 100644 --- a/hw/core/numa.c +++ b/hw/core/numa.c @@ -425,10 +425,10 @@ void parse_numa_hmat_cache(MachineState *ms, NumaHmat= CacheOptions *node, =20 if ((node->level > 1) && ms->numa_state->hmat_cache[node->node_id][node->level - 1] && - (node->size >=3D + (node->size <=3D ms->numa_state->hmat_cache[node->node_id][node->level - 1]->si= ze)) { error_setg(errp, "Invalid size=3D%" PRIu64 ", the size of level=3D= %" PRIu8 - " should be less than the size(%" PRIu64 ") of " + " should be larger than the size(%" PRIu64 ") of " "level=3D%u", node->size, node->level, ms->numa_state->hmat_cache[node->node_id] [node->level - 1]->size, @@ -438,10 +438,10 @@ void parse_numa_hmat_cache(MachineState *ms, NumaHmat= CacheOptions *node, =20 if ((node->level < HMAT_LB_LEVELS - 1) && ms->numa_state->hmat_cache[node->node_id][node->level + 1] && - (node->size <=3D + (node->size >=3D ms->numa_state->hmat_cache[node->node_id][node->level + 1]->si= ze)) { error_setg(errp, "Invalid size=3D%" PRIu64 ", the size of level=3D= %" PRIu8 - " should be larger than the size(%" PRIu64 ") of " + " should be less than the size(%" PRIu64 ") of " "level=3D%u", node->size, node->level, ms->numa_state->hmat_cache[node->node_id] [node->level + 1]->size, --=20 2.26.2