linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Len Brown <lenb@kernel.org>
To: x86@kernel.org
Cc: linux-kernel@vger.kernel.org,
	linux-pm@lists.linux-foundation.org,
	Len Brown <len.brown@intel.com>
Subject: [PATCH 4/9] x86 idle floppy: delete disable_hlt()/enable_hlt()
Date: Thu, 31 Mar 2011 02:03:19 -0400	[thread overview]
Message-ID: <fb07f62522099f5d3f2b7aa6014329d716081b62.1301550524.git.len.brown@intel.com> (raw)
In-Reply-To: <1301551404-8263-1-git-send-email-lenb@kernel.org>
In-Reply-To: <67e90d97e0a77df4acd0c75e1bacc7714e011f3e.1301550524.git.len.brown@intel.com>

From: Len Brown <len.brown@intel.com>

The X86_32-only disable_hlt/enable_hlt mechanism was used
by the 32-bit floppy driver.  Its effect was to replace
the use of the HLT instruction inside default_idle() with
cpu_relax().

Unlcear why this workaround was ever needed, it was commented:

floppy.c said:

"disable hlt during certain critical i/o operations"

x86/kernel/process.c said:

"This halt magic was a workaround for ancient floppy DMA
 wreckage. It should be safe to remove."

So remove it, as it allows us to simplify the x86 idle code.

Signed-off-by: Len Brown <len.brown@intel.com>
---
 arch/x86/include/asm/system.h |    7 -------
 arch/x86/kernel/process.c     |   24 ------------------------
 drivers/block/floppy.c        |   35 -----------------------------------
 3 files changed, 0 insertions(+), 66 deletions(-)

diff --git a/arch/x86/include/asm/system.h b/arch/x86/include/asm/system.h
index 33ecc3e..013dd42 100644
--- a/arch/x86/include/asm/system.h
+++ b/arch/x86/include/asm/system.h
@@ -93,10 +93,6 @@ do {									\
 			"memory");					\
 } while (0)
 
-/*
- * disable hlt during certain critical i/o operations
- */
-#define HAVE_DISABLE_HLT
 #else
 #define __SAVE(reg, offset) "movq %%" #reg ",(14-" #offset ")*8(%%rsp)\n\t"
 #define __RESTORE(reg, offset) "movq (14-" #offset ")*8(%%rsp),%%" #reg "\n\t"
@@ -337,9 +333,6 @@ static inline void clflush(volatile void *__p)
 
 #define nop() asm volatile ("nop")
 
-void disable_hlt(void);
-void enable_hlt(void);
-
 void cpu_idle_wait(void);
 
 extern unsigned long arch_align_stack(unsigned long sp);
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index cd461c3..8688ade 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -342,34 +342,10 @@ EXPORT_SYMBOL(boot_option_idle_override);
 void (*pm_idle)(void);
 EXPORT_SYMBOL(pm_idle);
 
-#ifdef CONFIG_X86_32
-/*
- * This halt magic was a workaround for ancient floppy DMA
- * wreckage. It should be safe to remove.
- */
-static int hlt_counter;
-void disable_hlt(void)
-{
-	hlt_counter++;
-}
-EXPORT_SYMBOL(disable_hlt);
-
-void enable_hlt(void)
-{
-	hlt_counter--;
-}
-EXPORT_SYMBOL(enable_hlt);
-
-static inline int hlt_use_halt(void)
-{
-	return (!hlt_counter);
-}
-#else
 static inline int hlt_use_halt(void)
 {
 	return 1;
 }
-#endif
 
 /*
  * We use this if we don't have any better
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index 77fc76f..9a4e006 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -1032,36 +1032,6 @@ static int fd_wait_for_completion(unsigned long delay, timeout_fn function)
 	return 0;
 }
 
-static DEFINE_SPINLOCK(floppy_hlt_lock);
-static int hlt_disabled;
-static void floppy_disable_hlt(void)
-{
-	unsigned long flags;
-
-	spin_lock_irqsave(&floppy_hlt_lock, flags);
-	if (!hlt_disabled) {
-		hlt_disabled = 1;
-#ifdef HAVE_DISABLE_HLT
-		disable_hlt();
-#endif
-	}
-	spin_unlock_irqrestore(&floppy_hlt_lock, flags);
-}
-
-static void floppy_enable_hlt(void)
-{
-	unsigned long flags;
-
-	spin_lock_irqsave(&floppy_hlt_lock, flags);
-	if (hlt_disabled) {
-		hlt_disabled = 0;
-#ifdef HAVE_DISABLE_HLT
-		enable_hlt();
-#endif
-	}
-	spin_unlock_irqrestore(&floppy_hlt_lock, flags);
-}
-
 static void setup_DMA(void)
 {
 	unsigned long f;
@@ -1106,7 +1076,6 @@ static void setup_DMA(void)
 	fd_enable_dma();
 	release_dma_lock(f);
 #endif
-	floppy_disable_hlt();
 }
 
 static void show_floppy(void);
@@ -1708,7 +1677,6 @@ irqreturn_t floppy_interrupt(int irq, void *dev_id)
 	fd_disable_dma();
 	release_dma_lock(f);
 
-	floppy_enable_hlt();
 	do_floppy = NULL;
 	if (fdc >= N_FDC || FDCS->address == -1) {
 		/* we don't even know which FDC is the culprit */
