From nobody Fri May 3 23:02:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=nvidia.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1625214677510251.35880376547652; Fri, 2 Jul 2021 01:31:17 -0700 (PDT) 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-512-HOer-byrP76cCxrOBkXURA-1; Fri, 02 Jul 2021 04:31:14 -0400 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 85CFA9126F; Fri, 2 Jul 2021 08:31:09 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BA74960864; Fri, 2 Jul 2021 08:31:08 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 9C47B1809C99; Fri, 2 Jul 2021 08:31:06 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1627NlvI001254 for ; Fri, 2 Jul 2021 03:23:48 -0400 Received: by smtp.corp.redhat.com (Postfix) id C9212102F136; Fri, 2 Jul 2021 07:23:47 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C3C56110DBAB for ; Fri, 2 Jul 2021 07:23:44 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0B4F419711BE for ; Fri, 2 Jul 2021 07:23:44 +0000 (UTC) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2058.outbound.protection.outlook.com [40.107.236.58]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-566-IkeTqxlwMxaUVeBmg5CfdA-1; Fri, 02 Jul 2021 03:23:42 -0400 Received: from MW3PR06CA0030.namprd06.prod.outlook.com (2603:10b6:303:2a::35) by MWHPR12MB1280.namprd12.prod.outlook.com (2603:10b6:300:12::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4287.24; Fri, 2 Jul 2021 07:23:40 +0000 Received: from CO1NAM11FT068.eop-nam11.prod.protection.outlook.com (2603:10b6:303:2a:cafe::72) by MW3PR06CA0030.outlook.office365.com (2603:10b6:303:2a::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4287.22 via Frontend Transport; Fri, 2 Jul 2021 07:23:40 +0000 Received: from mail.nvidia.com (216.228.112.32) by CO1NAM11FT068.mail.protection.outlook.com (10.13.175.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4287.22 via Frontend Transport; Fri, 2 Jul 2021 07:23:40 +0000 Received: from HQMAIL109.nvidia.com (172.20.187.15) by HQMAIL109.nvidia.com (172.20.187.15) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 2 Jul 2021 00:23:39 -0700 Received: from vinayak-dev.nvidia.com (172.20.187.6) by mail.nvidia.com (172.20.187.15) with Microsoft SMTP Server (TLS) id 15.0.1497.2 via Frontend Transport; Fri, 2 Jul 2021 00:23:38 -0700 X-MC-Unique: HOer-byrP76cCxrOBkXURA-1 X-MC-Unique: IkeTqxlwMxaUVeBmg5CfdA-1 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.32) smtp.mailfrom=nvidia.com; redhat.com; dkim=none (message not signed) header.d=none; redhat.com; dmarc=pass action=none header.from=nvidia.com From: Vinayak Kale To: Subject: [PATCH] virresctrl: Fix updating the mask for a cache resource Date: Fri, 2 Jul 2021 12:53:15 +0530 Message-ID: <20210702072315.4147-1-vkale@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: be75b0d0-1568-432a-9427-08d93d2a50c4 X-MS-TrafficTypeDiagnostic: MWHPR12MB1280: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6790 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0 X-Microsoft-Antispam-Message-Info: +9unECBynQC3aVgRLfuzYZLGvO37r+12KMNJR15FgwnyoepgBHTnZAE2PQrO8gF4xWPCyBq0iLc86J/Y6spgJidtIkN/etAipV3hpH+A3O8iIS7KHMgVaOzl3xCOaXDSnfdwFEw3GtbmVBCanplYZTcwSe2oG0SwRpW6oH5f2ZZjDGFpAbZjJ6oJjLBvzL5oB0QY/FA3cyfhK6w9tHT5r2ohVLvyhg8W4aql5ZshGRq63IBW6W40bYwrXkrsAlnAIxvj7O0QBQigDrMbdjMEvWcvJ8q1cfPlYAW80zfTAPo//3/yp/tu1rdmqU+Oed2Cl6N9lBArECkcV+MIG51UtVbLwKIszPA917ZHIYG82/mG1ntvQZ9G49+r3MrXuFbE8aMfnc8UXyPKv00VnmUZPOZyrT3Y5IVyU/rxxvoxlNrLPtoBjufSqcQGj9BD3zZIpQ9+fMF8aipz2VYbEpuWM7E4gt6vNJ/rV8ZveH5Ly563XW844nuC4e1qzWvE/LDr0d5v4XKuJJ24gtFe6wpHUcS9yBNWexz3x/3n05mfeBvnD+YKcnT7/vLf9u0tZGwuN7OD7kincVTCqAOgs30WrvQyTVcvSeCldXIuXafSp345GtUZFH5Gjbs2oQsXy+gAn4wyw/Ao9ukxK1/7YzqMB9pGqH0gmoBXvYBM1HZwBWHwuj80UO8q8c1xqhUUCJFwjUoPIsFX8l+o4aKZaKkAKA== X-Forefront-Antispam-Report: CIP:216.228.112.32; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid01.nvidia.com; CAT:NONE; SFS:(4636009)(396003)(346002)(39860400002)(376002)(136003)(36840700001)(46966006)(316002)(478600001)(7636003)(426003)(36756003)(8676002)(83380400001)(86362001)(336012)(6916009)(356005)(8936002)(36860700001)(70586007)(82740400003)(2616005)(70206006)(186003)(7696005)(2906002)(6666004)(107886003)(47076005)(1076003)(5660300002)(26005)(82310400003)(4326008); DIR:OUT; SFP:1101 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Jul 2021 07:23:40.1577 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: be75b0d0-1568-432a-9427-08d93d2a50c4 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.32]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT068.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1280 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com X-Mailman-Approved-At: Fri, 02 Jul 2021 04:31:05 -0400 Cc: Vinayak Kale X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-ZM-MESSAGEID: 1625214678840100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" In 'virResctrlAllocUpdateMask', mask is updated only if 'previous mask' is = NULL. By default, the bitmask for a cache resource for a VM is initialized with 'default-resctrl-group' bitmask. So the 'previous mask' would not be NULL a= nd mask won't get updated if cachetune is configured for a VM. This causes lib= virt to use same bitmask as 'default-resctrl-group' bitmask for a cache resource= for a VM. This patch fixes the issue. Fixes: d8a354954aba9cd45ab0317915a0a2be27c04767 Signed-off-by: Vinayak Kale Reviewed-by: Daniel Henrique Barboza Reviewed-by: J=C3=A1n Tomko --- src/util/virresctrl.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c index 35e92022db..a7d36f492c 100644 --- a/src/util/virresctrl.c +++ b/src/util/virresctrl.c @@ -1104,8 +1104,10 @@ virResctrlAllocUpdateMask(virResctrlAlloc *alloc, VIR_EXPAND_N(a_type->masks, a_type->nmasks, cache - a_type->nmasks + 1); =20 - if (!a_type->masks[cache]) - a_type->masks[cache] =3D virBitmapNewCopy(mask); + if (a_type->masks[cache]) + virBitmapFree(a_type->masks[cache]); + + a_type->masks[cache] =3D virBitmapNewCopy(mask); =20 return 0; } --=20 2.17.1