From nobody Fri May 3 18:27:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.39 as permitted sender) client-ip=209.132.183.39; envelope-from=libvir-list-bounces@redhat.com; helo=mx6-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.39 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx6-phx2.redhat.com (mx6-phx2.redhat.com [209.132.183.39]) by mx.zohomail.com with SMTPS id 148710929049730.284183240716402; Tue, 14 Feb 2017 13:54:50 -0800 (PST) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx6-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1ELonVC011287; Tue, 14 Feb 2017 16:50:49 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v1ELmh9q009529 for ; Tue, 14 Feb 2017 16:48:43 -0500 Received: from mx1.redhat.com (ext-mx09.extmail.prod.ext.phx2.redhat.com [10.5.110.38]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1ELmhV9008774 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Tue, 14 Feb 2017 16:48:43 -0500 Received: from mail-qt0-f196.google.com (mail-qt0-f196.google.com [209.85.216.196]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0E6FB4E028 for ; Tue, 14 Feb 2017 21:48:42 +0000 (UTC) Received: by mail-qt0-f196.google.com with SMTP id w20so18911852qtb.1 for ; Tue, 14 Feb 2017 13:48:41 -0800 (PST) Received: from localhost.localdomain (cpe-74-66-249-236.nyc.res.rr.com. [74.66.249.236]) by smtp.gmail.com with ESMTPSA id k8sm1083989qke.29.2017.02.14.13.48.38 (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 14 Feb 2017 13:48:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=podolny-net.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=rDJz0eMgicmc4EiYVDsXB+nIN+vE67pq2AqxEMFonnc=; b=VZu9VL13Jp7tN1Rhyl0dDafA3ggWD4xQ/9tXrYGjz7vmkNU8dMSNZhDKUSHAvza4bl XOyn+HEyXT3LhwkDfTx+J1gb8Uuw3Eh076PoxLjP53x1dGpCKfuMWMrR+2qFwHY3ThTN X1jMEDNgKTWtmakpfcVJ0boy8BvPZPRjyqfTho8/La46k72trxHeY7C68S7zqHee02NO UWYyFB+E/eVAzFU21RVeK3+6UuhOA3bhMd8IxOEqhpU1OpZgXf2ggv+Y/Ssm87XaSDbD Ly49dFe164X4fqR5qtRAv09xt2ViNJGb4y5MQIxaJM3U5QfeQG68L47QxPwya+4PShDe Ysww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=rDJz0eMgicmc4EiYVDsXB+nIN+vE67pq2AqxEMFonnc=; b=BEYeqI7Eekd7fq58BFY8zRfvvlF34jzrGhYS9vrPtA5i/uT1MQP8RxScNxGk2lkLye WBkkiBjyNRP5PEZI5Ahc32p74crGMMHOsJgNxmQsJ+unKNZvBo/ug05ysxPYMVjneBwY w1aO8r7qCCvlwuGBSgLWh7PGb4LXb5SLas3mQe+wD4kepRbeFvSIz7GmbHpmanv2cABZ C1diUDPUTjuja/plJFv6FAG9bcHDUaa9D4Fs6gZ7qI0V6f/gGyERd4NOxo/9BowyIy2L ASOi4mDMNsuLEdlD4TQPPYY7qdxEM9uSlv2uCP+uGiQx0jHiNsRP1qVJIuXnW8pDKRP8 hG7w== X-Gm-Message-State: AMke39k9IviY0iEOnuNJjwpeLr+j9GoVO/56qre1z8MrnTpR+4OqGg0ojOa0EAhoS7T3mQ== X-Received: by 10.200.47.129 with SMTP id l1mr28618633qta.148.1487108919751; Tue, 14 Feb 2017 13:48:39 -0800 (PST) From: Leonid Podolny To: libvir-list@redhat.com Date: Tue, 14 Feb 2017 16:48:19 -0500 Message-Id: <20170214214819.21983-1-leonid@podolny.net> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 14 Feb 2017 21:48:42 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 14 Feb 2017 21:48:42 +0000 (UTC) for IP:'209.85.216.196' DOMAIN:'mail-qt0-f196.google.com' HELO:'mail-qt0-f196.google.com' FROM:'leonid@podolny.net' RCPT:'' X-RedHat-Spam-Score: 0.58 (BAYES_50, DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, RCVD_IN_SORBS_SPAM) 209.85.216.196 mail-qt0-f196.google.com 209.85.216.196 mail-qt0-f196.google.com X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Scanned-By: MIMEDefang 2.78 on 10.5.110.38 X-loop: libvir-list@redhat.com X-Mailman-Approved-At: Tue, 14 Feb 2017 16:50:48 -0500 Cc: Leonid Podolny Subject: [libvirt] [PATCH go] domain.go: construct cpumaps correctly for CPU pinning verbs 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" In PinVcpu(), PinVcpuFlags(), PinEmulator() and PinIOThread() there is an almost identical code that converts []bool into a bitmask. It calculates the location in the bitmask and then sets it always to 1, instead of looking at the actual bool value. --- domain.go | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/domain.go b/domain.go index 5482f1a..9a24bc5 100644 --- a/domain.go +++ b/domain.go @@ -1750,7 +1750,9 @@ func (d *Domain) PinVcpu(vcpu uint, cpuMap []bool) er= ror { if cpuMap[i] { byte :=3D i / 8 bit :=3D i % 8 - ccpumap[byte] |=3D (1 << uint(bit)) + if cpuMap[i] { + ccpumap[byte] |=3D (1 << uint(bit)) + } } } =20 @@ -1770,7 +1772,9 @@ func (d *Domain) PinVcpuFlags(vcpu uint, cpuMap []boo= l, flags DomainModification if cpuMap[i] { byte :=3D (i + 7) / 8 bit :=3D i % 8 - ccpumap[byte] |=3D (1 << uint(bit)) + if cpuMap[i] { + ccpumap[byte] |=3D (1 << uint(bit)) + } } } =20 @@ -3970,7 +3974,9 @@ func (d *Domain) PinEmulator(cpumap []bool, flags Dom= ainModificationImpact) erro byte :=3D i / 8 bit :=3D i % 8 =20 - ccpumaps[byte] |=3D (1 << uint(bit)) + if cpumap[i] { + ccpumaps[byte] |=3D (1 << uint(bit)) + } } =20 ret :=3D C.virDomainPinEmulator(d.ptr, &ccpumaps[0], C.int(maplen), C.uin= t(flags)) @@ -3992,7 +3998,9 @@ func (d *Domain) PinIOThread(iothreadid uint, cpumap = []bool, flags DomainModific byte :=3D i / 8 bit :=3D i % 8 =20 - ccpumaps[byte] |=3D (1 << uint(bit)) + if cpumap[i] { + ccpumaps[byte] |=3D (1 << uint(bit)) + } } =20 ret :=3D C.virDomainPinIOThreadCompat(d.ptr, C.uint(iothreadid), &ccpumap= s[0], C.int(maplen), C.uint(flags)) --=20 2.11.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list