From nobody Mon Apr 29 14:33:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.25 as permitted sender) client-ip=209.132.183.25; envelope-from=libvir-list-bounces@redhat.com; helo=mx4-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.25 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx4-phx2.redhat.com (mx4-phx2.redhat.com [209.132.183.25]) by mx.zohomail.com with SMTPS id 1487110513237825.0039834912195; Tue, 14 Feb 2017 14:15:13 -0800 (PST) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx4-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v1EMBVMJ004534; Tue, 14 Feb 2017 17:11:31 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v1EMBToc013440 for ; Tue, 14 Feb 2017 17:11:29 -0500 Received: from mx1.redhat.com (ext-mx10.extmail.prod.ext.phx2.redhat.com [10.5.110.39]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1EMBTtd019744 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Tue, 14 Feb 2017 17:11:29 -0500 Received: from mail-qk0-f193.google.com (mail-qk0-f193.google.com [209.85.220.193]) (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 21192624B9 for ; Tue, 14 Feb 2017 22:11:28 +0000 (UTC) Received: by mail-qk0-f193.google.com with SMTP id e1so21097754qkh.1 for ; Tue, 14 Feb 2017 14:11:27 -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 d20sm1121668qtb.17.2017.02.14.14.11.24 (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 14 Feb 2017 14:11:24 -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=x1qY9jsAQyxsShJUfvqBEwaxJRw7ywjQnQHerPGUicI=; b=DoEPwvyqCb8uTqlUMs4WjrtuMm1JUhQ7Tj1yRs7x5dZ0yeuczEc4Y9Q7sULHwe0OIv lwWjesX33B4YHrvUJyv+WOPGFY7rmXQCBvYqajY5wIh0UmXmajwD49P8WVa9H477Xxtj NXuzUdITkjF1nZuWca3JwfG9dYJisTCan6dZ5ENbsz32fKdxv4g5EHb+G1pzOfWm8Sep fXgCSOgTpFYNM55HUh6PIFZisSPzcT1StO9Y7YV6KTOt/wFGSY/6IV5/10NGpYS0NH5X Igen6Tx48XNw8VrYqFeids4BWo5UArkzwqOpO5VBqP9B1bX8+Dw4pheo7BiEWSOZVfw3 1u7Q== 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=x1qY9jsAQyxsShJUfvqBEwaxJRw7ywjQnQHerPGUicI=; b=D4ggYoOwGUkf99VJ9WaDZAv5llePnR4lKzG+UxftN06g7GicT66kkkTFzV8B/Mm0yM XwkcU8umjJ0ywMFvK9GpYap8OMniREmHXyw+YyLGbRP6k/1k1VNcth9pDAzkMuX7Q9CH zoFQWVpmXzTRYabKczP1QMEOXyPrDwn1YcYZUvikHOORcilQxju6s7fJrFTggNooXJWl 8IzLgAM5K0RssWudm6YqfqKcQxwAuR/U/w1oI2eo/Eld/SysHf9KSnZR6AKSdaZP+BpJ tS0IdUoTZxicTjuPJHoR1f+YgoRYeYdhXZhwywql8FRhnsW97ioyR5WB0XmvKWIDiEyZ GLZg== X-Gm-Message-State: AMke39lcQeea+pIrfMqTYR+IgcGdr+bocFHbOsXTq/ACyrGw97xcrCQCegp/MaNK2T0L5g== X-Received: by 10.55.22.74 with SMTP id g71mr14308694qkh.40.1487110285727; Tue, 14 Feb 2017 14:11:25 -0800 (PST) From: Leonid Podolny To: libvir-list@redhat.com, berrange@redhat.com Date: Tue, 14 Feb 2017 17:11:07 -0500 Message-Id: <20170214221107.25113-1-leonid@podolny.net> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Tue, 14 Feb 2017 22:11:28 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Tue, 14 Feb 2017 22:11:28 +0000 (UTC) for IP:'209.85.220.193' DOMAIN:'mail-qk0-f193.google.com' HELO:'mail-qk0-f193.google.com' FROM:'leonid@podolny.net' RCPT:'' X-RedHat-Spam-Score: 1.27 * (BAYES_50, DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, RCVD_IN_SORBS_SPAM) 209.85.220.193 mail-qk0-f193.google.com 209.85.220.193 mail-qk0-f193.google.com X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Scanned-By: MIMEDefang 2.78 on 10.5.110.39 X-loop: libvir-list@redhat.com Cc: Leonid Podolny Subject: [libvirt] [PATCH go v2] 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 PinEmulator() and PinIOThread() there is an 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, 10 insertions(+), 6 deletions(-) diff --git a/domain.go b/domain.go index 5482f1a..9ee908b 100644 --- a/domain.go +++ b/domain.go @@ -3967,10 +3967,12 @@ func (d *Domain) PinEmulator(cpumap []bool, flags D= omainModificationImpact) erro maplen :=3D (len(cpumap) + 7) / 8 ccpumaps :=3D make([]C.uchar, maplen) for i :=3D 0; i < len(cpumap); i++ { - byte :=3D i / 8 - bit :=3D i % 8 + if cpumap[i] { + byte :=3D i / 8 + bit :=3D i % 8 =20 - ccpumaps[byte] |=3D (1 << uint(bit)) + ccpumaps[byte] |=3D (1 << uint(bit)) + } } =20 ret :=3D C.virDomainPinEmulator(d.ptr, &ccpumaps[0], C.int(maplen), C.uin= t(flags)) @@ -3989,10 +3991,12 @@ func (d *Domain) PinIOThread(iothreadid uint, cpuma= p []bool, flags DomainModific maplen :=3D (len(cpumap) + 7) / 8 ccpumaps :=3D make([]C.uchar, maplen) for i :=3D 0; i < len(cpumap); i++ { - byte :=3D i / 8 - bit :=3D i % 8 + if cpumap[i] { + byte :=3D i / 8 + bit :=3D i % 8 =20 - ccpumaps[byte] |=3D (1 << uint(bit)) + 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