Re: Kernel broken on processors without performance counters

From: Peter Zijlstra
Date: Fri Jul 24 2015 - 06:56:15 EST


On Thu, Jul 23, 2015 at 03:14:13PM -0400, Jason Baron wrote:
> > +static enum jump_label_type jump_label_type(struct jump_entry *entry)
> > +{
> > + struct static_key *key = static_key_cast(iter->key);
> > + bool true_branch = jump_label_get_branch_default(key);
> > + bool state = static_key_enabled(key);
> > + bool inv = static_key_inv(iter->key);
> > +
> > + return (true_branch ^ state) ^ inv;
>
> iiuc...this allows both the old style keys to co-exist with the
> new ones. IE state wouldn't be set for the new ones. And inv
> shouldn't be set for the old ones. Is that correct?

@state is the dynamic variable here, the other two are compile time.
@true_branch denotes the default (compile time) value, and @inv denotes
the (compile time) branch preference.

So @state will still be set for the new ones, but you're right in that
@inv will not be set for the 'legacy' stuff.

This one little line needs a big comment.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/