From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759043Ab3IHQBQ (ORCPT ); Sun, 8 Sep 2013 12:01:16 -0400 Received: from hrndva-omtalb.mail.rr.com ([71.74.56.122]:8228 "EHLO hrndva-omtalb.mail.rr.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753798Ab3IHP4q (ORCPT ); Sun, 8 Sep 2013 11:56:46 -0400 X-Authority-Analysis: v=2.0 cv=ddwCLAre c=1 sm=0 a=Sro2XwOs0tJUSHxCKfOySw==:17 a=Drc5e87SC40A:10 a=Ciwy3NGCPMMA:10 a=cxJSlJIEkFEA:10 a=5SG0PmZfjMsA:10 a=bbbx4UPp9XUA:10 a=meVymXHHAAAA:8 a=KGjhK52YXX0A:10 a=T0vaTpGz_joA:10 a=20KFwNOVAAAA:8 a=VwQbUJbxAAAA:8 a=cH6R9-kdAAAA:8 a=ZWkigBNIbSQrd9Nb2oAA:9 a=jEp0ucaQiEUA:10 a=Zh68SRI7RUMA:10 a=Sro2XwOs0tJUSHxCKfOySw==:117 X-Cloudmark-Score: 0 X-Authenticated-User: X-Originating-IP: 67.255.60.225 Message-Id: <20130908151448.045841633@goodmis.org> User-Agent: quilt/0.60-1 Date: Sun, 08 Sep 2013 11:14:08 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org, linux-rt-users Cc: Thomas Gleixner , Carsten Emde , Sebastian Andrzej Siewior , John Kacur , , Stephen Subject: [PATCH RT 13/19] hpsa: fix warning with smp_processor_id() in preemptible section References: <20130908151355.362583092@goodmis.org> Content-Disposition: inline; filename=0013-hpsa-fix-warning-with-smp_processor_id-in-preemptibl.patch Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: John Kacur On a 3.6-rt (real-time patch) kernel we are seeing the following BUG However, it appears to be relevant for non-realtime (mainline) as well. |hpsa 0000:03:00.0: hpsa0: <0x323a> at IRQ 67 using DAC |scsi0 : hpsa |BUG: using smp_processor_id() in preemptible [0000000000000000] code: kworker/u:0/6 |caller is enqueue_cmd_and_start_io+0x5a/0x100 [hpsa] |Pid: 6, comm: kworker/u:0 Not tainted 3.6.11.5-rt37.52.el6rt.x86_64.debug #1 |Call Trace: | [] debug_smp_processor_id+0x123/0x150 | [] enqueue_cmd_and_start_io+0x5a/0x100 [hpsa] | [] hpsa_scsi_do_simple_cmd_core+0xeb/0x110 [hpsa] | [] ? swiotlb_dma_mapping_error+0x18/0x30 | [] ? swiotlb_dma_mapping_error+0x18/0x30 | [] hpsa_scsi_do_simple_cmd_with_retry+0x91/0x280 [hpsa] | [] hpsa_scsi_do_report_luns.clone.2+0xd8/0x130 [hpsa] | [] hpsa_gather_lun_info.clone.3+0x3a/0x1a0 [hpsa] | [] hpsa_update_scsi_devices+0x11f/0x4f0 [hpsa] | [] ? sub_preempt_count+0xa9/0xe0 | [] hpsa_scan_start+0xfd/0x150 [hpsa] | [] ? rt_spin_lock_slowunlock+0x78/0x90 | [] do_scsi_scan_host+0x37/0xa0 | [] do_scan_async+0x1a/0x30 | [] async_run_entry_fn+0x9b/0x1d0 | [] process_one_work+0x1f2/0x620 | [] ? process_one_work+0x180/0x620 | [] ? worker_thread+0x5e/0x3a0 | [] ? async_schedule+0x20/0x20 | [] worker_thread+0x133/0x3a0 | [] ? manage_workers+0x190/0x190 | [] kthread+0xa6/0xb0 | [] kernel_thread_helper+0x4/0x10 | [] ? finish_task_switch+0x8c/0x110 | [] ? _raw_spin_unlock_irq+0x3b/0x70 | [] ? retint_restore_args+0xe/0xe | [] ? kthreadd+0x1e0/0x1e0 | [] ? gs_change+0xb/0xb ------------------- This is caused by enqueue_cmd_and_start_io()-> set_performant_mode()-> smp_processor_id() Which if you have debugging enabled calls debug_processor_id() and triggers the warning. The code here is c->Header.ReplyQueue = smp_processor_id() % h->nreply_queues; Since it is not critical that the code complete on the same processor, but the cpu is a hint used in generating the ReplyQueue and will still work if the cpu migrates or is preempted, it is safe to use the raw_smp_processor_id() to surpress the false positve warning. Cc: stable-rt@vger.kernel.org Signed-off-by: John Kacur Acked-by: Stephen Signed-off-by: Sebastian Andrzej Siewior --- drivers/scsi/hpsa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c index f9823f2..be83a15 100644 --- a/drivers/scsi/hpsa.c +++ b/drivers/scsi/hpsa.c @@ -565,7 +565,7 @@ static void set_performant_mode(struct ctlr_info *h, struct CommandList *c) c->busaddr |= 1 | (h->blockFetchTable[c->Header.SGList] << 1); if (likely(h->msix_vector)) c->Header.ReplyQueue = - smp_processor_id() % h->nreply_queues; + raw_smp_processor_id() % h->nreply_queues; } } -- 1.7.10.4