[MODERATED] Re: [PATCH v4 03/10] TAAv4 3

Josh Poimboeuf <[email protected]>
Newsgroups org.kernel.lore.historical-speck
Message-ID <20190926023445.afjeaizeloehi6bn@treble>
On Wed, Sep 25, 2019 at 06:13:05PM -0700, speck for Pawan Gupta wrote:
> > > > > +static int __init tsx_cmdline(char *str)
> > > > > +{
> > > > > +	if (!str)
> > > > > +		return -EINVAL;
> > > > > +
> > > > > +	if (!strcmp(str, "on"))
> > > > > +		tsx_ctrl_state = TSX_CTRL_ENABLE;
> > > > > +	else if (!strcmp(str, "off"))
> > > > > +		tsx_ctrl_state = TSX_CTRL_DISABLE;
> > > > > +
> > > > > +	return 0;
> > > > > +}
> > > > > +early_param("tsx", tsx_cmdline);
> > > > 
> > > > Hmm...  Let's say I have a non-TSX system.  I specify tsx=on.  This will
> > > > set tsx_ctrl_state=TSX_CTRL_ENABLE, then tsx_ctrl_check_support() will
> > > > set it to tsx_ctrl_state=TSX_CTRL_NOT_SUPPORTED.
> > > > 
> > > > I *think* this all works, but I'd love a comment or two about it.  Maybe
> > > > even something that makes it clear that tsx_en/disable() are both only
> > > > called when TSX *AND* TSX_CTRL_MSR are supported.
> > > > 
> > > > This is all kinda weird and confusing because we're doing this all
> > > > without the X86_FEATURE bits for TSX.
> > > 
> > > If we add another X86_FEATURE bit it will have exact same state as
> > > X86_FEATURE_RTM.  Do we really need this?
> > 
> > How about moving the tsx_init() call to early_init_intel()?  Then you'd
> > be able to check the feature bit above.  And that might make the
> > ordering a little easier to follow.
> 
> Sorry, I am failing to understand how it would make a difference.
> early_init_intel() is also called from init_init().

Regardless, shouldn't tsx_init() at least be called before
cpu_set_bug_bits(), so that X86_BUG_TAA can get set appropriately?

In that case, instead of early_param(), tsx_init() could just use
cmdline_find_option() to find the 'tsx=' option.  That would also have
the advantage of making it much easier to untangle the initialization
order.

If early_init_intel() isn't the right spot, then maybe
early_identify_cpu().

-- 
Josh
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.