From: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com>
To: Paul Mackerras <paulus@samba.org>
Cc: Anton Blanchard <anton@samba.org>, linuxppc-dev@ozlabs.org
Subject: Re: [RFC PATCH v2 1/2] powerpc: cleanup APIs for cpu/thread/core mappings
Date: Tue, 18 May 2010 00:29:46 +0530 [thread overview]
Message-ID: <20100517185946.GC25997@dirshya.in.ibm.com> (raw)
In-Reply-To: <20100510054801.GG5612@dirshya.in.ibm.com>
* Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com> [2010-05-10 11:18:01]:
> * Paul Mackerras <paulus@samba.org> [2010-05-10 09:05:22]:
>
> > On Fri, May 07, 2010 at 05:18:42PM +0530, Vaidyanathan Srinivasan wrote:
> >
> > > These APIs take logical cpu number as input
> > > Change cpu_first_thread_in_core() to cpu_leftmost_thread_sibling()
> > > Change cpu_last_thread_in_core() to cpu_rightmost_thread_sibling()
> > >
> > > These APIs convert core number (index) to logical cpu/thread numbers
> > > Add cpu_first_thread_of_core(int core)
> > > Changed cpu_thread_to_core() to cpu_core_of_thread(int cpu)
> >
> > Why make all these changes? The end result doesn't seem any cleaner
> > or better than how it was before, and your patch description doesn't
> > give any reason for us to think "yes, we should make this change".
> > I assume you think this is a good change to make, so you need to
> > explain why it's a good idea and convince the rest of us.
>
> Sure Paul.. let me explain. The crux of the issue is to make
> 'threads_per_core' accessible to the pseries_energy module. In the
> first RFC, I had directly exported the variable which is not a good
> design. Ben H suggested to make an API around it and then export the
> function:
> http://lists.ozlabs.org/pipermail/linuxppc-dev/2010-April/081610.html
>
> Instead of making an API to read threads_per_core, as Ben suggested,
> I have made a wrapper at a higher level to make an API to convert from
> logical cpu number to core number.
>
> The current APIs cpu_first_thread_in_core() and
> cpu_last_thread_in_core() returns logical CPU number while
> cpu_thread_to_core() returns core number or index which is not
> a logical CPU number.
>
> Ben recommended to clearly name them to distinguish 'core number'
> versus first and last 'logical cpu number' in that core.
>
> Hence in the new scheme, I have:
>
> > > Change cpu_first_thread_in_core() to cpu_leftmost_thread_sibling()
> > > Change cpu_last_thread_in_core() to cpu_rightmost_thread_sibling()
>
> which work on logical cpu numbers.
> While cpu_first_thread_of_core() and cpu_core_of_thread() work on core
> index.
>
> Example usage: (4 threads per core system)
>
> cpu_leftmost_thread_sibling(5) = 4
> cpu_rightmost_thread_sibling(5) = 7
> cpu_core_of_thread(5) = 1
> cpu_first_thread_of_core(1) = 4
>
> cpu_core_of_thread() is used in cpu_to_drc_index() in the module and
> cpu_first_thread_of_core() is used in drc_index_to_cpu() in the
> module. These APIs may be useful in other modules in future, and the
> proposed design is a good method to export these APIs to modules.
>
> An alternative approach could be to move both the base functions
> cpu_to_drc_index() and drc_index_to_cpu() into the kernel like in
> arch/powerpc/kernel/smp.c
>
> Thanks for the review, I hope I have explained the requirements and
> design for this cleanup.
Hi Paul and Ben,
Do you have any further comments on this patch series and related
cleanup? I will post the next iteration in a day or two.
Thanks,
Vaidy
next prev parent reply other threads:[~2010-05-17 18:59 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-07 11:48 [RFC PATCH v2 0/2] powerpc: add support for new hcall H_BEST_ENERGY Vaidyanathan Srinivasan
2010-05-07 11:48 ` [RFC PATCH v2 1/2] powerpc: cleanup APIs for cpu/thread/core mappings Vaidyanathan Srinivasan
2010-05-09 23:05 ` Paul Mackerras
2010-05-10 5:48 ` Vaidyanathan Srinivasan
2010-05-17 18:59 ` Vaidyanathan Srinivasan [this message]
2010-05-07 11:48 ` [RFC PATCH v2 2/2] powerpc: add support for new hcall H_BEST_ENERGY Vaidyanathan Srinivasan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100517185946.GC25997@dirshya.in.ibm.com \
--to=svaidy@linux.vnet.ibm.com \
--cc=anton@samba.org \
--cc=linuxppc-dev@ozlabs.org \
--cc=paulus@samba.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).