From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Shi Subject: Re: [PATCH] [SCSI] mpt2sas : Fix unsafe using smp_processor_id() inpreemptible Date: Mon, 23 Apr 2012 09:29:42 +0800 Message-ID: <4F94B086.4000502@intel.com> References: <20120418031441.GA10862@parisc-linux.org> <4565AEA676113A449269C2F3A549520FB5AE22E7@cosmail03.lsi.com> <20120418041359.GB10862@parisc-linux.org> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Return-path: Received: from mga11.intel.com ([192.55.52.93]:64442 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753074Ab2DWBap (ORCPT ); Sun, 22 Apr 2012 21:30:45 -0400 In-Reply-To: Sender: linux-scsi-owner@vger.kernel.org List-Id: linux-scsi@vger.kernel.org To: "Nandigama, Nagalakshmi" Cc: Matthew Wilcox , "Moore, Eric" , "stable@vger.kernel.org" , "linux-scsi@vger.kernel.org" , "Prakash, Sathya" , "jejb@kernel.org" On 04/20/2012 07:00 PM, Nandigama, Nagalakshmi wrote: > diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c b/drivers/scsi/mpt2sas/mpt2sas_base.c > index 272fab7..0f47f56 100644 > --- a/drivers/scsi/mpt2sas/mpt2sas_base.c > +++ b/drivers/scsi/mpt2sas/mpt2sas_base.c > @@ -1792,7 +1792,10 @@ static inline void _base_writeq(__u64 b, volatile void __iomem *addr, > static inline u8 > _base_get_msix_index(struct MPT2SAS_ADAPTER *ioc) > { > - return ioc->cpu_msix_table[smp_processor_id()]; > + int cpu = get_cpu(); > + put_cpu(); > + return ioc->cpu_msix_table[cpu]; > + > } If we don't care the correctness interrupt CPU. Do preempt_enable/preempt_disable is just waste of time. A patch like following is enough, :) _base_get_msix_index(struct MPT2SAS_ADAPTER *ioc) { - return ioc->cpu_msix_table[smp_processor_id()]; + return ioc->cpu_msix_table[raw_smp_processor_id()]; } BTW, I didn't subscribe linux-scsi mailing list, so cc to me is appreciated.