public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Peter Bergner <bergner@linux.ibm.com>
To: MAHESH BODAPATI <bmahi496@linux.ibm.com>, libc-alpha@sourceware.org
Cc: rajis@linux.ibm.com, Mahesh Bodapati <mahesh.bodapati@ibm.com>
Subject: Re: [PATCH v3] PowerPC: Influence cpu/arch hwcap features via GLIBC_TUNABLES.
Date: Fri, 7 Jul 2023 11:40:26 -0500	[thread overview]
Message-ID: <6f37fb1f-3899-e8c8-2444-a67da75d5ec8@linux.ibm.com> (raw)
In-Reply-To: <2877a1be-84e2-00c1-1dff-c00d290a0af9@linux.ibm.com>

On 7/7/23 5:52 AM, MAHESH BODAPATI wrote:
> On 07/07/23 2:35 am, Peter Bergner wrote:
>> I don't see how this code can ever "add" new bits to cpu_features->hwcap
>> or cpu_features->hwcap2.  We cache their values at the top of the loop
>> and then OR in the tunable mask, but only if they're not already set
>> in the cached values.  If the tunable mask has a bit that isn't already
>> present in cpu_features->hwcap/cpu_features->hwcap2, we'll never set
>> them.  It seems your code as is, can only ever remove bits from hwcap/hwcap2.
>>
>> Question for you or anyone else, is there a scenario where we can execute
>> our set_hwcaps tunable callback function where the set of HWCAP/2 feature
>> bits is a subset of the HWCAP/2 bits that the kernel passed to us?
> 
> I don't see any scenario like that.
> It will be helpful when user set multiple entries of tunable.
> For example "-arch_3_1,-arch_3_00,-vsx,arch_3_00" here we have 2 entries of arch_3_00
> where it's disabling at first place and enabling at second place.

What I meant was that if you look at the bits in cpu_features->hwcap and
cpu_features->hwcap2 before this code is executed and their bits after,
you will not see any bits that are set that were not already set before.
That's what I mean by your code can only ever remove bits, not add new bits.
Your example above is just cleaning up dumb user usage, since that is
exactly equivalent (because our original mask is full-featured) to the user
instead saying "-arch_3_1,-vsx".  Ie, we only remove bits in the end.

Adhemerval confirmed that this code is only run once, so my concern that
your code can't add new bits to the hwcap masks isn't a problem, since
our hwcap masks start out full-featured and there is no way for them to
have hwcap bits removed before your code is executed. 

Peter



  reply	other threads:[~2023-07-07 16:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-06 12:25 bmahi496
2023-07-06 13:16 ` Adhemerval Zanella Netto
2023-07-06 20:38   ` Peter Bergner
2023-07-07 10:44   ` MAHESH BODAPATI
2023-07-06 21:05 ` Peter Bergner
2023-07-07 10:52   ` MAHESH BODAPATI
2023-07-07 16:40     ` Peter Bergner [this message]
2023-07-07 14:25   ` Adhemerval Zanella Netto
2023-07-07 16:07     ` Peter Bergner

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=6f37fb1f-3899-e8c8-2444-a67da75d5ec8@linux.ibm.com \
    --to=bergner@linux.ibm.com \
    --cc=bmahi496@linux.ibm.com \
    --cc=libc-alpha@sourceware.org \
    --cc=mahesh.bodapati@ibm.com \
    --cc=rajis@linux.ibm.com \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).