aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ia64/kernel/unaligned.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/ia64/kernel/unaligned.c')
-rw-r--r--arch/ia64/kernel/unaligned.c24
1 files changed, 5 insertions, 19 deletions
diff --git a/arch/ia64/kernel/unaligned.c b/arch/ia64/kernel/unaligned.c
index 776dd40397e2..622772b7fb6c 100644
--- a/arch/ia64/kernel/unaligned.c
+++ b/arch/ia64/kernel/unaligned.c
@@ -17,6 +17,7 @@
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/sched.h> 18#include <linux/sched.h>
19#include <linux/tty.h> 19#include <linux/tty.h>
20#include <linux/ratelimit.h>
20 21
21#include <asm/intrinsics.h> 22#include <asm/intrinsics.h>
22#include <asm/processor.h> 23#include <asm/processor.h>
@@ -1283,24 +1284,9 @@ emulate_store_float (unsigned long ifa, load_store_t ld, struct pt_regs *regs)
1283/* 1284/*
1284 * Make sure we log the unaligned access, so that user/sysadmin can notice it and 1285 * Make sure we log the unaligned access, so that user/sysadmin can notice it and
1285 * eventually fix the program. However, we don't want to do that for every access so we 1286 * eventually fix the program. However, we don't want to do that for every access so we
1286 * pace it with jiffies. This isn't really MP-safe, but it doesn't really have to be 1287 * pace it with jiffies.
1287 * either...
1288 */ 1288 */
1289static int 1289static DEFINE_RATELIMIT_STATE(logging_rate_limit, 5 * HZ, 5);
1290within_logging_rate_limit (void)
1291{
1292 static unsigned long count, last_time;
1293
1294 if (time_after(jiffies, last_time + 5 * HZ))
1295 count = 0;
1296 if (count < 5) {
1297 last_time = jiffies;
1298 count++;
1299 return 1;
1300 }
1301 return 0;
1302
1303}
1304 1290
1305void 1291void
1306ia64_handle_unaligned (unsigned long ifa, struct pt_regs *regs) 1292ia64_handle_unaligned (unsigned long ifa, struct pt_regs *regs)
@@ -1337,7 +1323,7 @@ ia64_handle_unaligned (unsigned long ifa, struct pt_regs *regs)
1337 1323
1338 if (!no_unaligned_warning && 1324 if (!no_unaligned_warning &&
1339 !(current->thread.flags & IA64_THREAD_UAC_NOPRINT) && 1325 !(current->thread.flags & IA64_THREAD_UAC_NOPRINT) &&
1340 within_logging_rate_limit()) 1326 __ratelimit(&logging_rate_limit))
1341 { 1327 {
1342 char buf[200]; /* comm[] is at most 16 bytes... */ 1328 char buf[200]; /* comm[] is at most 16 bytes... */
1343 size_t len; 1329 size_t len;
@@ -1370,7 +1356,7 @@ ia64_handle_unaligned (unsigned long ifa, struct pt_regs *regs)
1370 } 1356 }
1371 } 1357 }
1372 } else { 1358 } else {
1373 if (within_logging_rate_limit()) { 1359 if (__ratelimit(&logging_rate_limit)) {
1374 printk(KERN_WARNING "kernel unaligned access to 0x%016lx, ip=0x%016lx\n", 1360 printk(KERN_WARNING "kernel unaligned access to 0x%016lx, ip=0x%016lx\n",
1375 ifa, regs->cr_iip + ipsr->ri); 1361 ifa, regs->cr_iip + ipsr->ri);
1376 if (unaligned_dump_stack) 1362 if (unaligned_dump_stack)