@@ -1857,8 +1825,6 @@ static void floppy_shutdown(unsigned long data)
 		show_floppy();
 	cancel_activity();
 
-	floppy_enable_hlt();
-
 	flags = claim_dma_lock();
 	fd_disable_dma();
 	release_dma_lock(flags);
@@ -4503,7 +4469,6 @@ static void floppy_release_irq_and_dma(void)
 #if N_FDC > 1
 	set_dor(1, ~8, 0);
 #endif
-	floppy_enable_hlt();
 
 	if (floppy_track_buffer && max_buffer_sectors) {
 		tmpsize = max_buffer_sectors * 1024;
-- 
1.7.4.2.406.gbe91


  parent reply	other threads:[~2011-03-31  6:05 UTC|newest]

Thread overview: 75+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-24  7:08 [PATCH 0/5] x86 idle cruft removal Len Brown
2011-03-24  7:08 ` [PATCH 1/5] x86 idle: remove "no-hlt" cmdline param Len Brown
2011-03-24  7:08   ` [PATCH 2/5] x86 idle: remove NOP cpuinfo_x86.hlt_works_ok flag Len Brown
2011-03-24  7:08   ` [PATCH 3/5] x86 idle: remove NOP halt_works() Len Brown
2011-03-24  7:08   ` [PATCH 4/5] x86 idle floppy: delete disable_hlt()/enable_hlt() Len Brown
2011-03-24 15:58     ` Andi Kleen
2011-03-24  7:08   ` [PATCH 5/5] x86 idle: remove NOP hlt_use_halt() Len Brown
2011-03-25 19:02     ` [linux-pm] " Vaidyanathan Srinivasan
2011-03-31  6:03 ` [PATCH 0/9] x86 idle cruft removal - v2 Len Brown
2011-03-31  6:03   ` [PATCH 1/9] x86 idle: remove "no-hlt" cmdline param Len Brown
2011-03-31  6:03     ` [PATCH 2/9] x86 idle: remove NOP cpuinfo_x86.hlt_works_ok flag Len Brown
2011-03-31  6:12       ` Ingo Molnar
2011-03-31  7:02         ` Len Brown
2011-03-31  8:18           ` Ingo Molnar
2011-03-31  9:23             ` Alan Cox
2011-03-31  9:27               ` Ingo Molnar
2011-03-31  9:33                 ` Alan Cox
2011-03-31  9:35                   ` Ingo Molnar
2011-03-31 14:19                     ` H. Peter Anvin
2011-03-31 14:41                       ` Alan Cox
2011-03-31 15:09                         ` H. Peter Anvin
2011-03-31 18:07             ` Len Brown
2011-03-31 18:28               ` H. Peter Anvin
2011-03-31  6:03     ` [PATCH 3/9] x86 idle: remove NOP halt_works() Len Brown
2011-03-31  6:03     ` Len Brown [this message]
2011-03-31  6:03     ` [PATCH 5/9] x86 idle: remove NOP hlt_use_halt() Len Brown
2011-03-31  6:03     ` [PATCH 6/9] x86 idle APM: delete apm_cpu_idle(), and its use of (pm_idle)() Len Brown
2011-03-31  6:03     ` [PATCH 7/9] x86 idle: do not EXPORT_SYMBOL pm_idle and default_idle Len Brown
2011-03-31  6:03     ` [PATCH 8/9] x86 idle: move mwait_idle_with_hints() to where it is used Len Brown
2011-03-31  6:03     ` [PATCH 9/9] x86 idle: delete mwait_idle() Len Brown
2011-04-01 11:02       ` Andreas Herrmann
2011-03-31  6:39   ` [linux-pm] [PATCH 0/9] x86 idle cruft removal - v2 Trinabh Gupta
2011-03-31  7:21     ` Len Brown
2011-03-31  9:45   ` Alan Cox
2011-03-31 10:28     ` Ingo Molnar
2011-04-01  4:24   ` Len Brown
2011-04-01  9:38     ` [linux-pm] " Trinabh Gupta
2011-04-01 18:33       ` Len Brown
2011-04-02  6:22     ` idle cleanup - v3 Len Brown
2011-04-02  6:22       ` [PATCH 01/18] cpuidle: menu: fixed wrapping timers at 4.294 seconds Len Brown
2011-04-02  6:22         ` [PATCH 02/18] x86 idle floppy: deprecate disable_hlt() Len Brown
2011-04-02  6:22         ` [PATCH 03/18] x86 idle APM: deprecate CONFIG_APM_CPU_IDLE Len Brown
2011-04-02 11:28           ` Alan Cox
2011-04-02 18:28             ` Len Brown
2011-04-02 19:44               ` Alan Cox
2011-04-08  6:22               ` Pavel Machek
2011-04-02  6:22         ` [PATCH 04/18] x86 idle: EXPORT_SYMBOL(default_idle, pm_idle) only when APM demands it Len Brown
2011-04-02 11:28           ` Alan Cox
2011-04-02 12:21             ` [linux-pm] " Trinabh Gupta
2011-04-02  6:22         ` [PATCH 05/18] x86 idle: deprecate "no-hlt" cmdline param Len Brown
2011-04-02  6:22         ` [PATCH 06/18] x86 idle: deprecate mwait_idle() and "idle=mwait" " Len Brown
2011-04-02  6:22         ` [PATCH 07/18] x86 idle: clarify AMD erratum 400 workaround Len Brown
2011-04-02  8:23           ` Borislav Petkov
2011-04-02 19:19             ` Len Brown
2011-04-02 19:22               ` [PATCH 07/18] x86 idle: clarify AMD erratum 400 workaround -v2 Len Brown
2011-04-03  9:00                 ` Borislav Petkov
2011-04-02  6:22         ` [PATCH 08/18] cpuidle: create bootparam "cpuidle.off=1" Len Brown
2011-07-15 11:27           ` [linux-pm] " Deepthi Dharwar
2011-04-02  6:22         ` [PATCH 09/18] cpuidle: replace xen access to x86 pm_idle and default_idle Len Brown
2011-04-04 15:33           ` [Xen-devel] " Konrad Rzeszutek Wilk
2011-04-02  6:22         ` [PATCH 10/18] x86 idle: move mwait_idle_with_hints() to where it is used Len Brown
2011-04-02  6:22         ` [PATCH 11/18] cpuidle: stop using pm_idle Len Brown
2011-04-25 10:41           ` [linux-pm] " Trinabh Gupta
2011-04-02  6:22         ` [PATCH 12/18] 2.6.40: x86 idle: remove deprecated "no-hlt" cmdline param Len Brown
2011-04-02  6:22         ` [PATCH 13/18] 2.6.40: x86 idle: remove deprecated "hlt_bug: no" in 32-bit /proc/cpuinfo Len Brown
2011-04-02  6:22         ` [PATCH 14/18] 2.6.40: x86 idle floppy: remove deprecated disable_hlt()/enable_hlt() Len Brown
2011-04-02  6:22         ` [PATCH 15/18] 2.6.40: x86 idle: remove deprecated hlt_use_halt() Len Brown
2011-04-02  6:22         ` [PATCH 16/18] 2.6.40: x86 idle APM: remove deprecated apm_cpu_idle() Len Brown
2011-04-02 11:40           ` Alan Cox
2011-04-02 19:44             ` Len Brown
2011-04-02 21:00               ` Alan Cox
2011-04-03  2:48                 ` [linux-pm] " Trinabh Gupta
2011-04-04 10:05                   ` Alan Cox
2011-04-02  6:22         ` [PATCH 17/18] 2.6.40: x86 idle: do not export default_idle() and (pm_idle)() Len Brown
2011-04-02  6:23         ` [PATCH 18/18] 2.6.40: x86 idle: remove deprecated mwait_idle() Len Brown

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=fb07f62522099f5d3f2b7aa6014329d716081b62.1301550524.git.len.brown@intel.com \
    --to=lenb@kernel.org \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=x86@kernel.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).