Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753057AbcCMQdt (ORCPT ); Sun, 13 Mar 2016 12:33:49 -0400 Received: from thoth.sbs.de ([192.35.17.2]:37110 "EHLO thoth.sbs.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750760AbcCMQdm (ORCPT ); Sun, 13 Mar 2016 12:33:42 -0400 Subject: Re: [PATCHv3 10/13] scripts/gdb: Add cpu iterators To: Kieran Bingham , linux-kernel@vger.kernel.org References: <1457005267-843-1-git-send-email-kieran.bingham@linaro.org> <1457005267-843-11-git-send-email-kieran.bingham@linaro.org> Cc: lee.jones@linaro.org, peter.griffin@linaro.org, maxime.coquelin@st.com From: Jan Kiszka Message-ID: <56E5965F.5030001@siemens.com> Date: Sun, 13 Mar 2016 17:33:35 +0100 User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666 MIME-Version: 1.0 In-Reply-To: <1457005267-843-11-git-send-email-kieran.bingham@linaro.org> Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1625 Lines: 58 On 2016-03-03 12:41, Kieran Bingham wrote: > The linux kernel provides macro's for iterating against values from the > cpu_list masks. By providing some commonly used masks, we can mirror the > kernels helper macros with easy to use generators. > > Signed-off-by: Kieran Bingham > --- > scripts/gdb/linux/cpus.py | 21 +++++++++++++++++++++ > 1 file changed, 21 insertions(+) > > diff --git a/scripts/gdb/linux/cpus.py b/scripts/gdb/linux/cpus.py > index 4297b83fedef..59e24472c507 100644 > --- a/scripts/gdb/linux/cpus.py > +++ b/scripts/gdb/linux/cpus.py > @@ -100,6 +100,27 @@ def cpu_list(mask_name): > yield cpu > > > +def each_online_cpu(): > + for cpu in cpu_list("cpu_online_mask"): > + yield cpu > + > + > +def each_present_cpu(): > + for cpu in cpu_list("cpu_present_mask"): > + yield cpu > + > + > +def each_possible_cpu(): > + for cpu in cpu_list("cpu_possible_mask"): > + yield cpu > + This patch requires rebasing over master (these masks became macros). In general, please base on master or even next before posting. > + > +def print_cpus(): > + gdb.write("Possible CPUS : {}\n".format(list(each_possible_cpu()))) > + gdb.write("Present CPUS : {}\n".format(list(each_present_cpu()))) > + gdb.write("Online CPUS : {}\n".format(list(each_online_cpu()))) I think this can be useful. Let's make it a real, discoverable command. lx-cpus? > + > + > class PerCpu(gdb.Function): > """Return per-cpu variable. > > Jan -- Siemens AG, Corporate Technology, CT RDA ITP SES-DE Corporate Competence Center Embedded Linux