From mboxrd@z Thu Jan 1 00:00:00 1970 From: George Dunlap Subject: Re: [PATCH] libxc/xentrace: Replace xc_tbuf_set_cpu_mask with CPU mask with xc_cpumap_t instead of uint32_t Date: Tue, 17 Mar 2015 13:52:27 +0000 Message-ID: <5508319B.70109@eu.citrix.com> References: <1426279030-15482-1-git-send-email-konrad.wilk@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YXrvO-0004Tc-Sc for xen-devel@lists.xenproject.org; Tue, 17 Mar 2015 13:52:51 +0000 In-Reply-To: <1426279030-15482-1-git-send-email-konrad.wilk@oracle.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Konrad Rzeszutek Wilk , xen-devel@lists.xenproject.org List-Id: xen-devel@lists.xenproject.org On 03/13/2015 08:37 PM, Konrad Rzeszutek Wilk wrote: > +static int parse_cpumask(const char *arg) > +{ > + xc_cpumap_t map; > + uint32_t v, i; > + int bits = 0; > + > + map = malloc(sizeof(uint32_t)); > + if ( !map ) > + return -ENOMEM; > + > + v = argtol(arg, 0); > + for ( i = 0; i < sizeof(uint32_t) ; i++ ) > + map[i] = (v >> (i * 8)) & 0xff; > + > + for ( i = 0; v; v >>= 1) > + bits += v & 1; Uum, it looks like this is counting the 1-bits in v, not the total number of bist. So "0x8000" would finish with bits == 1 ; but we would this to finish with bits == 16, don't we? Or am I confused? -George