Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'for-linus-4.4' of git://git.code.sf.net/p/openipmi/linux-ipmi

Pull IPMI updates from Corey Minyard:
"Some fixes for small IPMI problems.

The most significant is that the driver wasn't starting the timer for
some messages, which would result in problems if that message failed
for some reason.

The others are small optimizations or making things a little neater"

* tag 'for-linus-4.4' of git://git.code.sf.net/p/openipmi/linux-ipmi:
ipmi watchdog : add panic_wdt_timeout parameter
char: ipmi: Move MODULE_DEVICE_TABLE() to follow struct
ipmi: Stop the timer immediately if idle
ipmi: Start the timer and thread on internal msgs

+64 -33
+5 -2
Documentation/IPMI.txt
··· 587 587 588 588 modprobe ipmi_watchdog timeout=<t> pretimeout=<t> action=<action type> 589 589 preaction=<preaction type> preop=<preop type> start_now=x 590 - nowayout=x ifnum_to_use=n 590 + nowayout=x ifnum_to_use=n panic_wdt_timeout=<t> 591 591 592 592 ifnum_to_use specifies which interface the watchdog timer should use. 593 593 The default is -1, which means to pick the first one registered. ··· 597 597 occur (if pretimeout is zero, then pretimeout will not be enabled). Note 598 598 that the pretimeout is the time before the final timeout. So if the 599 599 timeout is 50 seconds and the pretimeout is 10 seconds, then the pretimeout 600 - will occur in 40 second (10 seconds before the timeout). 600 + will occur in 40 second (10 seconds before the timeout). The panic_wdt_timeout 601 + is the value of timeout which is set on kernel panic, in order to let actions 602 + such as kdump to occur during panic. 601 603 602 604 The action may be "reset", "power_cycle", or "power_off", and 603 605 specifies what to do when the timer times out, and defaults to ··· 636 634 ipmi_watchdog.preop=<preop type> 637 635 ipmi_watchdog.start_now=x 638 636 ipmi_watchdog.nowayout=x 637 + ipmi_watchdog.panic_wdt_timeout=<t> 639 638 640 639 The options are the same as the module parameter options. 641 640
+52 -30
drivers/char/ipmi/ipmi_si_intf.c
··· 412 412 return rv; 413 413 } 414 414 415 - static void start_check_enables(struct smi_info *smi_info) 415 + static void smi_mod_timer(struct smi_info *smi_info, unsigned long new_val) 416 + { 417 + smi_info->last_timeout_jiffies = jiffies; 418 + mod_timer(&smi_info->si_timer, new_val); 419 + smi_info->timer_running = true; 420 + } 421 + 422 + /* 423 + * Start a new message and (re)start the timer and thread. 424 + */ 425 + static void start_new_msg(struct smi_info *smi_info, unsigned char *msg, 426 + unsigned int size) 427 + { 428 + smi_mod_timer(smi_info, jiffies + SI_TIMEOUT_JIFFIES); 429 + 430 + if (smi_info->thread) 431 + wake_up_process(smi_info->thread); 432 + 433 + smi_info->handlers->start_transaction(smi_info->si_sm, msg, size); 434 + } 435 + 436 + static void start_check_enables(struct smi_info *smi_info, bool start_timer) 416 437 { 417 438 unsigned char msg[2]; 418 439 419 440 msg[0] = (IPMI_NETFN_APP_REQUEST << 2); 420 441 msg[1] = IPMI_GET_BMC_GLOBAL_ENABLES_CMD; 421 442 422 - smi_info->handlers->start_transaction(smi_info->si_sm, msg, 2); 443 + if (start_timer) 444 + start_new_msg(smi_info, msg, 2); 445 + else 446 + smi_info->handlers->start_transaction(smi_info->si_sm, msg, 2); 423 447 smi_info->si_state = SI_CHECKING_ENABLES; 424 448 } 425 449 426 - static void start_clear_flags(struct smi_info *smi_info) 450 + static void start_clear_flags(struct smi_info *smi_info, bool start_timer) 427 451 { 428 452 unsigned char msg[3]; 429 453 ··· 456 432 msg[1] = IPMI_CLEAR_MSG_FLAGS_CMD; 457 433 msg[2] = WDT_PRE_TIMEOUT_INT; 458 434 459 - smi_info->handlers->start_transaction(smi_info->si_sm, msg, 3); 435 + if (start_timer) 436 + start_new_msg(smi_info, msg, 3); 437 + else 438 + smi_info->handlers->start_transaction(smi_info->si_sm, msg, 3); 460 439 smi_info->si_state = SI_CLEARING_FLAGS; 461 440 } 462 441 ··· 469 442 smi_info->curr_msg->data[1] = IPMI_GET_MSG_CMD; 470 443 smi_info->curr_msg->data_size = 2; 471 444 472 - smi_info->handlers->start_transaction( 473 - smi_info->si_sm, 474 - smi_info->curr_msg->data, 475 - smi_info->curr_msg->data_size); 445 + start_new_msg(smi_info, smi_info->curr_msg->data, 446 + smi_info->curr_msg->data_size); 476 447 smi_info->si_state = SI_GETTING_MESSAGES; 477 448 } 478 449 ··· 480 455 smi_info->curr_msg->data[1] = IPMI_READ_EVENT_MSG_BUFFER_CMD; 481 456 smi_info->curr_msg->data_size = 2; 482 457 483 - smi_info->handlers->start_transaction( 484 - smi_info->si_sm, 485 - smi_info->curr_msg->data, 486 - smi_info->curr_msg->data_size); 458 + start_new_msg(smi_info, smi_info->curr_msg->data, 459 + smi_info->curr_msg->data_size); 487 460 smi_info->si_state = SI_GETTING_EVENTS; 488 - } 489 - 490 - static void smi_mod_timer(struct smi_info *smi_info, unsigned long new_val) 491 - { 492 - smi_info->last_timeout_jiffies = jiffies; 493 - mod_timer(&smi_info->si_timer, new_val); 494 - smi_info->timer_running = true; 495 461 } 496 462 497 463 /* ··· 494 478 * Note that we cannot just use disable_irq(), since the interrupt may 495 479 * be shared. 496 480 */ 497 - static inline bool disable_si_irq(struct smi_info *smi_info) 481 + static inline bool disable_si_irq(struct smi_info *smi_info, bool start_timer) 498 482 { 499 483 if ((smi_info->irq) && (!smi_info->interrupt_disabled)) { 500 484 smi_info->interrupt_disabled = true; 501 - start_check_enables(smi_info); 485 + start_check_enables(smi_info, start_timer); 502 486 return true; 503 487 } 504 488 return false; ··· 508 492 { 509 493 if ((smi_info->irq) && (smi_info->interrupt_disabled)) { 510 494 smi_info->interrupt_disabled = false; 511 - start_check_enables(smi_info); 495 + start_check_enables(smi_info, true); 512 496 return true; 513 497 } 514 498 return false; ··· 526 510 527 511 msg = ipmi_alloc_smi_msg(); 528 512 if (!msg) { 529 - if (!disable_si_irq(smi_info)) 513 + if (!disable_si_irq(smi_info, true)) 530 514 smi_info->si_state = SI_NORMAL; 531 515 } else if (enable_si_irq(smi_info)) { 532 516 ipmi_free_smi_msg(msg); ··· 542 526 /* Watchdog pre-timeout */ 543 527 smi_inc_stat(smi_info, watchdog_pretimeouts); 544 528 545 - start_clear_flags(smi_info); 529 + start_clear_flags(smi_info, true); 546 530 smi_info->msg_flags &= ~WDT_PRE_TIMEOUT_INT; 547 531 if (smi_info->intf) 548 532 ipmi_smi_watchdog_pretimeout(smi_info->intf); ··· 895 879 msg[0] = (IPMI_NETFN_APP_REQUEST << 2); 896 880 msg[1] = IPMI_GET_MSG_FLAGS_CMD; 897 881 898 - smi_info->handlers->start_transaction( 899 - smi_info->si_sm, msg, 2); 882 + start_new_msg(smi_info, msg, 2); 900 883 smi_info->si_state = SI_GETTING_FLAGS; 901 884 goto restart; 902 885 } ··· 925 910 * disable and messages disabled. 926 911 */ 927 912 if (smi_info->supports_event_msg_buff || smi_info->irq) { 928 - start_check_enables(smi_info); 913 + start_check_enables(smi_info, true); 929 914 } else { 930 915 smi_info->curr_msg = alloc_msg_handle_irq(smi_info); 931 916 if (!smi_info->curr_msg) ··· 935 920 } 936 921 goto restart; 937 922 } 923 + 924 + if (si_sm_result == SI_SM_IDLE && smi_info->timer_running) { 925 + /* Ok it if fails, the timer will just go off. */ 926 + if (del_timer(&smi_info->si_timer)) 927 + smi_info->timer_running = false; 928 + } 929 + 938 930 out: 939 931 return si_sm_result; 940 932 } ··· 2582 2560 .data = (void *)(unsigned long) SI_BT }, 2583 2561 {}, 2584 2562 }; 2563 + MODULE_DEVICE_TABLE(of, of_ipmi_match); 2585 2564 2586 2565 static int of_ipmi_probe(struct platform_device *dev) 2587 2566 { ··· 2669 2646 } 2670 2647 return 0; 2671 2648 } 2672 - MODULE_DEVICE_TABLE(of, of_ipmi_match); 2673 2649 #else 2674 2650 #define of_ipmi_match NULL 2675 2651 static int of_ipmi_probe(struct platform_device *dev) ··· 3635 3613 * Start clearing the flags before we enable interrupts or the 3636 3614 * timer to avoid racing with the timer. 3637 3615 */ 3638 - start_clear_flags(new_smi); 3616 + start_clear_flags(new_smi, false); 3639 3617 3640 3618 /* 3641 3619 * IRQ is defined to be set when non-zero. req_events will ··· 3930 3908 poll(to_clean); 3931 3909 schedule_timeout_uninterruptible(1); 3932 3910 } 3933 - disable_si_irq(to_clean); 3911 + disable_si_irq(to_clean, false); 3934 3912 while (to_clean->curr_msg || (to_clean->si_state != SI_NORMAL)) { 3935 3913 poll(to_clean); 3936 3914 schedule_timeout_uninterruptible(1);
+7 -1
drivers/char/ipmi/ipmi_watchdog.c
··· 153 153 /* The pre-timeout is disabled by default. */ 154 154 static int pretimeout; 155 155 156 + /* Default timeout to set on panic */ 157 + static int panic_wdt_timeout = 255; 158 + 156 159 /* Default action is to reset the board on a timeout. */ 157 160 static unsigned char action_val = WDOG_TIMEOUT_RESET; 158 161 ··· 295 292 296 293 module_param(pretimeout, timeout, 0644); 297 294 MODULE_PARM_DESC(pretimeout, "Pretimeout value in seconds."); 295 + 296 + module_param(panic_wdt_timeout, timeout, 0644); 297 + MODULE_PARM_DESC(timeout, "Timeout value on kernel panic in seconds."); 298 298 299 299 module_param_cb(action, &param_ops_str, action_op, 0644); 300 300 MODULE_PARM_DESC(action, "Timeout action. One of: " ··· 1195 1189 /* Make sure we do this only once. */ 1196 1190 panic_event_handled = 1; 1197 1191 1198 - timeout = 255; 1192 + timeout = panic_wdt_timeout; 1199 1193 pretimeout = 0; 1200 1194 panic_halt_ipmi_set_timeout(); 1201 1195 }