From: Wei Liu Subject: Re: [PATCH v4 01/21] xen: dump vNUMA information with debug key "u" Date: Fri, 23 Jan 2015 13:23:44 +0000 Message-ID: <20150123132344.GA1801@zion.uk.xensource.com> References: <1422011632-22018-1-git-send-email-wei.liu2@citrix.com> <1422011632-22018-2-git-send-email-wei.liu2@citrix.com> <54C254A40200007800058CCF@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <54C254A40200007800058CCF@mail.emea.novell.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: Jan Beulich Cc: Wei Liu , ian.campbell@citrix.com, andrew.cooper3@citrix.com, dario.faggioli@citrix.com, ian.jackson@eu.citrix.com, xen-devel@lists.xen.org, ufimtseva@gmail.com List-Id: xen-devel@lists.xenproject.org On Fri, Jan 23, 2015 at 01:03:16PM +0000, Jan Beulich wrote: > >>> On 23.01.15 at 12:13, wrote: > > @@ -408,6 +413,68 @@ static void dump_numa(unsigned char key) > > > > for_each_online_node ( i ) > > printk(" Node %u: %u\n", i, page_num_node[i]); > > + > > + read_lock(&d->vnuma_rwlock); > > I'm sorry, but no - on v3 I specifically said "don't you need to try to > acquire d->vnuma_rwlock for reading, and skip any printing if the > acquire attempt fails". I.e. this should read_trylock(). (Yes, there > are pre-existing bad examples [including the acquiring of > d->page_alloc_lock in this function], but I think we should stop this > practice.) > No problem. I will fix this. > > + if ( !d->vnuma ) > > + { > > + read_unlock(&d->vnuma_rwlock); > > + continue; > > + } > > + > > + vnuma = d->vnuma; > > + printk(" %u vnodes, %u vcpus, guest physical layout:\n", > > + vnuma->nr_vnodes, d->max_vcpus); > > + for ( i = 0; i < vnuma->nr_vnodes; i++ ) > > + { > > + unsigned int start_cpu = ~0U; > > + > > + err = snprintf(keyhandler_scratch, 12, "%3u", > > + vnuma->vnode_to_pnode[i]); > > + if ( err < 0 || vnuma->vnode_to_pnode[i] == NUMA_NO_NODE ) > > + strlcpy(keyhandler_scratch, "???", 3); > > If you really want 3 question marks to appear, the number needs to > be > 3. Is there any reason not to pass the correct one, i.e. > ARRAY_SIZE(keyhandler_scratch) (or sizeof(keyhandler_scratch))? > This is from Elena's original patch. I missed this one. Will fix. > > + > > + printk(" %3u: pnode %s,", i, keyhandler_scratch); > > + > > + printk(" vcpus "); > > + > > + for ( j = 0; j < d->max_vcpus; j++ ) > > + { > > + if ( !(j & 0x3f) ) > > + process_pending_softirqs(); > > + > > + if ( vnuma->vcpu_to_vnode[j] == i ) > > + { > > + if ( start_cpu == ~0U ) > > + { > > + printk("%d", j); > > + start_cpu = j; > > + } > > + } else if ( start_cpu != ~0U ) { > > Coding style. > Fixed. > > + if ( j - 1 != start_cpu ) > > + printk("-%d ", j - 1); > > + else > > + printk(" "); > > + start_cpu = ~0U; > > + } > > + } > > + > > + if ( start_cpu != ~0U && start_cpu != j - 1 ) > > + printk("-%d", j - 1); > > + > > + printk("\n"); > > + > > + for ( j = 0; j < vnuma->nr_vmemranges; j++ ) > > + { > > + if ( vnuma->vmemrange[j].nid == i ) > > + { > > + printk(" %016"PRIx64" - %016"PRIx64"\n", > > + vnuma->vmemrange[j].start, > > + vnuma->vmemrange[j].end); > > + } > > + } > > At least the inner (belonging to the if()) braces should be dropped > as being unnecessary. > Inner braces removed. Wei. > Jan