From: "Cyrill Gorcunov" <gorcunov@gmail.com>
To: "Pallipadi, Venkatesh" <venkatesh.pallipadi@intel.com>
Cc: "Ingo Molnar" <mingo@elte.hu>,
"Thomas Gleixner" <tglx@linutronix.de>,
"H. Peter Anvin" <hpa@zytor.com>,
linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] Typo in x86 apic.c with DIVISOR setup
Date: Fri, 10 Oct 2008 09:39:15 +0400 [thread overview]
Message-ID: <aa79d98a0810092239p32153776qd0cda47e54929545@mail.gmail.com> (raw)
In-Reply-To: <7E82351C108FA840AB1866AC776AEC463782339F@orsmsx505.amr.corp.intel.com>
On Fri, Oct 10, 2008 at 9:10 AM, Pallipadi, Venkatesh
<venkatesh.pallipadi@intel.com> wrote:
>
>
>>-----Original Message-----
>>From: Cyrill Gorcunov [mailto:gorcunov@gmail.com]
>>Sent: Thursday, October 09, 2008 9:38 PM
>>To: Pallipadi, Venkatesh
>>Cc: Ingo Molnar; Thomas Gleixner; H. Peter Anvin; linux-kernel
>>Subject: Re: [PATCH] Typo in x86 apic.c with DIVISOR setup
>>
>>On Fri, Oct 10, 2008 at 4:22 AM, Venki Pallipadi
>><venkatesh.pallipadi@intel.com> wrote:
>>>
>>> Fix a typo in x86 apic.c CONFG_X86_64 -> CONFIG_X86_64.
>>> The intention looks like was to have divisor of 1 on x86_64 kernel.
>>>
>>> Also, for DIVISOR value of 1 to work, APIC_TDR_DIV should also change
>>> depending on divide by 1 or divide by 16 is used.
>>>
>>> Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
>>>
>>> ---
>>> arch/x86/kernel/apic.c | 6 ++++--
>>> 1 file changed, 4 insertions(+), 2 deletions(-)
>>>
>>> Index: tip/arch/x86/kernel/apic.c
>>> ===================================================================
>>> --- tip.orig/arch/x86/kernel/apic.c 2008-10-09
>>17:12:39.000000000 -0700
>>> +++ tip/arch/x86/kernel/apic.c 2008-10-09 17:13:29.000000000 -0700
>>> @@ -332,10 +332,12 @@ int lapic_get_maxlvt(void)
>>> */
>>>
>>> /* Clock divisor */
>>> -#ifdef CONFG_X86_64
>>> +#ifdef CONFIG_X86_64
>>> #define APIC_DIVISOR 1
>>> +#define APIC_TDR_DIV APIC_TDR_DIV_1
>>> #else
>>> #define APIC_DIVISOR 16
>>> +#define APIC_TDR_DIV APIC_TDR_DIV_16
>>> #endif
>>>
>>> /*
>>> @@ -369,7 +371,7 @@ static void __setup_APIC_LVTT(unsigned i
>>> tmp_value = apic_read(APIC_TDCR);
>>> apic_write(APIC_TDCR,
>>> (tmp_value & ~(APIC_TDR_DIV_1 |
>>APIC_TDR_DIV_TMBASE)) |
>>> - APIC_TDR_DIV_16);
>>> + APIC_TDR_DIV);
>>>
>>> if (!oneshot)
>>> apic_write(APIC_TMICT, clocks / APIC_DIVISOR);
>>>
>>
>>Hi Venki,
>>
>>you know I don't have code under my hands now to take a look on
>>(i'm in office now) -- but if I recall correctly it's not a typo :) By
>>writting (1) instead of (16) you make counter decrease faster by
>>16 times (if to compare with what we have now). So we could get
>>counter underflow before we've finish calibration. That is was the
>>original intension of this 16 divisor being used. Did you test this
>>patch?
>>
>
> Typo part I mentioned was this
>
>>> -#ifdef CONFG_X86_64
>>> +#ifdef CONFIG_X86_64
>
> Looks like intention was to use DIVISOR of 1 for x86_64 and divisor of
> 16 for 32 bit kernel. Once I changed that, there was still one place in
> 64 bit code that was assuming divisor of 16. The rest of the patch
> changes that part.
>
> Yes. Tested this patch on couple of systems here and worked fine.
>
> Thanks,
> Venki
Ah, it was CONFG who is guilty :) This is true indeed, thanks!
But here is not the same
apic_write(APIC_TDCR,
(tmp_value & ~(APIC_TDR_DIV_1 | APIC_TDR_DIV_TMBASE)) |
- APIC_TDR_DIV_16);
+ APIC_TDR_DIV);
On x86_64 it will be 1 now but we've used 16 for a long time in purpose
to slowdown processor's bus CLKs from APIC point of view. So I don't think
it's good idea to change it now. If we start using divisor 1 today -- it would
work for some time 'till processor bus raised to the some speed when
we'll get counter underflow before calibration finished.
So could you please split the patch into two:
1) Plain CONFG typo fix (which is completely Ack'ed)
2) APIC divisor patch (which I'm not sure if we've to touch)
Thanks,
Cyrill
next prev parent reply other threads:[~2008-10-10 5:39 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-10 0:22 Venki Pallipadi
2008-10-10 4:38 ` Cyrill Gorcunov
2008-10-10 5:10 ` Pallipadi, Venkatesh
2008-10-10 5:39 ` Cyrill Gorcunov [this message]
2008-10-10 9:01 ` Ingo Molnar
2008-10-10 11:14 ` Cyrill Gorcunov
2008-10-10 11:15 ` Maciej W. Rozycki
2008-10-10 11:16 ` Cyrill Gorcunov
2008-10-10 11:24 ` Maciej W. Rozycki
2008-10-10 11:56 ` Ingo Molnar
2008-10-10 12:38 ` Cyrill Gorcunov
2008-10-10 14:45 ` Ingo Molnar
2008-10-10 12:26 ` Cyrill Gorcunov
2008-10-10 16:01 ` Pallipadi, Venkatesh
2008-10-10 16:29 ` Maciej W. Rozycki
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=aa79d98a0810092239p32153776qd0cda47e54929545@mail.gmail.com \
--to=gorcunov@gmail.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=tglx@linutronix.de \
--cc=venkatesh.pallipadi@intel.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
all inboxes | Powered by JetHome®