[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] x86/Intel: don't log bogus frequency range on Core/Core2 processors
- To: Jan Beulich <jbeulich@xxxxxxxx>
- From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
- Date: Tue, 8 Feb 2022 15:47:34 +0100
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=49vaL47Ca0bT3XdWEPgw1MGVyHkyPaeRkies6Pmp0fE=; b=aXLSHeLB8yik2yPFQVF/skQOEU58ubQYy5cvm/SX3jP2qumXNrcJPg1SMFj6k+Oo4X1jR/pPWV3kHTY/jtTDJvU2rm4aPAW1WoZQN6XTz4+rHdvqBnIGC1cnf+tVXBLMfNKGCexrQ+aCy6JcD1MCTORhKPhKJ9rlqYQeVhBdU5FNtZjyjfNTXBM9op+0Su7PWrq9vbwkK2sLtlWxVGDCkM6tybBp4/9IF2R9QEKA+LQtY1RZyB6FUYOsK+qCG+OWUZA306tsm8viKDkDBzCs3Spov7qkhx3VPTj3UIaNWV37TsU72munjPorriS0Av/9VB4LqxN51rhLcppxkmCDiA==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gulo/+z5LBZFFC1NKBBxPfCzBgl3pC+1KR7989muIbkXiOFIPZy0B0ByBmeQLwZMGYnzeYaZN9FvWCHAxizlkprSkIVlrF5Huva/lId0RqLUJkJk4E6HzuBYL3Y0cRMtiW/xxSFSzEivSbSIGz0w+Evqem+zplYpLPsUf3K6KKZQNcXSbu/NDCLmbXHI5g3BFLiEzduPh8FlbVFC9SmnzEQYBjwjtWNTsPN94ZSjhYMWnZsEwZp0PR0va3RZ6Mfwcnv/bv6u1UFKCiNGLrqr7bsfZ+oXfw6mu+5FrJ6szd7adCunZsr8/wCu19yfqnyT+dKc8x5odK9vfRuuo0xmew==
- Authentication-results: esa3.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
- Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
- Delivery-date: Tue, 08 Feb 2022 14:47:52 +0000
- Ironport-data: A9a23:aZqOnqLEasA4x6xIFE+RA5IlxSXFcZb7ZxGr2PjKsXjdYENS0mEDy WAdX2GCa/3fNjGmL4pxOY+08klXsMeEytFhHgFlqX01Q3x08seUXt7xwmUcns+xwm8vaGo9s q3yv/GZdJhcokcxIn5BC5C5xZVG/fjgqoHUVaiUakideSc+EH170Ug7y7Zg6mJVqYPR7z2l6 IuaT/L3YDdJ6xYsWo7Dw/vewP/HlK2aVAIw5jTSV9gS1LPtvyB94KYkDbOwNxPFrrx8RYZWc QphIIaRpQs19z91Yj+sfy2SnkciGtY+NiDW4pZatjTLbrGvaUXe345iXMfwZ3u7hB2RnPlL2 NtMuqbhdjsbAKuVu+4hAjxHRnQW0a1uoNcrIFC6uM2XiUbHb2Ht07NlC0Re0Y8wo7gtRzsUr LpBdW5LPkvra+GemdpXTsF2gcsuNo/zNZ43sXB81zDJS/0hRPgvRo2UvoAEhGZv2qiiG97nX ugSMxl3NiiYWDhTa3oFK4kuzOin0yyXnzpw9wvO+PtfD3Lo5BN1+KjgNpzSYNPibdVYmAOUq 3zL+0z9AwoGL5qPxDyd6HWui+TT2yThV+o6Fre16/pri1273XEIBVsdUl7TnBWiohfgAZQFc RVSo3dw6/hpnKC2cjXjdwW7iUSUsB8TYYtvL98E7liuwJaFxhnMUwDoUQV9QNAhscY3Qxkj2 VmIg87lCFRTjVGFdZ6O3uzK9G3vYED5OUdHPH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6 Dsmfav6gDQMkg/X4CePD0oTuLDr9rEmNbPZgMHPQcu7E2rgSmz4LD3PhCE1lNGOgk/jIsKwC zgqUjU96+ju/a0xlv10HLS1Y1fnJ/ExsFYDMKBp8AJInHHixquZq5mR7qe1QpF6t2H2RIPqp 3hsh0gN8N85zf4eXy0mwLk303a3DMn+xbZuCmlqEqmhfa8aCMxCsJHi44cWADe8VAcsNZ117 8O936FtrJMZCmw0hjV1pztbVVHh0C0qX0tnao4lHpES7YTb7dXsMg24F5VKpEdByj3gbpXX9 WGNPuspMq+TGnqLEww5gJUsZ6RtzUIb1u7q3E5y42oO2M8pgE986MarPZv6UvouqhND6Ws3N 60QZiAoos+OvP+XZgNdNvpfvHHeFAlYSi8eV56cm6XXJ3uBRr22uvKCfMOlaaXRKA=
- Ironport-sdr: UubI2e1Sxg5g6RZLK3rNn4GrBAQQpT5O0UnBFEwrDMkhnZoqjHCwSExknDrGCVcacLAnq98Ds1 Ghh366Ewt2Cr1E6BboJs08ty6qXpDhft/tLhNJ5tJD8T0zpsOvWzHR3SfuLHh2apuzhoyXC4Tm 0H8f+Hn4JCbqlIbQ1ILlzZSG7JbxtMjaTusnVZI9wMElwCB4GKFayZcCBlm/gM7Sw5EJDeHP+v pqALYZePnKDPJXJN2WgsqV6gnvW20PzkDXeaIqAeSXkpo9hvWGF9exGW4QoI4qRlwttW0e8oiY rAaztDU5XS0PRgw6J/AzcZtc
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On Tue, Feb 08, 2022 at 03:28:23PM +0100, Jan Beulich wrote:
> On 08.02.2022 15:20, Roger Pau Monné wrote:
> > On Tue, Feb 08, 2022 at 11:51:03AM +0100, Jan Beulich wrote:
> >> On 08.02.2022 09:54, Roger Pau Monné wrote:
> >>> On Fri, Feb 04, 2022 at 02:56:43PM +0100, Jan Beulich wrote:
> >>>> --- a/xen/arch/x86/cpu/intel.c
> >>>> +++ b/xen/arch/x86/cpu/intel.c
> >>>> @@ -435,6 +435,26 @@ static void intel_log_freq(const struct
> >>>> if ( c->x86 == 6 )
> >>>> switch ( c->x86_model )
> >>>> {
> >>>> + static const unsigned short core_factors[] =
> >>>> + { 26667, 13333, 20000, 16667, 33333, 10000, 40000 };
> >>>> +
> >>>> + case 0x0e: /* Core */
> >>>> + case 0x0f: case 0x16: case 0x17: case 0x1d: /* Core2 */
> >>>> + /*
> >>>> + * PLATFORM_INFO, while not documented for these,
> >>>> appears to
> >>>> + * exist in at least some cases, but what it holds
> >>>> doesn't
> >>>> + * match the scheme used by newer CPUs. At a guess,
> >>>> the min
> >>>> + * and max fields look to be reversed, while the scaling
> >>>> + * factor is encoded in FSB_FREQ.
> >>>> + */
> >>>> + if ( min_ratio > max_ratio )
> >>>> + SWAP(min_ratio, max_ratio);
> >>>> + if ( rdmsr_safe(MSR_FSB_FREQ, msrval) ||
> >>>> + (msrval &= 7) >= ARRAY_SIZE(core_factors) )
> >>>> + return;
> >>>> + factor = core_factors[msrval];
> >>>> + break;
> >>>> +
> >>>> case 0x1a: case 0x1e: case 0x1f: case 0x2e: /* Nehalem */
> >>>> case 0x25: case 0x2c: case 0x2f: /* Westmere */
> >>>> factor = 13333;
> >>>
> >>> Seeing that the MSR is present on non documented models and has
> >>> unknown behavior we might want to further sanity check that min < max
> >>> before printing anything?
> >>
> >> But I'm already swapping the two in the opposite case?
> >
> > You are only doing the swapping for Core/Core2.
> >
> > What I mean is that given the possible availability of
> > MSR_INTEL_PLATFORM_INFO on undocumented platforms and the different
> > semantics we should unconditionally check that the frequencies we are
> > going to print are sane, and one easy check would be that min < max
> > before printing.
>
> Oh, I see. Yes, I did consider this, but decided against because it
> would hide cases where we're not in line with reality. I might not
> have spotted the issue here if we would have had such a check in
> place already (maybe the too low number would have caught my
> attention, but the <high> ... <low> range logged was far more
> obviously wrong). (In any event, if such a change was to be made, I
> think it should be a separate patch.)
My suggestion was to avoid printing both (max and min) if min > max,
as there's obviously something wrong there. Maybe we could print
unconditionally for debug builds, or print an error message otherwise
to note that PLATFORM_INFO is present but the values calculated don't
make sense?
In any case, this is just for informational purposes, so I don't
really want to delay you anymore with this. If you think both options
above are not worth it, feel free to take my Ack for this one:
Acked-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
Thanks, Roger.
|