Re: [PATCH] [SCSI] mpt2sas : Fix unsafe using smp_processor_id() inpreemptible

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at

[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Photos]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux