From: tip-bot for Andy Lutomirski <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: bp@alien8.de, bp@suse.de, tglx@linutronix.de, hpa@zytor.com,
lenb@kernel.org, kvm@vger.kernel.org,
torvalds@linux-foundation.org, jarod@wilsonet.com,
linux-kernel@vger.kernel.org, peterz@infradead.org,
luto@amacapital.net, luto@kernel.org, gregkh@linuxfoundation.org,
brgerst@gmail.com, dvlasenk@redhat.com, john.stultz@linaro.org,
ralf@linux-mips.org, ray.huang@amd.com, mingo@kernel.org
Subject: [tip:x86/asm] x86/asm/tsc, staging/lirc_serial: Remove TSC-based timing
Date: Mon, 6 Jul 2015 08:42:29 -0700 [thread overview]
Message-ID: <tip-3a2c16c8489d967de10b3b7f5cc0f7cab4337770@git.kernel.org> (raw)
In-Reply-To: <c95df47c5405b494d19d20b2852a9378c9f661f3.1434501121.git.luto@kernel.org>
Commit-ID: 3a2c16c8489d967de10b3b7f5cc0f7cab4337770
Gitweb: http://git.kernel.org/tip/3a2c16c8489d967de10b3b7f5cc0f7cab4337770
Author: Andy Lutomirski <luto@kernel.org>
AuthorDate: Thu, 25 Jun 2015 18:44:03 +0200
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Mon, 6 Jul 2015 15:23:27 +0200
x86/asm/tsc, staging/lirc_serial: Remove TSC-based timing
It wasn't compiled in by default. I suspect that the driver was
and still is broken, though -- it's calling udelay with a
parameter that's derived from loops_per_jiffy.
Signed-off-by: Andy Lutomirski <luto@kernel.org>
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Huang Rui <ray.huang@amd.com>
Cc: Jarod Wilson <jarod@wilsonet.com>
Cc: John Stultz <john.stultz@linaro.org>
Cc: Len Brown <lenb@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: devel@driverdev.osuosl.org
Cc: kvm ML <kvm@vger.kernel.org>
Link: http://lkml.kernel.org/r/c95df47c5405b494d19d20b2852a9378c9f661f3.1434501121.git.luto@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
drivers/staging/media/lirc/lirc_serial.c | 63 ++------------------------------
1 file changed, 4 insertions(+), 59 deletions(-)
diff --git a/drivers/staging/media/lirc/lirc_serial.c b/drivers/staging/media/lirc/lirc_serial.c
index dc79844..465796a 100644
--- a/drivers/staging/media/lirc/lirc_serial.c
+++ b/drivers/staging/media/lirc/lirc_serial.c
@@ -327,9 +327,6 @@ static void safe_udelay(unsigned long usecs)
* time
*/
-/* So send_pulse can quickly convert microseconds to clocks */
-static unsigned long conv_us_to_clocks;
-
static int init_timing_params(unsigned int new_duty_cycle,
unsigned int new_freq)
{
@@ -344,7 +341,6 @@ static int init_timing_params(unsigned int new_duty_cycle,
/* How many clocks in a microsecond?, avoiding long long divide */
work = loops_per_sec;
work *= 4295; /* 4295 = 2^32 / 1e6 */
- conv_us_to_clocks = work >> 32;
/*
* Carrier period in clocks, approach good up to 32GHz clock,
@@ -357,10 +353,9 @@ static int init_timing_params(unsigned int new_duty_cycle,
pulse_width = period * duty_cycle / 100;
space_width = period - pulse_width;
dprintk("in init_timing_params, freq=%d, duty_cycle=%d, "
- "clk/jiffy=%ld, pulse=%ld, space=%ld, "
- "conv_us_to_clocks=%ld\n",
+ "clk/jiffy=%ld, pulse=%ld, space=%ld\n",
freq, duty_cycle, __this_cpu_read(cpu_info.loops_per_jiffy),
- pulse_width, space_width, conv_us_to_clocks);
+ pulse_width, space_width);
return 0;
}
#else /* ! USE_RDTSC */
@@ -431,63 +426,14 @@ static long send_pulse_irdeo(unsigned long length)
return ret;
}
-#ifdef USE_RDTSC
-/* Version that uses Pentium rdtsc instruction to measure clocks */
-
-/*
- * This version does sub-microsecond timing using rdtsc instruction,
- * and does away with the fudged LIRC_SERIAL_TRANSMITTER_LATENCY
- * Implicitly i586 architecture... - Steve
- */
-
-static long send_pulse_homebrew_softcarrier(unsigned long length)
-{
- int flag;
- unsigned long target, start, now;
-
- /* Get going quick as we can */
- rdtscl(start);
- on();
- /* Convert length from microseconds to clocks */
- length *= conv_us_to_clocks;
- /* And loop till time is up - flipping at right intervals */
- now = start;
- target = pulse_width;
- flag = 1;
- /*
- * FIXME: This looks like a hard busy wait, without even an occasional,
- * polite, cpu_relax() call. There's got to be a better way?
- *
- * The i2c code has the result of a lot of bit-banging work, I wonder if
- * there's something there which could be helpful here.
- */
- while ((now - start) < length) {
- /* Delay till flip time */
- do {
- rdtscl(now);
- } while ((now - start) < target);
-
- /* flip */
- if (flag) {
- rdtscl(now);
- off();
- target += space_width;
- } else {
- rdtscl(now); on();
- target += pulse_width;
- }
- flag = !flag;
- }
- rdtscl(now);
- return ((now - start) - length) / conv_us_to_clocks;
-}
-#else /* ! USE_RDTSC */
/* Version using udelay() */
/*
* here we use fixed point arithmetic, with 8
* fractional bits. that gets us within 0.1% or so of the right average
* frequency, albeit with some jitter in pulse length - Steve
+ *
+ * This should use ndelay instead.
*/
/* To match 8 fractional bits used for pulse/space length */
@@ -520,7 +466,6 @@ static long send_pulse_homebrew_softcarrier(unsigned long length)
}
return (actual-length) >> 8;
}
-#endif /* USE_RDTSC */
static long send_pulse_homebrew(unsigned long length)
{
next prev parent reply other threads:[~2015-07-06 15:42 UTC|newest]
Thread overview: 57+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-17 0:35 [PATCH v3 00/18] x86/tsc: Clean up rdtsc helpers Andy Lutomirski
2015-06-17 0:35 ` [PATCH v3 01/18] x86/tsc: Inline native_read_tsc and remove __native_read_tsc Andy Lutomirski
2015-06-17 9:26 ` Borislav Petkov
2015-07-06 15:39 ` [tip:x86/asm] x86/asm/tsc: Inline native_read_tsc() and remove __native_read_tsc() tip-bot for Andy Lutomirski
2015-06-17 0:35 ` [PATCH v3 02/18] x86/msr/kvm: Remove vget_cycles() Andy Lutomirski
2015-06-17 9:42 ` Borislav Petkov
2015-06-17 13:34 ` Paolo Bonzini
2015-07-06 15:40 ` [tip:x86/asm] x86/asm/tsc, kvm: " tip-bot for Andy Lutomirski
2015-06-17 0:35 ` [PATCH v3 03/18] x86/tsc/paravirt: Remove the read_tsc and read_tscp paravirt hooks Andy Lutomirski
2015-06-17 9:56 ` Borislav Petkov
2015-06-19 15:32 ` Borislav Petkov
2015-06-19 16:14 ` Andy Lutomirski
2015-06-19 17:13 ` Borislav Petkov
2015-07-06 15:40 ` [tip:x86/asm] x86/asm/tsc, x86/paravirt: Remove read_tsc() and read_tscp() " tip-bot for Andy Lutomirski
2015-06-17 0:35 ` [PATCH v3 04/18] x86/tsc: Replace rdtscll with native_read_tsc Andy Lutomirski
2015-06-17 10:03 ` Borislav Petkov
2015-07-06 15:40 ` [tip:x86/asm] x86/asm/tsc: Replace rdtscll() with native_read_tsc () tip-bot for Andy Lutomirski
2015-06-17 0:35 ` [PATCH v3 05/18] x86/tsc: Remove the rdtscp and rdtscpll macros Andy Lutomirski
2015-07-06 15:41 ` [tip:x86/asm] x86/asm/tsc: Remove the rdtscp() and rdtscpll() macros tip-bot for Andy Lutomirski
2015-06-17 0:35 ` [PATCH v3 06/18] x86/tsc: Use the full 64-bit tsc in tsc_delay Andy Lutomirski
2015-07-06 15:41 ` [tip:x86/asm] x86/asm/tsc: Use the full 64-bit TSC in delay_tsc() tip-bot for Andy Lutomirski
2015-06-17 0:35 ` [PATCH v3 07/18] x86/cpu/amd: Use the full 64-bit TSC to detect the 2.6.2 bug Andy Lutomirski
2015-07-06 15:41 ` [tip:x86/asm] x86/asm/tsc, " tip-bot for Andy Lutomirski
2015-06-17 0:35 ` [PATCH v3 08/18] baycom_epp: Replace rdtscl() with native_read_tsc() Andy Lutomirski
2015-06-17 0:49 ` Thomas Sailer
2015-06-20 13:54 ` walter harms
2015-06-20 14:14 ` Thomas Gleixner
2015-06-20 14:26 ` Andy Lutomirski
2015-06-20 16:30 ` Thomas Gleixner
2015-07-06 15:42 ` [tip:x86/asm] x86/asm/tsc, drivers/net/hamradio/baycom_epp: " tip-bot for Andy Lutomirski
2015-06-17 0:35 ` [PATCH v3 09/18] staging/lirc_serial: Remove TSC-based timing Andy Lutomirski
2015-07-06 15:42 ` tip-bot for Andy Lutomirski [this message]
2015-06-17 0:35 ` [PATCH v3 10/18] input/joystick/analog: Switch from rdtscl() to native_read_tsc() Andy Lutomirski
2015-07-06 15:42 ` [tip:x86/asm] x86/asm/tsc, " tip-bot for Andy Lutomirski
2015-06-17 0:35 ` [PATCH v3 11/18] drivers/input/gameport: Replace rdtscl() with native_read_tsc() Andy Lutomirski
2015-07-06 15:43 ` [tip:x86/asm] x86/asm/tsc, drivers/input/gameport: Replace rdtscl () " tip-bot for Andy Lutomirski
2015-06-17 0:36 ` [PATCH v3 12/18] x86/tsc: Remove rdtscl() Andy Lutomirski
2015-07-06 15:43 ` [tip:x86/asm] x86/asm/tsc: " tip-bot for Andy Lutomirski
2015-06-17 0:36 ` [PATCH v3 13/18] x86/tsc: Rename native_read_tsc() to rdtsc() Andy Lutomirski
2015-06-24 21:38 ` Borislav Petkov
2015-07-06 15:43 ` [tip:x86/asm] x86/asm/tsc: " tip-bot for Andy Lutomirski
2015-06-17 0:36 ` [PATCH v3 14/18] x86: Add rdtsc_ordered() and use it in trivial call sites Andy Lutomirski
2015-07-06 15:44 ` [tip:x86/asm] x86/asm/tsc: " tip-bot for Andy Lutomirski
2015-08-21 7:45 ` [tip:x86/asm] x86/asm/tsc: Add rdtscll() merge helper tip-bot for Ingo Molnar
2015-06-17 0:36 ` [PATCH v3 15/18] x86/tsc: Use rdtsc_ordered() in check_tsc_warp() and drop extra barriers Andy Lutomirski
2015-07-06 15:44 ` [tip:x86/asm] x86/asm/tsc/sync: " tip-bot for Andy Lutomirski
2015-06-17 0:36 ` [PATCH v3 16/18] x86/tsc: In read_tsc, use rdtsc_ordered() instead of get_cycles() Andy Lutomirski
2015-07-06 15:44 ` [tip:x86/asm] x86/asm/tsc: Use rdtsc_ordered() in read_tsc() " tip-bot for Andy Lutomirski
2015-06-17 0:36 ` [PATCH v3 17/18] x86/kvm/tsc: Drop extra barrier and use rdtsc_ordered in kvmclock Andy Lutomirski
2015-06-17 7:47 ` Paolo Bonzini
2015-06-17 13:31 ` Paolo Bonzini
2015-06-20 21:50 ` Borislav Petkov
2015-07-06 15:45 ` [tip:x86/asm] x86/asm/tsc, x86/kvm: Drop open-coded barrier and use rdtsc_ordered() " tip-bot for Andy Lutomirski
2015-06-17 0:36 ` [PATCH v3 18/18] x86/tsc: Remove rdtsc_barrier() Andy Lutomirski
2015-07-06 15:45 ` [tip:x86/asm] x86/asm/tsc: " tip-bot for Andy Lutomirski
2015-06-17 11:11 ` [PATCH v3 00/18] x86/tsc: Clean up rdtsc helpers Borislav Petkov
2015-06-17 13:37 ` Paolo Bonzini
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=tip-3a2c16c8489d967de10b3b7f5cc0f7cab4337770@git.kernel.org \
--to=tipbot@zytor.com \
--cc=bp@alien8.de \
--cc=bp@suse.de \
--cc=brgerst@gmail.com \
--cc=dvlasenk@redhat.com \
--cc=gregkh@linuxfoundation.org \
--cc=hpa@zytor.com \
--cc=jarod@wilsonet.com \
--cc=john.stultz@linaro.org \
--cc=kvm@vger.kernel.org \
--cc=lenb@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=luto@kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=ralf@linux-mips.org \
--cc=ray.huang@amd.com \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.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;
as well as URLs for NNTP newsgroup(s).