[PATCH] hpsa.c: bug using smp_processor_id() in preemptible code

From: Felipe Damasio
Date: Thu Apr 28 2016 - 15:17:09 EST


Hi,

We're using your driver on a HP ProLiant DL360 Gen9, but we keep getting flooded with the following BUG.

BUG: using smp_processor_id() in preemptible [00000000] code: splice-io/6/3248
caller is debug_smp_processor_id+0x17/0x1c
CPU: 4 PID: 3248 Comm: splice-io/6 Not tainted 4.4.8-hyper #1
Hardware name: HP ProLiant DL360 Gen9, BIOS P89 03/05/2015
0000000000000000 ffff88046ee4b768 ffffffff812abb0f 0000000000000004
ffff8804602560c0 ffff88046ee4b798 ffffffff812c234d ffff880078d60000
ffff880463802700 ffff880463702080 ffff880078d60000 ffff88046ee4b7a8
Call Trace:
[<ffffffff812abb0f>] dump_stack+0x4f/0x68
[<ffffffff812c234d>] check_preemption_disabled+0xcd/0xdf
[<ffffffff812c238b>] debug_smp_processor_id+0x17/0x1c
[<ffffffff81714794>] __enqueue_cmd_and_start_io+0xce/0x1d4
[<ffffffff817167b8>] enqueue_cmd_and_start_io+0x35/0x37
[<ffffffff81716d13>] hpsa_scsi_ioaccel_queue_command+0x559/0x56b
[<ffffffff81717306>] hpsa_ioaccel_submit.isra.76+0x5e1/0x5fa
[<ffffffff81082ec6>] ? round_jiffies_up+0x15/0x17
[<ffffffff8171786b>] hpsa_scsi_queue_command+0x15b/0x1aa
[<ffffffff8160f186>] scsi_dispatch_cmd+0x95/0xc3
[<ffffffff81611681>] scsi_request_fn+0x211/0x2a4
[<ffffffff81291fa7>] __blk_run_queue_uncond+0x23/0x2d
[<ffffffff81291fc5>] __blk_run_queue+0x14/0x16
[<ffffffff8129323d>] queue_unplugged.isra.56+0x19/0x29
[<ffffffff81294ecf>] blk_flush_plug_list+0x19b/0x1ad
[<ffffffff81294f01>] blk_finish_plug+0x20/0x2f
[<ffffffff810c6e37>] __do_page_cache_readahead+0x1c8/0x1e9
[<ffffffff810c7160>] force_page_cache_readahead+0x6f/0x96
[<ffffffff810c71ad>] page_cache_sync_readahead+0x26/0x3a
[<ffffffff81118799>] __generic_file_splice_read+0x137/0x4a5
[<ffffffff81117136>] ? page_cache_pipe_buf_release+0x19/0x19
[<ffffffff81068172>] ? update_load_avg.isra.34+0x1fb/0x20a
[<ffffffff8106708e>] ? get_sd_balance_interval.isra.55+0x17/0x33
[<ffffffff81cd4616>] ? _raw_spin_unlock_irq+0x12/0x24
[<ffffffff81060a01>] ? finish_task_switch+0x121/0x189
[<ffffffff81118b40>] generic_file_splice_read+0x39/0x65
[<ffffffff812271a3>] xfs_file_splice_read+0xa5/0x112
[<ffffffff811171c8>] do_splice_to+0x65/0x79
[<ffffffff8111916c>] SyS_splice+0x4a4/0x501
[<ffffffff81cd4ad7>] entry_SYSCALL_64_fastpath+0x12/0x6a
check_preemption_disabled: 108 callbacks suppressed

We saw your code and you seem to raw_smp_processor_id everywhere except on the ioaccel functions (3 of them), where you use smp_processor_id.

To fix this, isn't better to use only raw_smp_processor_id as implemented in the attached patch? This one is against 4.4.8.

Cheers,

Felipe Damasio

Attachment: hpsa-smp_processor.patch
Description: hpsa-smp_processor.patch