mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Dou Liyang <douly.fnst@cn.fujitsu.com>
Cc: x86@kernel.org, linux-kernel@vger.kernel.org,
	xen-devel@lists.xenproject.org, mingo@kernel.org, hpa@zytor.com,
	ebiederm@xmission.com, bhe@redhat.com,
	boris.ostrovsky@oracle.com, peterz@infradead.org,
	izumi.taku@jp.fujitsu.com
Subject: Re: [PATCH v5 08/12] x86/ioapic: Refactor the delay logic in timer_irq_works()
Date: Sun, 2 Jul 2017 21:15:00 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.20.1707022111140.2296@nanos> (raw)
In-Reply-To: <3ce38e2076e32d1e323f0ef9d236937c1c251bc1.1498795030.git.douly.fnst@cn.fujitsu.com>

On Fri, 30 Jun 2017, Dou Liyang wrote:
> +static void __init delay_with_tsc(void)
> +{
> +	unsigned long long start, now;
> +	unsigned long ticks = jiffies;

Please make that

       unsigned long end = jiffies + 4;

ticks really means: number of ticks. But that variable is doing something
different.

> +	start = rdtsc();
> +
> +	/*
> +	 * We don't know the TSC frequency yet, but waiting for
> +	 * 40000000000/HZ TSC cycles is safe:
> +	 * 4 GHz == 10 jiffies
> +	 * 1 GHz == 40 jiffies
> +	 */
> +	do {
> +		rep_nop();
> +		now = rdtsc();
> +	} while ((now - start) < 40000000000UL / HZ &&
> +		time_before_eq(jiffies, ticks + 4));
> +}
> +
> +static void __init delay_without_tsc(void)
> +{
> +	int band = 1;
> +	unsigned long ticks = jiffies;

Please sort variables in reverse fir tree order

	unsigned long end = jiffies + 4;
	int band = 1;

> +
> +	/*
> +	 * We don't know any frequency yet, but waiting for
> +	 * 40940000000/HZ cycles is safe:
> +	 * 4 GHz == 10 jiffies
> +	 * 1 GHz == 40 jiffies
> +	 * 1 << 1 + 1 << 2 +...+ 1 << 11 = 4094
> +	 */
> +	do {
> +		__delay(((1 << band++) * 10000000UL) / HZ);

  s/1/1U/

> +	} while (band < 12 && time_before_eq(jiffies, ticks + 4));
> +}

Thanks,

	tglx

  reply	other threads:[~2017-07-02 19:15 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-30  4:07 [PATCH v5 00/12] Unify the interrupt delivery mode and do its setup in advance Dou Liyang
2017-06-30  4:07 ` [PATCH v5 01/12] x86/apic: Construct a selector for the interrupt delivery mode Dou Liyang
2017-07-02 17:37   ` Thomas Gleixner
2017-07-03  1:44     ` Dou Liyang
2017-06-30  4:07 ` [PATCH v5 02/12] x86/apic: Prepare for unifying the interrupt delivery modes setup Dou Liyang
2017-07-02 17:47   ` Thomas Gleixner
2017-07-03  1:58     ` Dou Liyang
2017-07-03  6:41       ` Thomas Gleixner
2017-07-03  6:47         ` Dou Liyang
2017-06-30  4:07 ` [PATCH v5 03/12] x86/apic: Split local APIC timer setup from the APIC setup Dou Liyang
2017-06-30  4:07 ` [PATCH v5 04/12] x86/apic: Move logical APIC ID away from apic_bsp_setup() Dou Liyang
2017-07-02 17:54   ` Thomas Gleixner
2017-07-03  2:02     ` Dou Liyang
2017-06-30  4:07 ` [PATCH v5 05/12] x86/apic: Unify interrupt mode setup for SMP-capable system Dou Liyang
2017-07-02 18:07   ` Thomas Gleixner
2017-07-03  2:34     ` Dou Liyang
2017-06-30  4:07 ` [PATCH v5 06/12] x86/apic: Mark the apic_intr_mode extern for sanity check cleanup Dou Liyang
2017-06-30  4:07 ` [PATCH v5 07/12] x86/apic: Unify interrupt mode setup for UP system Dou Liyang
2017-07-02 18:19   ` Thomas Gleixner
2017-07-03  2:34     ` Dou Liyang
2017-06-30  4:07 ` [PATCH v5 08/12] x86/ioapic: Refactor the delay logic in timer_irq_works() Dou Liyang
2017-07-02 19:15   ` Thomas Gleixner [this message]
2017-07-03  3:23     ` Dou Liyang
2017-06-30  4:07 ` [PATCH v5 09/12] x86/init: add intr_mode_init to x86_init_ops Dou Liyang
2017-07-02 19:16   ` Thomas Gleixner
2017-07-03  3:28     ` Dou Liyang
2017-06-30  4:07 ` [PATCH v5 10/12] x86/xen: Bypass intr mode setup in enlighten_pv system Dou Liyang
2017-07-02 19:18   ` Thomas Gleixner
2017-07-03  3:53     ` Dou Liyang
2017-07-03  6:56       ` Thomas Gleixner
2017-07-03  7:17         ` Dou Liyang
2017-06-30  4:07 ` [PATCH v5 11/12] x86/time: Initialize interrupt mode behind timer init Dou Liyang
2017-07-06 14:54   ` [x86/time] 03fa63cc96: ACPI_Error:Table[DMAR]is_not_invalidated_during_early_boot_stage(#/tbxface-#) kernel test robot
2017-07-06 21:03     ` [x86/time] 03fa63cc96: ACPI_Error:Table[DMAR]is_not_invalidated_during_early_boot_stage(#/tbxface -#) Thomas Gleixner
2017-07-07  1:54       ` Ye Xiaolong
2017-07-07  2:39         ` Dou Liyang
2017-07-07  3:04           ` Ye Xiaolong
2017-07-07  4:46             ` Dou Liyang
2017-06-30  4:07 ` [PATCH v5 12/12] x86/apic: Remove the init_bsp_APIC() Dou Liyang

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=alpine.DEB.2.20.1707022111140.2296@nanos \
    --to=tglx@linutronix.de \
    --cc=bhe@redhat.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=douly.fnst@cn.fujitsu.com \
    --cc=ebiederm@xmission.com \
    --cc=hpa@zytor.com \
    --cc=izumi.taku@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=x86@kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    /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®