scsi: target: Make state_list per CPU

[ Upstream commit 1526d9f10c6184031e42afad0adbdde1213e8ad1 ]

Do a state_list/execute_task_lock per CPU, so we can do submissions from
different CPUs without contention with each other.

Note: tcm_fc was passing TARGET_SCF_USE_CPUID, but never set cpuid.  The
assumption is that it wanted to set the cpuid to the CPU it was submitting
from so it will get this behavior with this patch.

[mkp: s/printk/pr_err/ + resolve COMPARE AND WRITE patch conflict]

Link: https://lore.kernel.org/r/1604257174-4524-8-git-send-email-michael.christie@oracle.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Stable-dep-of: 673db054d7a2 ("scsi: target: Fix multiple LUN_RESET handling")
Signed-off-by: Sasha Levin <sashal@kernel.org>
このコミットが含まれているのは:
Mike Christie
2020-11-01 12:59:33 -06:00
committed by Greg Kroah-Hartman
コミット 008b936bbd
5個のファイルの変更112行の追加84行の削除

ファイルの表示

@@ -541,6 +541,10 @@ struct se_cmd {
unsigned int t_prot_nents;
sense_reason_t pi_err;
u64 sense_info;
/*
* CPU LIO will execute the cmd on. Defaults to the CPU the cmd is
* initialized on. Drivers can override.
*/
int cpuid;
};
@@ -761,6 +765,11 @@ struct se_dev_stat_grps {
struct config_group scsi_lu_group;
};
struct se_device_queue {
struct list_head state_list;
spinlock_t lock;
};
struct se_device {
/* RELATIVE TARGET PORT IDENTIFER Counter */
u16 dev_rpti_counter;
@@ -794,7 +803,6 @@ struct se_device {
atomic_t dev_qf_count;
u32 export_count;
spinlock_t delayed_cmd_lock;
spinlock_t execute_task_lock;
spinlock_t dev_reservation_lock;
unsigned int dev_reservation_flags;
#define DRF_SPC2_RESERVATIONS 0x00000001
@@ -814,7 +822,6 @@ struct se_device {
struct work_struct qf_work_queue;
struct work_struct delayed_cmd_work;
struct list_head delayed_cmd_list;
struct list_head state_list;
struct list_head qf_cmd_list;
/* Pointer to associated SE HBA */
struct se_hba *se_hba;
@@ -841,6 +848,8 @@ struct se_device {
/* For se_lun->lun_se_dev RCU read-side critical access */
u32 hba_index;
struct rcu_head rcu_head;
int queue_cnt;
struct se_device_queue *queues;
};
struct se_hba {