Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 310406 Details for
Bug 430452
kernel hangs when hitting sysrq-w repeatedly
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
sysrq-w deadlock fix patch
linux-2.6.9-sysrq-w-deadlock-fix.patch (text/plain), 4.90 KB, created by
Makito SHIOKAWA
on 2008-06-27 01:59:35 UTC
(
hide
)
Description:
sysrq-w deadlock fix patch
Filename:
MIME Type:
Creator:
Makito SHIOKAWA
Created:
2008-06-27 01:59:35 UTC
Size:
4.90 KB
patch
obsolete
>--- linux-2.6.9/include/linux/smp.h.orig 2008-01-31 20:04:55.000000000 +0900 >+++ linux-2.6.9/include/linux/smp.h 2008-01-31 20:56:34.000000000 +0900 >@@ -53,6 +53,10 @@ extern void smp_cpus_done(unsigned int m > */ > extern int smp_call_function (void (*func) (void *info), void *info, > int retry, int wait); >+#if defined(__i386__) || defined(__x86_64__) >+extern int smp_call_function_trylock (void (*func) (void *info), void *info, >+ int retry, int wait); >+#endif > extern void dump_smp_call_function (void (*func) (void *info), void *info); > > /* >@@ -101,6 +105,9 @@ void smp_prepare_boot_cpu(void); > > #define smp_threads_ready 1 > #define smp_call_function(func,info,retry,wait) ({ 0; }) >+#if defined(__i386__) || defined(__x86_64__) >+#define smp_call_function_trylock(func,info,retry,wait) ({ 0; }) >+#endif > static inline void dump_smp_call_function(void (*func) (void *info), void *info) { } > #define on_each_cpu(func,info,retry,wait) ({ func(info); 0; }) > static inline void smp_send_reschedule(int cpu) { } >--- linux-2.6.9/arch/i386/kernel/smp.c.orig 2008-01-31 20:05:02.000000000 +0900 >+++ linux-2.6.9/arch/i386/kernel/smp.c 2008-01-31 20:56:58.000000000 +0900 >@@ -634,6 +634,64 @@ int smp_call_function (void (*func) (voi > return 0; > } > >+/* >+ * This function is copy of smp_call_function() which uses spin_trylock() >+ * instead of spin_lock(). >+ * Returns -EBUSY on failure of getting call_lock. >+ */ >+ >+int smp_call_function_trylock (void (*func) (void *info), void *info, int nonatomic, >+ int wait) >+/* >+ * [SUMMARY] Run a function on all other CPUs. >+ * <func> The function to run. This must be fast and non-blocking. >+ * <info> An arbitrary pointer to pass to the function. >+ * <nonatomic> currently unused. >+ * <wait> If true, wait (atomically) until function has complete on other CPUs. >+ * [RETURNS] 0 on success, else a negative status code on failure of getting >+ * call_lock. >+ * >+ * You must not call this function with disabled interrupts or from a >+ * hardware interrupt handler or from a bottom half handler. >+ */ >+{ >+ struct call_data_struct data; >+ int cpus = num_online_cpus()-1; >+ >+ if (!cpus) >+ return 0; >+ >+ /* Can deadlock when called with interrupts disabled */ >+ /* Only if we are waiting for other CPU to ack */ >+ WARN_ON(irqs_disabled() && wait >= 0); >+ >+ data.func = func; >+ data.info = info; >+ atomic_set(&data.started, 0); >+ data.wait = wait; >+ if (wait) >+ atomic_set(&data.finished, 0); >+ >+ if (!spin_trylock(&call_lock)) >+ return -EBUSY; >+ call_data = &data; >+ mb(); >+ >+ /* Send a message to all other CPUs and wait for them to respond */ >+ send_IPI_allbutself(CALL_FUNCTION_VECTOR); >+ >+ /* Wait for response */ >+ while (atomic_read(&data.started) != cpus) >+ cpu_relax(); >+ >+ if (wait) >+ while (atomic_read(&data.finished) != cpus) >+ cpu_relax(); >+ spin_unlock(&call_lock); >+ >+ return 0; >+} >+ > static void stop_this_cpu (void * dummy) > { > /* >--- linux-2.6.9/arch/x86_64/kernel/smp.c.orig 2008-01-31 20:05:47.000000000 +0900 >+++ linux-2.6.9/arch/x86_64/kernel/smp.c 2008-01-31 20:57:20.000000000 +0900 >@@ -399,6 +399,36 @@ int smp_call_function (void (*func) (voi > return 0; > } > >+/* >+ * This function is copy of smp_call_function() which uses spin_trylock() >+ * instead of spin_lock(). >+ * Returns -EBUSY on failure of getting call_lock. >+ */ >+ >+/* >+ * smp_call_function_trylock - run a function on all other CPUs. >+ * @func: The function to run. This must be fast and non-blocking. >+ * @info: An arbitrary pointer to pass to the function. >+ * @nonatomic: currently unused. >+ * <wait> If true, wait (atomically) until function has complete on other CPUs. >+ * >+ * Returns 0 on success, else a negative status code on failure of getting >+ * call_lock. >+ * >+ * You must not call this function with disabled interrupts or from a >+ * hardware interrupt handler or from a bottom half handler. >+ * Actually there are a few legal cases, like panic. >+ */ >+int smp_call_function_trylock (void (*func) (void *info), void *info, int nonatomic, >+ int wait) >+{ >+ if (!spin_trylock(&call_lock)) >+ return -EBUSY; >+ __smp_call_function(func,info,nonatomic,wait); >+ spin_unlock(&call_lock); >+ return 0; >+} >+ > void smp_stop_cpu(void) > { > /* >--- linux-2.6.9/drivers/char/sysrq.c.orig 2008-01-31 20:05:52.000000000 +0900 >+++ linux-2.6.9/drivers/char/sysrq.c 2008-01-31 20:57:28.000000000 +0900 >@@ -196,7 +196,15 @@ static void showacpu(void *info) > static void sysrq_handle_showcpus(int key, struct pt_regs *pt_regs, > struct tty_struct *tty) { > showacpu(NULL); >+#if defined(__i386__) || defined(__x86_64__) >+ /* Call copy of smp_call_function() which uses spin_trylock() >+ instead of spin_lock() to avoid deadlock between other >+ smp_call_function() call */ >+ if (smp_call_function_trylock(showacpu, NULL, 0, 0) == -EBUSY) >+ printk("SysRq : Show CPUs aborted to avoid deadlock, please try again.\n"); >+#else > smp_call_function(showacpu, NULL, 0, 0); >+#endif > } > static struct sysrq_key_op sysrq_showcpus_op = { > handler: sysrq_handle_showcpus,
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 430452
:
307045
| 310406