Re: [PATCH v3 1/3] init / kthread: add module_long_probe_init() and module_long_probe_exit()
At Sun, 17 Aug 2014 20:21:38 +0200, Oleg Nesterov wrote: On 08/17, Luis R. Rodriguez wrote: In the last iteration that I have stress tested for corner cases I just get_task_struct() on the init and then put_task_struct() at the exit, is that fine too or are there reasons to prefer the module stuff? I am fine either way. I like the Takashi's idea because if sys_delete_module() is called before initfn() completes it will return -EBUSY and not hang in TASK_UNINTERRUPTIBLE state. But this is not necessarily good, so I leave this to you and Takashi. Another merit of fiddling with module count is that the thread object isn't referred in other than module_init. That is, we'd need only module_init() implementation like below (thanks to Oleg's advice): #define module_long_probe_init(initfn) \ static int _long_probe_##initfn(void *arg) \ { \ module_put_and_exit(initfn()); \ return 0; \ } \ static int __init __long_probe_##initfn(void) \ { \ struct task_struct *__init_thread = \ kthread_create(_long_probe_##initfn,\ NULL, #initfn); \ if (IS_ERR(__init_thread)) \ return PTR_ERR(__init_thread); \ __module_get(THIS_MODULE); \ wake_up_process(__init_thread); \ return 0; \ } \ module_init(__long_probe_##initfn) ... and module_exit() remains identical as the normal version. But, it's really a small difference, and I don't mind much which way to take, too. +/* + * Linux device drivers must strive to handle driver initialization + * within less than 30 seconds, Well, perhaps the comment should name the reason ;) if device probing takes longer + * for whatever reason asynchronous probing of devices / loading + * firmware should be used. If a driver takes longer than 30 second + * on the initialization path Or if the initialization code can't handle the errors properly (say, mptsas can't handle the errors caused by SIGKILL). + * Drivers that use this helper should be considered broken and in need + * of some serious love. + */ Yes. +#define module_long_probe_init(initfn) \ + static struct task_struct *__init_thread; \ + static int _long_probe_##initfn(void *arg) \ + { \ + return initfn();\ + } \ + static inline __init int __long_probe_##initfn(void)\ + { \ + __init_thread = kthread_create(_long_probe_##initfn,\ + NULL,\ + #initfn);\ + if (IS_ERR(__init_thread)) \ + return PTR_ERR(__init_thread); \ + /* \ +* callback won't check kthread_should_stop() \ +* before bailing, so we need to protect it \ +* before running it. \ +*/ \ + get_task_struct(__init_thread); \ + wake_up_process(__init_thread); \ + return 0; \ + } \ + module_init(__long_probe_##initfn); + +/* To be used by modules that require module_long_probe_init() */ +#define module_long_probe_exit(exitfn) \ + static inline void __long_probe_##exitfn(void) \ + { \ + int err;\ + /* \ +* exitfn() will not be run if the driver's \ +* real probe which is run on the kthread \ +* failed for whatever reason, this will\ +* wait for it to end. \ +*/ \ + err = kthread_stop(__init_thread); \ + if (!err)
[PATCH v3 00/13] scsi: Use pci_enable_msix_range() instead of pci_enable_msix()
Hello, This series is against 3.17-rc1. Patches 0-7 have been acked. Patches 8-13 still need reviews and are resent without changes except 'lpfc' which concerns latest James comments. Thanks! As result of deprecation of MSI-X/MSI enablement functions pci_enable_msix() and pci_enable_msi_block() all drivers using these two interfaces need to be updated to use the new pci_enable_msi_range() or pci_enable_msi_exact() and pci_enable_msix_range() or pci_enable_msix_exact() interfaces. Cc: Anil Ravindranath anil_ravindran...@pmc-sierra.com Cc: James Smart james.sm...@emulex.com Cc: Naresh Kumar Inna nar...@chelsio.com Cc: Arvind Bhushan arvi...@chelsio.com Cc: Jayamohan Kallickal jayamohan.kallic...@emulex.com Cc: Chad Dupuis chad.dup...@qlogic.com Cc: Tomas Henzl the...@redhat.com Cc: Nagalakshmi Nandigama nagalakshmi.nandig...@lsi.com Cc: Sreekanth Reddy sreekanth.re...@lsi.com Cc: Kashyap Desai kashyap.de...@avagotech.com Cc: Neela Syam Kolli megaraidli...@lsi.com Cc: Stephen M. Cameron scame...@beardog.cce.hp.com Cc: iss_storage...@hp.com Cc: supp...@lsi.com Cc: dl-mptfusionli...@lsi.com Cc: qla2xxx-upstr...@qlogic.com Cc: linux-scsi@vger.kernel.org Cc: linux-...@vger.kernel.org Alexander Gordeev (13): hpsa: Fallback to MSI rather than to INTx if MSI-X failed hpsa: Use pci_enable_msix_range() instead of pci_enable_msix() megaraid: Fail resume if MSI-X re-initialization failed megaraid: Use pci_enable_msix_range() instead of pci_enable_msix() mpt2sas: Use pci_enable_msix_exact() instead of pci_enable_msix() mpt3sas: Use pci_enable_msix_exact() instead of pci_enable_msix() qla2xxx: Use pci_enable_msix_range() instead of pci_enable_msix() be2iscsi: Use pci_enable_msix_range() csiostor: Remove superfluous call to pci_disable_msix() csiostor: Use pci_enable_msix_range() instead of pci_enable_msix() lpfc: Use pci_enable_msix_range() instead of pci_enable_msix() pmcraid: Get rid of a redundant assignment pmcraid: Use pci_enable_msix_range() instead of pci_enable_msix() drivers/scsi/be2iscsi/be_main.c | 6 ++--- drivers/scsi/csiostor/csio_hw.h | 2 +- drivers/scsi/csiostor/csio_isr.c | 24 +++ drivers/scsi/hpsa.c | 28 ++ drivers/scsi/lpfc/lpfc_init.c | 39 ++- drivers/scsi/megaraid/megaraid_sas_base.c | 24 --- drivers/scsi/mpt2sas/mpt2sas_base.c | 6 ++--- drivers/scsi/mpt3sas/mpt3sas_base.c | 4 ++-- drivers/scsi/pmcraid.c| 14 ++- drivers/scsi/qla2xxx/qla_isr.c| 27 + 10 files changed, 70 insertions(+), 104 deletions(-) -- 1.9.3 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 04/13] megaraid: Use pci_enable_msix_range() instead of pci_enable_msix()
As result of deprecation of MSI-X/MSI enablement functions pci_enable_msix() and pci_enable_msi_block() all drivers using these two interfaces need to be updated to use the new pci_enable_msi_range() or pci_enable_msi_exact() and pci_enable_msix_range() or pci_enable_msix_exact() interfaces. Signed-off-by: Alexander Gordeev agord...@redhat.com Acked-by: Kashyap Desai kashyap.de...@avagotech.com Cc: Neela Syam Kolli megaraidli...@lsi.com Cc: linux-scsi@vger.kernel.org Cc: linux-...@vger.kernel.org --- drivers/scsi/megaraid/megaraid_sas_base.c | 20 +++- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index e4ffae5..a2f4d4f 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -4103,17 +4103,11 @@ static int megasas_init_fw(struct megasas_instance *instance) (unsigned int)num_online_cpus()); for (i = 0; i instance-msix_vectors; i++) instance-msixentry[i].entry = i; - i = pci_enable_msix(instance-pdev, instance-msixentry, - instance-msix_vectors); - if (i = 0) { - if (i) { - if (!pci_enable_msix(instance-pdev, -instance-msixentry, i)) - instance-msix_vectors = i; - else - instance-msix_vectors = 0; - } - } else + i = pci_enable_msix_range(instance-pdev, instance-msixentry, + 1, instance-msix_vectors); + if (i) + instance-msix_vectors = i; + else instance-msix_vectors = 0; dev_info(instance-pdev-dev, [scsi%d]: FW supports @@ -5133,8 +5127,8 @@ megasas_resume(struct pci_dev *pdev) /* Now re-enable MSI-X */ if (instance-msix_vectors - pci_enable_msix(instance-pdev, instance-msixentry, - instance-msix_vectors)) + pci_enable_msix_exact(instance-pdev, instance-msixentry, + instance-msix_vectors)) goto fail_reenable_msix; switch (instance-pdev-device) { -- 1.9.3 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 10/13] csiostor: Use pci_enable_msix_range() instead of pci_enable_msix()
As result of deprecation of MSI-X/MSI enablement functions pci_enable_msix() and pci_enable_msi_block() all drivers using these two interfaces need to be updated to use the new pci_enable_msi_range() or pci_enable_msi_exact() and pci_enable_msix_range() or pci_enable_msix_exact() interfaces. Signed-off-by: Alexander Gordeev agord...@redhat.com Cc: Naresh Kumar Inna nar...@chelsio.com Cc: Arvind Bhushan arvi...@chelsio.com Cc: linux-scsi@vger.kernel.org Cc: linux-...@vger.kernel.org --- drivers/scsi/csiostor/csio_hw.h | 2 +- drivers/scsi/csiostor/csio_isr.c | 22 +- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/drivers/scsi/csiostor/csio_hw.h b/drivers/scsi/csiostor/csio_hw.h index 49b1daa..5db2d85 100644 --- a/drivers/scsi/csiostor/csio_hw.h +++ b/drivers/scsi/csiostor/csio_hw.h @@ -94,7 +94,7 @@ enum { }; struct csio_msix_entries { - unsigned short vector; /* Vector assigned by pci_enable_msix */ + unsigned short vector; /* Assigned MSI-X vector */ void*dev_id;/* Priv object associated w/ this msix*/ chardesc[24]; /* Description of this vector */ }; diff --git a/drivers/scsi/csiostor/csio_isr.c b/drivers/scsi/csiostor/csio_isr.c index 91ba91d..a8c748a 100644 --- a/drivers/scsi/csiostor/csio_isr.c +++ b/drivers/scsi/csiostor/csio_isr.c @@ -499,7 +499,7 @@ csio_reduce_sqsets(struct csio_hw *hw, int cnt) static int csio_enable_msix(struct csio_hw *hw) { - int rv, i, j, k, n, min, cnt; + int i, j, k, n, min, cnt; struct csio_msix_entries *entryp; struct msix_entry *entries; int extra = CSIO_EXTRA_VECS; @@ -521,19 +521,15 @@ csio_enable_msix(struct csio_hw *hw) csio_dbg(hw, FW supp #niq:%d, trying %d msix's\n, hw-cfg_niq, cnt); - while ((rv = pci_enable_msix(hw-pdev, entries, cnt)) = min) - cnt = rv; - if (!rv) { - if (cnt (hw-num_sqsets + extra)) { - csio_dbg(hw, Reducing sqsets to %d\n, cnt - extra); - csio_reduce_sqsets(hw, cnt - extra); - } - } else { - if (rv 0) - csio_info(hw, Not using MSI-X, remainder:%d\n, rv); - + cnt = pci_enable_msix_range(hw-pdev, entries, min, cnt); + if (cnt 0) { kfree(entries); - return -ENOMEM; + return cnt; + } + + if (cnt (hw-num_sqsets + extra)) { + csio_dbg(hw, Reducing sqsets to %d\n, cnt - extra); + csio_reduce_sqsets(hw, cnt - extra); } /* Save off vectors */ -- 1.9.3 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 02/13] hpsa: Use pci_enable_msix_range() instead of pci_enable_msix()
As result of deprecation of MSI-X/MSI enablement functions pci_enable_msix() and pci_enable_msi_block() all drivers using these two interfaces need to be updated to use the new pci_enable_msi_range() or pci_enable_msi_exact() and pci_enable_msix_range() or pci_enable_msix_exact() interfaces. Signed-off-by: Alexander Gordeev agord...@redhat.com Acked-by: Stephen M. Cameron scame...@beardog.cce.hp.com Cc: iss_storage...@hp.com Cc: linux-scsi@vger.kernel.org Cc: linux-...@vger.kernel.org --- drivers/scsi/hpsa.c | 27 --- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c index a9c4c9f..8c17c43 100644 --- a/drivers/scsi/hpsa.c +++ b/drivers/scsi/hpsa.c @@ -6159,25 +6159,22 @@ static void hpsa_interrupt_mode(struct ctlr_info *h) h-msix_vector = MAX_REPLY_QUEUES; if (h-msix_vector num_online_cpus()) h-msix_vector = num_online_cpus(); - err = pci_enable_msix(h-pdev, hpsa_msix_entries, - h-msix_vector); - if (err 0) { + err = pci_enable_msix_range(h-pdev, hpsa_msix_entries, + 1, h-msix_vector); + if (err 0) { + dev_warn(h-pdev-dev, MSI-X init failed %d\n, err); + h-msix_vector = 0; + goto single_msi_mode; + } else if (err h-msix_vector) { dev_warn(h-pdev-dev, only %d MSI-X vectors available\n, err); - h-msix_vector = err; - err = pci_enable_msix(h-pdev, hpsa_msix_entries, - h-msix_vector); - } - if (!err) { - for (i = 0; i h-msix_vector; i++) - h-intr[i] = hpsa_msix_entries[i].vector; - return; - } else { - dev_warn(h-pdev-dev, MSI-X init failed %d\n, - err); - h-msix_vector = 0; } + h-msix_vector = err; + for (i = 0; i h-msix_vector; i++) + h-intr[i] = hpsa_msix_entries[i].vector; + return; } +single_msi_mode: if (pci_find_capability(h-pdev, PCI_CAP_ID_MSI)) { dev_info(h-pdev-dev, MSI\n); if (!pci_enable_msi(h-pdev)) -- 1.9.3 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 13/13] pmcraid: Use pci_enable_msix_range() instead of pci_enable_msix()
As result of deprecation of MSI-X/MSI enablement functions pci_enable_msix() and pci_enable_msi_block() all drivers using these two interfaces need to be updated to use the new pci_enable_msi_range() or pci_enable_msi_exact() and pci_enable_msix_range() or pci_enable_msix_exact() interfaces. Signed-off-by: Alexander Gordeev agord...@redhat.com Cc: Anil Ravindranath anil_ravindran...@pmc-sierra.com Cc: linux-scsi@vger.kernel.org Cc: linux-...@vger.kernel.org --- drivers/scsi/pmcraid.c | 13 ++--- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c index 6e575ed..bcb64eb 100644 --- a/drivers/scsi/pmcraid.c +++ b/drivers/scsi/pmcraid.c @@ -4698,19 +4698,10 @@ pmcraid_register_interrupt_handler(struct pmcraid_instance *pinstance) for (i = 0; i PMCRAID_NUM_MSIX_VECTORS; i++) entries[i].entry = i; - rc = pci_enable_msix(pdev, entries, num_hrrq); - if (rc 0) + num_hrrq = pci_enable_msix_range(pdev, entries, 1, num_hrrq); + if (num_hrrq 0) goto pmcraid_isr_legacy; - /* Check how many MSIX vectors are allocated and register -* msi-x handlers for each of them giving appropriate buffer -*/ - if (rc 0) { - num_hrrq = rc; - if (pci_enable_msix(pdev, entries, num_hrrq)) - goto pmcraid_isr_legacy; - } - for (i = 0; i num_hrrq; i++) { pinstance-hrrq_vector[i].hrrq_id = i; pinstance-hrrq_vector[i].drv_inst = pinstance; -- 1.9.3 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 05/13] mpt2sas: Use pci_enable_msix_exact() instead of pci_enable_msix()
As result of deprecation of MSI-X/MSI enablement functions pci_enable_msix() and pci_enable_msi_block() all drivers using these two interfaces need to be updated to use the new pci_enable_msi_range() or pci_enable_msi_exact() and pci_enable_msix_range() or pci_enable_msix_exact() interfaces. Signed-off-by: Alexander Gordeev agord...@redhat.com Reviewed-by: Tomas Henzl the...@redhat.com Cc: Nagalakshmi Nandigama nagalakshmi.nandig...@lsi.com Cc: Sreekanth Reddy sreekanth.re...@lsi.com Cc: supp...@lsi.com Cc: dl-mptfusionli...@lsi.com Cc: linux-scsi@vger.kernel.org Cc: linux-...@vger.kernel.org --- drivers/scsi/mpt2sas/mpt2sas_base.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c b/drivers/scsi/mpt2sas/mpt2sas_base.c index 2f262be..cf51b48 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_base.c +++ b/drivers/scsi/mpt2sas/mpt2sas_base.c @@ -1414,10 +1414,10 @@ _base_enable_msix(struct MPT2SAS_ADAPTER *ioc) for (i = 0, a = entries; i ioc-reply_queue_count; i++, a++) a-entry = i; - r = pci_enable_msix(ioc-pdev, entries, ioc-reply_queue_count); + r = pci_enable_msix_exact(ioc-pdev, entries, ioc-reply_queue_count); if (r) { - dfailprintk(ioc, printk(MPT2SAS_INFO_FMT pci_enable_msix - failed (r=%d) !!!\n, ioc-name, r)); + dfailprintk(ioc, printk(MPT2SAS_INFO_FMT + pci_enable_msix_exact failed (r=%d) !!!\n, ioc-name, r)); kfree(entries); goto try_ioapic; } -- 1.9.3 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 09/13] csiostor: Remove superfluous call to pci_disable_msix()
There is no need to call pci_disable_msix() in case the previous call to pci_enable_msix() failed Signed-off-by: Alexander Gordeev agord...@redhat.com Cc: Naresh Kumar Inna nar...@chelsio.com Cc: Arvind Bhushan arvi...@chelsio.com Cc: linux-scsi@vger.kernel.org Cc: linux-...@vger.kernel.org --- drivers/scsi/csiostor/csio_isr.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/scsi/csiostor/csio_isr.c b/drivers/scsi/csiostor/csio_isr.c index 7ee9777..91ba91d 100644 --- a/drivers/scsi/csiostor/csio_isr.c +++ b/drivers/scsi/csiostor/csio_isr.c @@ -529,10 +529,8 @@ csio_enable_msix(struct csio_hw *hw) csio_reduce_sqsets(hw, cnt - extra); } } else { - if (rv 0) { - pci_disable_msix(hw-pdev); + if (rv 0) csio_info(hw, Not using MSI-X, remainder:%d\n, rv); - } kfree(entries); return -ENOMEM; -- 1.9.3 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 07/13] qla2xxx: Use pci_enable_msix_range() instead of pci_enable_msix()
As result of deprecation of MSI-X/MSI enablement functions pci_enable_msix() and pci_enable_msi_block() all drivers using these two interfaces need to be updated to use the new pci_enable_msi_range() or pci_enable_msi_exact() and pci_enable_msix_range() or pci_enable_msix_exact() interfaces. Log message code 0x00c6 preserved, although it is reported after successful call to pci_enable_msix_range(), not before possibly unsuccessful call to pci_enable_msix(). Consumers of the error code should not notice the difference. Signed-off-by: Alexander Gordeev agord...@redhat.com Acked-by: Chad Dupuis chad.dup...@qlogic.com Cc: qla2xxx-upstr...@qlogic.com Cc: linux-scsi@vger.kernel.org Cc: linux-...@vger.kernel.org --- drivers/scsi/qla2xxx/qla_isr.c | 27 +++ 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c index 550a4a3..a485578 100644 --- a/drivers/scsi/qla2xxx/qla_isr.c +++ b/drivers/scsi/qla2xxx/qla_isr.c @@ -2923,27 +2923,22 @@ qla24xx_enable_msix(struct qla_hw_data *ha, struct rsp_que *rsp) for (i = 0; i ha-msix_count; i++) entries[i].entry = i; - ret = pci_enable_msix(ha-pdev, entries, ha-msix_count); - if (ret) { - if (ret MIN_MSIX_COUNT) - goto msix_failed; - + ret = pci_enable_msix_range(ha-pdev, + entries, MIN_MSIX_COUNT, ha-msix_count); + if (ret 0) { + ql_log(ql_log_fatal, vha, 0x00c7, + MSI-X: Failed to enable support, + giving up -- %d/%d.\n, + ha-msix_count, ret); + goto msix_out; + } else if (ret ha-msix_count) { ql_log(ql_log_warn, vha, 0x00c6, MSI-X: Failed to enable support -- %d/%d\n Retry with %d vectors.\n, ha-msix_count, ret, ret); - ha-msix_count = ret; - ret = pci_enable_msix(ha-pdev, entries, ha-msix_count); - if (ret) { -msix_failed: - ql_log(ql_log_fatal, vha, 0x00c7, - MSI-X: Failed to enable support, - giving up -- %d/%d.\n, - ha-msix_count, ret); - goto msix_out; - } - ha-max_rsp_queues = ha-msix_count - 1; } + ha-msix_count = ret; + ha-max_rsp_queues = ha-msix_count - 1; ha-msix_entries = kzalloc(sizeof(struct qla_msix_entry) * ha-msix_count, GFP_KERNEL); if (!ha-msix_entries) { -- 1.9.3 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 08/13] be2iscsi: Use pci_enable_msix_range()
As result of deprecation of MSI-X/MSI enablement functions pci_enable_msix() and pci_enable_msi_block() all drivers using these two interfaces need to be updated to use the new pci_enable_msi_range() and pci_enable_msix_range() interfaces. Signed-off-by: Alexander Gordeev agord...@redhat.com Cc: Jayamohan Kallickal jayamohan.kallic...@emulex.com Cc: linux-scsi@vger.kernel.org Cc: linux-...@vger.kernel.org --- drivers/scsi/be2iscsi/be_main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c index 915c26b..b422659 100644 --- a/drivers/scsi/be2iscsi/be_main.c +++ b/drivers/scsi/be2iscsi/be_main.c @@ -5276,9 +5276,9 @@ static void beiscsi_msix_enable(struct beiscsi_hba *phba) for (i = 0; i = phba-num_cpus; i++) phba-msix_entries[i].entry = i; - status = pci_enable_msix(phba-pcidev, phba-msix_entries, -(phba-num_cpus + 1)); - if (!status) + status = pci_enable_msix_range(phba-pcidev, phba-msix_entries, + phba-num_cpus + 1, phba-num_cpus + 1); + if (status 0) phba-msix_enabled = true; return; -- 1.9.3 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 03/13] megaraid: Fail resume if MSI-X re-initialization failed
Currently the driver fails to analize MSI-X re-enablement status on resuming and always assumes the success. This update checks the MSI-X initialization result and fails to resume if MSI-Xs re-enablement failed. Signed-off-by: Alexander Gordeev agord...@redhat.com Acked-by: Kashyap Desai kashyap.de...@avagotech.com Cc: Neela Syam Kolli megaraidli...@lsi.com Cc: linux-scsi@vger.kernel.org Cc: linux-...@vger.kernel.org --- drivers/scsi/megaraid/megaraid_sas_base.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 22a04e3..e4ffae5 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -5132,9 +5132,10 @@ megasas_resume(struct pci_dev *pdev) goto fail_ready_state; /* Now re-enable MSI-X */ - if (instance-msix_vectors) - pci_enable_msix(instance-pdev, instance-msixentry, - instance-msix_vectors); + if (instance-msix_vectors + pci_enable_msix(instance-pdev, instance-msixentry, + instance-msix_vectors)) + goto fail_reenable_msix; switch (instance-pdev-device) { case PCI_DEVICE_ID_LSI_FUSION: @@ -5243,6 +5244,7 @@ fail_init_mfi: fail_set_dma_mask: fail_ready_state: +fail_reenable_msix: pci_disable_device(pdev); -- 1.9.3 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 12/13] pmcraid: Get rid of a redundant assignment
Signed-off-by: Alexander Gordeev agord...@redhat.com Cc: Anil Ravindranath anil_ravindran...@pmc-sierra.com Cc: linux-scsi@vger.kernel.org Cc: linux-...@vger.kernel.org --- drivers/scsi/pmcraid.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c index 6f3275d..6e575ed 100644 --- a/drivers/scsi/pmcraid.c +++ b/drivers/scsi/pmcraid.c @@ -4746,7 +4746,6 @@ pmcraid_isr_legacy: pinstance-hrrq_vector[0].drv_inst = pinstance; pinstance-hrrq_vector[0].vector = pdev-irq; pinstance-num_hrrq = 1; - rc = 0; rc = request_irq(pdev-irq, pmcraid_isr, IRQF_SHARED, PMCRAID_DRIVER_NAME, pinstance-hrrq_vector[0]); -- 1.9.3 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 06/13] mpt3sas: Use pci_enable_msix_exact() instead of pci_enable_msix()
As result of deprecation of MSI-X/MSI enablement functions pci_enable_msix() and pci_enable_msi_block() all drivers using these two interfaces need to be updated to use the new pci_enable_msi_range() or pci_enable_msi_exact() and pci_enable_msix_range() or pci_enable_msix_exact() interfaces. Signed-off-by: Alexander Gordeev agord...@redhat.com Reviewed-by: Tomas Henzl the...@redhat.com Cc: Nagalakshmi Nandigama nagalakshmi.nandig...@lsi.com Cc: Sreekanth Reddy sreekanth.re...@lsi.com Cc: supp...@lsi.com Cc: dl-mptfusionli...@lsi.com Cc: linux-scsi@vger.kernel.org Cc: linux-...@vger.kernel.org --- drivers/scsi/mpt3sas/mpt3sas_base.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c index 93ce2b2..09e6b21 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_base.c +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c @@ -1716,10 +1716,10 @@ _base_enable_msix(struct MPT3SAS_ADAPTER *ioc) for (i = 0, a = entries; i ioc-reply_queue_count; i++, a++) a-entry = i; - r = pci_enable_msix(ioc-pdev, entries, ioc-reply_queue_count); + r = pci_enable_msix_exact(ioc-pdev, entries, ioc-reply_queue_count); if (r) { dfailprintk(ioc, pr_info(MPT3SAS_FMT - pci_enable_msix failed (r=%d) !!!\n, + pci_enable_msix_exact failed (r=%d) !!!\n, ioc-name, r)); kfree(entries); goto try_ioapic; -- 1.9.3 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 11/13] lpfc: Use pci_enable_msix_range() instead of pci_enable_msix()
As result of deprecation of MSI-X/MSI enablement functions pci_enable_msix() and pci_enable_msi_block() all drivers using these two interfaces need to be updated to use the new pci_enable_msi_range() or pci_enable_msi_exact() and pci_enable_msix_range() or pci_enable_msix_exact() interfaces. Signed-off-by: Alexander Gordeev agord...@redhat.com Cc: James Smart james.sm...@emulex.com Cc: linux-scsi@vger.kernel.org Cc: linux-...@vger.kernel.org --- drivers/scsi/lpfc/lpfc_init.c | 39 +-- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index a5769a9..37f2a20 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c @@ -8211,9 +8211,9 @@ lpfc_sli4_pci_mem_unset(struct lpfc_hba *phba) * @phba: pointer to lpfc hba data structure. * * This routine is invoked to enable the MSI-X interrupt vectors to device - * with SLI-3 interface specs. The kernel function pci_enable_msix() is - * called to enable the MSI-X vectors. Note that pci_enable_msix(), once - * invoked, enables either all or nothing, depending on the current + * with SLI-3 interface specs. The kernel function pci_enable_msix_exact() + * is called to enable the MSI-X vectors. Note that pci_enable_msix_exact(), + * once invoked, enables either all or nothing, depending on the current * availability of PCI vector resources. The device driver is responsible * for calling the individual request_irq() to register each MSI-X vector * with a interrupt handler, which is done in this function. Note that @@ -8237,8 +8237,8 @@ lpfc_sli_enable_msix(struct lpfc_hba *phba) phba-msix_entries[i].entry = i; /* Configure MSI-X capability structure */ - rc = pci_enable_msix(phba-pcidev, phba-msix_entries, - ARRAY_SIZE(phba-msix_entries)); + rc = pci_enable_msix_exact(phba-pcidev, phba-msix_entries, + LPFC_MSIX_VECTORS); if (rc) { lpfc_printf_log(phba, KERN_INFO, LOG_INIT, 0420 PCI enable MSI-X failed (%d)\n, rc); @@ -8775,16 +8775,14 @@ out: * @phba: pointer to lpfc hba data structure. * * This routine is invoked to enable the MSI-X interrupt vectors to device - * with SLI-4 interface spec. The kernel function pci_enable_msix() is called - * to enable the MSI-X vectors. Note that pci_enable_msix(), once invoked, - * enables either all or nothing, depending on the current availability of - * PCI vector resources. The device driver is responsible for calling the - * individual request_irq() to register each MSI-X vector with a interrupt - * handler, which is done in this function. Note that later when device is - * unloading, the driver should always call free_irq() on all MSI-X vectors - * it has done request_irq() on before calling pci_disable_msix(). Failure - * to do so results in a BUG_ON() and a device will be left with MSI-X - * enabled and leaks its vectors. + * with SLI-4 interface spec. The kernel function pci_enable_msix_range() + * is called to enable the MSI-X vectors. The device driver is responsible + * for calling the individual request_irq() to register each MSI-X vector + * with a interrupt handler, which is done in this function. Note that + * later when device is unloading, the driver should always call free_irq() + * on all MSI-X vectors it has done request_irq() on before calling + * pci_disable_msix(). Failure to do so results in a BUG_ON() and a device + * will be left with MSI-X enabled and leaks its vectors. * * Return codes * 0 - successful @@ -8805,17 +8803,14 @@ lpfc_sli4_enable_msix(struct lpfc_hba *phba) phba-sli4_hba.msix_entries[index].entry = index; vectors++; } -enable_msix_vectors: - rc = pci_enable_msix(phba-pcidev, phba-sli4_hba.msix_entries, -vectors); - if (rc 1) { - vectors = rc; - goto enable_msix_vectors; - } else if (rc) { + rc = pci_enable_msix_range(phba-pcidev, phba-sli4_hba.msix_entries, + 2, vectors); + if (rc 0) { lpfc_printf_log(phba, KERN_INFO, LOG_INIT, 0484 PCI enable MSI-X failed (%d)\n, rc); goto vec_fail_out; } + vectors = rc; /* Log MSI-X vector assignment */ for (index = 0; index vectors; index++) -- 1.9.3 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 01/13] hpsa: Fallback to MSI rather than to INTx if MSI-X failed
Currently the driver falls back to INTx mode when MSI-X initialization failed. This is a suboptimal behaviour for chips that also support MSI. This update changes that behaviour and falls back to MSI mode in case MSI-X mode initialization failed. Signed-off-by: Alexander Gordeev agord...@redhat.com Acked-by: Stephen M. Cameron scame...@beardog.cce.hp.com Cc: iss_storage...@hp.com Cc: linux-scsi@vger.kernel.org Cc: linux-...@vger.kernel.org --- drivers/scsi/hpsa.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c index 6b35d0d..a9c4c9f 100644 --- a/drivers/scsi/hpsa.c +++ b/drivers/scsi/hpsa.c @@ -6176,7 +6176,6 @@ static void hpsa_interrupt_mode(struct ctlr_info *h) dev_warn(h-pdev-dev, MSI-X init failed %d\n, err); h-msix_vector = 0; - goto default_int_mode; } } if (pci_find_capability(h-pdev, PCI_CAP_ID_MSI)) { -- 1.9.3 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [Xen-devel] [PATCH V4 3/4] Introduce XEN scsiback module
On 08/17/2014 04:38 AM, Nicholas A. Bellinger wrote: On Thu, 2014-08-14 at 12:14 +0200, Juergen Gross wrote: On 08/14/2014 10:53 AM, Juergen Gross wrote: Nicholas, just one more question (see below): On 08/12/2014 11:13 PM, Nicholas A. Bellinger wrote: Hi Juergen Co, Finally had a chance to review this code. Comments are inline below.. On Fri, 2014-08-08 at 09:49 +0200, jgr...@suse.com wrote: ... +if (IS_ERR(tv_nexus-tvn_se_sess)) { +mutex_unlock(tpg-tv_tpg_mutex); +kfree(tv_nexus); +return -ENOMEM; +} +se_sess = tv_nexus-tvn_se_sess; +/* + * Since we are running in 'demo mode' this call with generate a + * struct se_node_acl for the scsiback struct se_portal_group with + * the SCSI Initiator port name of the passed configfs group 'name'. + */ +tv_nexus-tvn_se_sess-se_node_acl = core_tpg_check_initiator_node_acl( +se_tpg, (unsigned char *)name); +if (!tv_nexus-tvn_se_sess-se_node_acl) { +mutex_unlock(tpg-tv_tpg_mutex); +pr_debug(core_tpg_check_initiator_node_acl() failed for %s\n, + name); +goto out; +} Can I drop the call to core_tpg_check_initiator_node_acl() as well? Keeping it will result in failing to setup the nexus (which is to be expected IMHO). Obviously I can't. transport_lookup_cmd_lun() calls right at start spin_lock_irqsave(se_sess-se_node_acl-device_list_lock, flags); resulting in a page fault... I guess the hint to just throw away all the node_acl related stuff has to be adjusted somehow... So: what is needed, what can be removed? The scsiback_make_nodeacl() + scsiback_drop_nodeacl() configfs callbacks can be safely dropped, along with scisback_ncal-iport_[wwpn,name]. Okay, thanks. This is working. Juergen -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH V5 4/5] Introduce XEN scsiback module
From: Juergen Gross jgr...@suse.com Introduces the XEN pvSCSI backend. With pvSCSI it is possible for a XEN domU to issue SCSI commands to a SCSI LUN assigned to that domU. The SCSI commands are passed to the pvSCSI backend in a driver domain (usually Dom0) which is owner of the physical device. This allows e.g. to use SCSI tape drives in a XEN domU. The code is taken from the pvSCSI implementation in XEN done by Fujitsu based on Linux kernel 2.6.18. Changes from the original version are: - port to upstream kernel - put all code in just one source file - adapt to Linux style guide - use target core infrastructure instead doing pure pass-through - enable module unloading - support SG-list in grant page(s) - support task abort - remove redundant struct backend - allocate resources dynamically - correct minor error in scsiback_fast_flush_area - free allocated resources in case of error during I/O preparation - remove CDB emulation, now handled by target core infrastructure Signed-off-by: Juergen Gross jgr...@suse.com Xen related parts Acked-by: David Vrabel david.vra...@citrix.com --- drivers/xen/Kconfig|9 + drivers/xen/Makefile |1 + drivers/xen/xen-scsiback.c | 2124 3 files changed, 2134 insertions(+) create mode 100644 drivers/xen/xen-scsiback.c diff --git a/drivers/xen/Kconfig b/drivers/xen/Kconfig index 8bc0183..b812462 100644 --- a/drivers/xen/Kconfig +++ b/drivers/xen/Kconfig @@ -172,6 +172,15 @@ config XEN_PCIDEV_BACKEND If in doubt, say m. +config XEN_SCSI_BACKEND + tristate XEN SCSI backend driver + depends on XEN XEN_BACKEND TARGET_CORE + help + The SCSI backend driver allows the kernel to export its SCSI Devices + to other guests via a high-performance shared-memory interface. + Only needed for systems running as XEN driver domains (e.g. Dom0) and + if guests need generic access to SCSI devices. + config XEN_PRIVCMD tristate depends on XEN diff --git a/drivers/xen/Makefile b/drivers/xen/Makefile index 84044b5..2140398 100644 --- a/drivers/xen/Makefile +++ b/drivers/xen/Makefile @@ -36,6 +36,7 @@ obj-$(CONFIG_XEN_ACPI_HOTPLUG_MEMORY) += xen-acpi-memhotplug.o obj-$(CONFIG_XEN_ACPI_HOTPLUG_CPU) += xen-acpi-cpuhotplug.o obj-$(CONFIG_XEN_ACPI_PROCESSOR) += xen-acpi-processor.o obj-$(CONFIG_XEN_EFI) += efi.o +obj-$(CONFIG_XEN_SCSI_BACKEND) += xen-scsiback.o xen-evtchn-y := evtchn.o xen-gntdev-y := gntdev.o xen-gntalloc-y := gntalloc.o diff --git a/drivers/xen/xen-scsiback.c b/drivers/xen/xen-scsiback.c new file mode 100644 index 000..ed7fc6f --- /dev/null +++ b/drivers/xen/xen-scsiback.c @@ -0,0 +1,2124 @@ +/* + * Xen SCSI backend driver + * + * Copyright (c) 2008, FUJITSU Limited + * + * Based on the blkback driver code. + * Adaption to kernel taget core infrastructure taken from vhost/scsi.c + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation; or, when distributed + * separately from the Linux kernel or incorporated into other + * software packages, subject to the following license: + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this source file (the Software), to deal in the Software without + * restriction, including without limitation the rights to use, copy, modify, + * merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include stdarg.h + +#include linux/module.h +#include linux/utsname.h +#include linux/interrupt.h +#include linux/slab.h +#include linux/wait.h +#include linux/sched.h +#include linux/list.h +#include linux/gfp.h +#include linux/delay.h +#include linux/spinlock.h +#include linux/configfs.h + +#include generated/utsrelease.h + +#include scsi/scsi_dbg.h +#include scsi/scsi_eh.h +#include scsi/scsi_tcq.h + +#include target/target_core_base.h +#include target/target_core_fabric.h +#include target/target_core_configfs.h +#include target/target_core_fabric_configfs.h +
[PATCH V5 0/5] Add XEN pvSCSI support
This series adds XEN pvSCSI support. With pvSCSI it is possible to use physical SCSI devices from a XEN domain. The support consists of a backend in the privileged Domain-0 doing the real I/O and a frontend in the unprivileged domU passing I/O-requests to the backend. The code is taken (and adapted) from the original pvSCSI implementation done for Linux 2.6 in 2008 by Fujitsu. [PATCH V5 1/5] xen/events: support threaded irqs for interdomain event channels [PATCH V5 2/5] Add XEN pvSCSI protocol description [PATCH V5 3/5] Introduce xen-scsifront module [PATCH V5 4/5] Introduce XEN scsiback module [PATCH V5 5/5] add xen pvscsi maintainer Changes in V5: - Added patch to support threaded irqs for interdomain event channels - several changes in xen-scsifront after comments from Christoph Hellwig - several changes in xen-scsiback after comments from Christoph Hellwig - several changes in xen-scsiback after comments from James Bottomley Changes in V4: - Re-add define for VSCSIIF_ACT_SCSI_SG_PRESET to vscsiif.h to indicate this action value should not be used in future enhancements Changes in V3: - added some comments to the protocol header file - removed the CDB emulation from xen-scsiback, handled by core target infrastructure - several changes in xen-scsifront after comments from Christoph Hellwig Changes in V2: - use core target infrastructure by backend instead of pure SCSI passthrough - add support for larger SG lists by putting them in grant page(s) - add command abort capability -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH V5 1/5] xen/events: support threaded irqs for interdomain event channels
From: Juergen Gross jgr...@suse.com Export bind_interdomain_evtchn_to_irq() so drivers can use threaded interrupt handlers with: irq = bind_interdomain_evtchn_to_irq(remote_dom, remote_port); if (irq 0) /* error */ ret = request_threaded_irq(...); Signed-off-by: Juergen Gross jgr...@suse.com Acked-by: David Vrabel david.vra...@citrix.com --- drivers/xen/events/events_base.c | 5 +++-- include/xen/events.h | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/xen/events/events_base.c b/drivers/xen/events/events_base.c index 5b5c5ff..b4bca2d 100644 --- a/drivers/xen/events/events_base.c +++ b/drivers/xen/events/events_base.c @@ -900,8 +900,8 @@ static int bind_ipi_to_irq(unsigned int ipi, unsigned int cpu) return irq; } -static int bind_interdomain_evtchn_to_irq(unsigned int remote_domain, - unsigned int remote_port) +int bind_interdomain_evtchn_to_irq(unsigned int remote_domain, + unsigned int remote_port) { struct evtchn_bind_interdomain bind_interdomain; int err; @@ -914,6 +914,7 @@ static int bind_interdomain_evtchn_to_irq(unsigned int remote_domain, return err ? : bind_evtchn_to_irq(bind_interdomain.local_port); } +EXPORT_SYMBOL_GPL(bind_interdomain_evtchn_to_irq); static int find_virq(unsigned int virq, unsigned int cpu) { diff --git a/include/xen/events.h b/include/xen/events.h index 8bee7a7..5321cd9 100644 --- a/include/xen/events.h +++ b/include/xen/events.h @@ -28,6 +28,8 @@ int bind_ipi_to_irqhandler(enum ipi_vector ipi, unsigned long irqflags, const char *devname, void *dev_id); +int bind_interdomain_evtchn_to_irq(unsigned int remote_domain, + unsigned int remote_port); int bind_interdomain_evtchn_to_irqhandler(unsigned int remote_domain, unsigned int remote_port, irq_handler_t handler, -- 1.8.4.5 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH V5 2/5] Add XEN pvSCSI protocol description
From: Juergen Gross jgr...@suse.com Add the definition of pvSCSI protocol used between the pvSCSI frontend in a XEN domU and the pvSCSI backend in a XEN driver domain (usually Dom0). This header was originally provided by Fujitsu for XEN based on Linux 2.6.18. Changes are: - added comment - adapt to Linux style guide - add support for larger SG-lists by putting them in an own granted page - remove stale definitions Signed-off-by: Juergen Gross jgr...@suse.com --- include/xen/interface/io/vscsiif.h | 214 + 1 file changed, 214 insertions(+) create mode 100644 include/xen/interface/io/vscsiif.h diff --git a/include/xen/interface/io/vscsiif.h b/include/xen/interface/io/vscsiif.h new file mode 100644 index 000..4291889 --- /dev/null +++ b/include/xen/interface/io/vscsiif.h @@ -0,0 +1,214 @@ +/** + * vscsiif.h + * + * Based on the blkif.h code. + * + * This interface is to be regarded as a stable API between XEN domains + * running potentially different Linux kernel versions. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the Software), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Copyright(c) FUJITSU Limited 2008. + */ + +#ifndef __XEN__PUBLIC_IO_SCSI_H__ +#define __XEN__PUBLIC_IO_SCSI_H__ + +#include ring.h +#include ../grant_table.h + +/* + * Front-back notifications: When enqueuing a new request, sending a + * notification can be made conditional on req_event (i.e., the generic + * hold-off mechanism provided by the ring macros). Backends must set + * req_event appropriately (e.g., using RING_FINAL_CHECK_FOR_REQUESTS()). + * + * Back-front notifications: When enqueuing a new response, sending a + * notification can be made conditional on rsp_event (i.e., the generic + * hold-off mechanism provided by the ring macros). Frontends must set + * rsp_event appropriately (e.g., using RING_FINAL_CHECK_FOR_RESPONSES()). + */ + +/* + * Feature and Parameter Negotiation + * = + * The two halves of a Xen pvSCSI driver utilize nodes within the XenStore to + * communicate capabilities and to negotiate operating parameters. This + * section enumerates these nodes which reside in the respective front and + * backend portions of the XenStore, following the XenBus convention. + * + * All data in the XenStore is stored as strings. Nodes specifying numeric + * values are encoded in decimal. Integer value ranges listed below are + * expressed as fixed sized integer types capable of storing the conversion + * of a properly formated node string, without loss of information. + * + * Any specified default value is in effect if the corresponding XenBus node + * is not present in the XenStore. + * + * XenStore nodes in sections marked PRIVATE are solely for use by the + * driver side whose XenBus tree contains them. + * + * + *Backend XenBus Nodes + * + * + *-- Backend Device Identification (PRIVATE) -- + * + * p-devname + * Values: string + * + * A free string used to identify the physical device (e.g. a disk name). + * + * p-dev + * Values: string + * + * A string specifying the backend device: either a 4-tuple h:c:t:l + * (host, controller, target, lun, all integers), or a WWN (e.g. + * naa.60014054ac780582). + * + * v-dev + * Values: string + * + * A string specifying the frontend device in form of a 4-tuple h:c:t:l + * (host, controller, target, lun, all integers). + * + *- Features - + * + * feature-sg-grant + * Values: uint16_t + * Default Value: 0 + * + * Specifies the maximum number of scatter/gather elements in grant pages + *
[PATCH V5 3/5] Introduce xen-scsifront module
From: Juergen Gross jgr...@suse.com Introduces the XEN pvSCSI frontend. With pvSCSI it is possible for a XEN domU to issue SCSI commands to a SCSI LUN assigned to that domU. The SCSI commands are passed to the pvSCSI backend in a driver domain (usually Dom0) which is owner of the physical device. This allows e.g. to use SCSI tape drives in a XEN domU. The code is taken from the pvSCSI implementation in XEN done by Fujitsu based on Linux kernel 2.6.18. Changes from the original version are: - port to upstream kernel - put all code in just one source file - move module to appropriate location in kernel tree - adapt to Linux style guide - some minor code simplifications - replace constants with defines - remove not used defines - add support for larger SG lists by putting them in a granted page Signed-off-by: Juergen Gross jgr...@suse.com Xen related parts Acked-by: David Vrabel david.vra...@citrix.com --- drivers/scsi/Kconfig |9 + drivers/scsi/Makefile|1 + drivers/scsi/xen-scsifront.c | 1017 ++ 3 files changed, 1027 insertions(+) create mode 100644 drivers/scsi/xen-scsifront.c diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig index 18a3358..9130df1 100644 --- a/drivers/scsi/Kconfig +++ b/drivers/scsi/Kconfig @@ -576,6 +576,15 @@ config VMWARE_PVSCSI To compile this driver as a module, choose M here: the module will be called vmw_pvscsi. +config XEN_SCSI_FRONTEND + tristate XEN SCSI frontend driver + depends on SCSI XEN + help + The XEN SCSI frontend driver allows the kernel to access SCSI Devices + within another guest OS (usually Dom0). + Only needed if the kernel is running in a XEN guest and generic + SCSI access to a device is needed. + config HYPERV_STORAGE tristate Microsoft Hyper-V virtual storage driver depends on SCSI HYPERV diff --git a/drivers/scsi/Makefile b/drivers/scsi/Makefile index 5f0d299..59f1ce6 100644 --- a/drivers/scsi/Makefile +++ b/drivers/scsi/Makefile @@ -141,6 +141,7 @@ obj-$(CONFIG_SCSI_ESAS2R) += esas2r/ obj-$(CONFIG_SCSI_PMCRAID) += pmcraid.o obj-$(CONFIG_SCSI_VIRTIO) += virtio_scsi.o obj-$(CONFIG_VMWARE_PVSCSI)+= vmw_pvscsi.o +obj-$(CONFIG_XEN_SCSI_FRONTEND)+= xen-scsifront.o obj-$(CONFIG_HYPERV_STORAGE) += hv_storvsc.o obj-$(CONFIG_ARM) += arm/ diff --git a/drivers/scsi/xen-scsifront.c b/drivers/scsi/xen-scsifront.c new file mode 100644 index 000..f54312e --- /dev/null +++ b/drivers/scsi/xen-scsifront.c @@ -0,0 +1,1017 @@ +/* + * Xen SCSI frontend driver + * + * Copyright (c) 2008, FUJITSU Limited + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation; or, when distributed + * separately from the Linux kernel or incorporated into other + * software packages, subject to the following license: + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this source file (the Software), to deal in the Software without + * restriction, including without limitation the rights to use, copy, modify, + * merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#define DEBUG + +#include linux/module.h +#include linux/kernel.h +#include linux/device.h +#include linux/wait.h +#include linux/interrupt.h +#include linux/spinlock.h +#include linux/sched.h +#include linux/blkdev.h +#include linux/pfn.h +#include linux/slab.h + +#include scsi/scsi_cmnd.h +#include scsi/scsi_device.h +#include scsi/scsi.h +#include scsi/scsi_host.h + +#include xen/xen.h +#include xen/xenbus.h +#include xen/grant_table.h +#include xen/events.h +#include xen/page.h + +#include xen/interface/grant_table.h +#include xen/interface/io/vscsiif.h +#include xen/interface/io/protocols.h + +#include asm/xen/hypervisor.h + + +#define GRANT_INVALID_REF 0 + +#define VSCSIFRONT_OP_ADD_LUN 1 +#define VSCSIFRONT_OP_DEL_LUN 2 + +#define DEFAULT_TASK_COMM_LEN TASK_COMM_LEN + +/* tuning point*/ +#define VSCSIIF_DEFAULT_CMD_PER_LUN 10 +#define VSCSIIF_MAX_TARGET 64 +#define
[PATCH V5 5/5] add xen pvscsi maintainer
From: Juergen Gross jgr...@suse.com Add myself as maintainer for the Xen pvSCSI stuff. Signed-off-by: Juergen Gross jgr...@suse.com --- MAINTAINERS | 8 1 file changed, 8 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index aefa948..360f86f 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -10086,6 +10086,14 @@ S: Supported F: drivers/block/xen-blkback/* F: drivers/block/xen* +XEN PVSCSI DRIVERS +M: Juergen Gross jgr...@suse.com +L: xen-de...@lists.xenproject.org (moderated for non-subscribers) +S: Supported +F: drivers/scsi/xen-scsifront.c +F: drivers/xen/xen-scsiback.c +F: include/xen/interface/io/vscsiif.h + XEN SWIOTLB SUBSYSTEM M: Konrad Rzeszutek Wilk konrad.w...@oracle.com L: xen-de...@lists.xenproject.org (moderated for non-subscribers) -- 1.8.4.5 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] tcm_fc: Replace rcu_assign_pointer() with RCU_INIT_POINTER()
The use of rcu_assign_pointer() is NULLing out the pointer. According to RCU_INIT_POINTER()'s block comment: 1. This use of RCU_INIT_POINTER() is NULLing out the pointer it is better to use it instead of rcu_assign_pointer() because it has a smaller overhead. The following Coccinelle semantic patch was used: @@ @@ - rcu_assign_pointer + RCU_INIT_POINTER (..., NULL) Signed-off-by: Andreea-Cristina Bernat bernat@gmail.com --- drivers/target/tcm_fc/tfc_sess.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/target/tcm_fc/tfc_sess.c b/drivers/target/tcm_fc/tfc_sess.c index 21ce508..ccee7e3 100644 --- a/drivers/target/tcm_fc/tfc_sess.c +++ b/drivers/target/tcm_fc/tfc_sess.c @@ -98,7 +98,7 @@ static void ft_tport_delete(struct ft_tport *tport) ft_sess_delete_all(tport); lport = tport-lport; BUG_ON(tport != lport-prov[FC_TYPE_FCP]); - rcu_assign_pointer(lport-prov[FC_TYPE_FCP], NULL); + RCU_INIT_POINTER(lport-prov[FC_TYPE_FCP], NULL); tpg = tport-tpg; if (tpg) { -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3 1/3] init / kthread: add module_long_probe_init() and module_long_probe_exit()
On 08/18, Takashi Iwai wrote: #define module_long_probe_init(initfn)\ static int _long_probe_##initfn(void *arg) \ { \ module_put_and_exit(initfn()); \ return 0; \ } \ static int __init __long_probe_##initfn(void) \ { \ struct task_struct *__init_thread = \ kthread_create(_long_probe_##initfn,\ NULL, #initfn); \ if (IS_ERR(__init_thread)) \ return PTR_ERR(__init_thread); \ __module_get(THIS_MODULE); \ wake_up_process(__init_thread); \ return 0; \ } \ module_init(__long_probe_##initfn) ... and module_exit() remains identical as the normal version. Aaaah. This is not true, module_exit() should not call exitfn() if initfn() fails... So _long_probe_##initfn() needs to save the error code which should be checked by module_exit(). But, it's really a small difference, and I don't mind much which way to take, too. Agreed. Oleg. -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/3] scsi_debug: give unit attention and other errors precedence over TSF
Doug == Douglas Gilbert dgilb...@interlog.com writes: Doug Give existing errors priority over the generation of Task Set Full Doug (TSF) errors. So that max_queue is not exceeded, existing errors Doug may be sent back in the invocation thread. This is done so errors Doug like Unit Attentions are not hidden and lost by either max_queue Doug exceeded or real/injected TSFs. Doug Signed-off-by: Douglas Gilbert dgilb...@interlog.com Reviewed-by: Martin K. Petersen martin.peter...@oracle.com -- Martin K. Petersen Oracle Linux Engineering -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/3] scsi_debug: scsi_cmnd-cmnd check and casts unnecessary
Doug == Douglas Gilbert dgilb...@interlog.com writes: Doug This patch removes a NULL check for the scsi_cmnd::cmnd pointer Doug since many other instances in this driver and elsewhere assume it Doug is valid. Also redundant casts to 'unsigned char *' are removed as Doug the pointer has that type. Doug Signed-off-by: Douglas Gilbert dgilb...@interlog.com Reviewed-by: Martin K. Petersen martin.peter...@oracle.com -- Martin K. Petersen Oracle Linux Engineering -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 3/3] scsi_debug: bump inquiry version to SPC-4, update version descriptors
Doug == Douglas Gilbert dgilb...@interlog.com writes: Doug Since a lot of functionality from SPC-4 is supported by this Doug driver (e.g. LBP and PI) then bump the default INQUIRY version Doug from SPC-3 to SPC-4. Also update the INQUIRY version descriptors. Doug Signed-off-by: Douglas Gilbert dgilb...@interlog.com Reviewed-by: Martin K. Petersen martin.peter...@oracle.com -- Martin K. Petersen Oracle Linux Engineering -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3 1/3] init / kthread: add module_long_probe_init() and module_long_probe_exit()
At Mon, 18 Aug 2014 14:22:17 +0200, Oleg Nesterov wrote: On 08/18, Takashi Iwai wrote: #define module_long_probe_init(initfn) \ static int _long_probe_##initfn(void *arg) \ { \ module_put_and_exit(initfn()); \ return 0; \ } \ static int __init __long_probe_##initfn(void) \ { \ struct task_struct *__init_thread = \ kthread_create(_long_probe_##initfn,\ NULL, #initfn); \ if (IS_ERR(__init_thread)) \ return PTR_ERR(__init_thread); \ __module_get(THIS_MODULE); \ wake_up_process(__init_thread); \ return 0; \ } \ module_init(__long_probe_##initfn) ... and module_exit() remains identical as the normal version. Aaaah. This is not true, module_exit() should not call exitfn() if initfn() fails... So _long_probe_##initfn() needs to save the error code which should be checked by module_exit(). Oh, right. So we need a reference in the module exit path in anyway, and Luis' version might be shorter in the end. thanks, Takashi -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] libfs: Replace rcu_assign_pointer() with RCU_INIT_POINTER()
The uses of rcu_assign_pointer() are NULLing out the pointers. According to RCU_INIT_POINTER()'s block comment: 1. This use of RCU_INIT_POINTER() is NULLing out the pointer it is better to use it instead of rcu_assign_pointer() because it has a smaller overhead. The following Coccinelle semantic patch was used: @@ @@ - rcu_assign_pointer + RCU_INIT_POINTER (..., NULL) Signed-off-by: Andreea-Cristina Bernat bernat@gmail.com --- drivers/scsi/libfc/fc_libfc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/libfc/fc_libfc.c b/drivers/scsi/libfc/fc_libfc.c index 8d65a51a..c11a638 100644 --- a/drivers/scsi/libfc/fc_libfc.c +++ b/drivers/scsi/libfc/fc_libfc.c @@ -296,9 +296,9 @@ void fc_fc4_deregister_provider(enum fc_fh_type type, struct fc4_prov *prov) BUG_ON(type = FC_FC4_PROV_SIZE); mutex_lock(fc_prov_mutex); if (prov-recv) - rcu_assign_pointer(fc_passive_prov[type], NULL); + RCU_INIT_POINTER(fc_passive_prov[type], NULL); else - rcu_assign_pointer(fc_active_prov[type], NULL); + RCU_INIT_POINTER(fc_active_prov[type], NULL); mutex_unlock(fc_prov_mutex); synchronize_rcu(); } -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3 1/3] init / kthread: add module_long_probe_init() and module_long_probe_exit()
On 08/18, Takashi Iwai wrote: At Mon, 18 Aug 2014 14:22:17 +0200, Oleg Nesterov wrote: On 08/18, Takashi Iwai wrote: #define module_long_probe_init(initfn)\ static int _long_probe_##initfn(void *arg) \ { \ module_put_and_exit(initfn()); \ return 0; \ } \ static int __init __long_probe_##initfn(void) \ { \ struct task_struct *__init_thread = \ kthread_create(_long_probe_##initfn,\ NULL, #initfn); \ if (IS_ERR(__init_thread)) \ return PTR_ERR(__init_thread); \ __module_get(THIS_MODULE); \ wake_up_process(__init_thread); \ return 0; \ } \ module_init(__long_probe_##initfn) ... and module_exit() remains identical as the normal version. Aaaah. This is not true, module_exit() should not call exitfn() if initfn() fails... So _long_probe_##initfn() needs to save the error code which should be checked by module_exit(). Oh, right. So we need a reference in the module exit path in anyway, We only need to save the error code, static int _long_probe_retval; static int _long_probe_##initfn(void *arg) { _long_probe_retval = initfn(); module_put_and_exit(0); /* noreturn */ } static void __long_probe_##exitfn(void) { if (!_long_probe_retval) exitfn(); } and Luis' version might be shorter in the end. I dont't think that shorter does matter in this case. The real difference is sys_delete_module() behaviour if it is called before initfn() completes. And, again, I do not really know which version is better. Oleg. -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] scsi: fix various kernel-doc problems in scsi_error.c
On Sat, 2014-08-16 at 14:15 -0700, Randy Dunlap wrote: From: Randy Dunlap rdun...@infradead.org Convert spaces to tabs in kernel-doc notation. Correct duplicated (copy-paste) kernel-doc comments that are incorrect. Fix kernel-doc warning: Warning(..//drivers/scsi/scsi_error.c:1647): No description found for parameter 'shost' Signed-off-by: Randy Dunlap rdun...@infradead.org Cleaning this stuff up is great, see the notes below... Reviewed-by: Ewan D. Milne emi...@redhat.com --- drivers/scsi/scsi_error.c | 23 --- 1 file changed, 12 insertions(+), 11 deletions(-) Index: lnx-317-rc1/drivers/scsi/scsi_error.c === --- lnx-317-rc1.orig/drivers/scsi/scsi_error.c +++ lnx-317-rc1/drivers/scsi/scsi_error.c @@ -1238,8 +1238,8 @@ retry_tur: /** * scsi_eh_test_devices - check if devices are responding from error recovery. * @cmd_list:scsi commands in error recovery. - * @work_q: queue for commands which still need more error recovery - * @done_q: queue for commands which are finished + * @work_q: queue for commands which still need more error recovery + * @done_q: queue for commands which are finished * @try_stu:boolean on if a STU command should be tried in addition to TUR. There are still tabs instead of spaces after @try_stu. * * Decription: @@ -1373,7 +1373,7 @@ static int scsi_eh_try_stu(struct scsi_c /** * scsi_eh_stu - send START_UNIT if needed * @shost: scsi host being recovered. - * @work_q: list_head for pending commands. + * @work_q: list_head for pending commands. * @done_q: list_head for processed commands. * * Notes: @@ -1436,7 +1436,7 @@ static int scsi_eh_stu(struct Scsi_Host /** * scsi_eh_bus_device_reset - send bdr if needed * @shost: scsi host being recovered. - * @work_q: list_head for pending commands. + * @work_q: list_head for pending commands. * @done_q: list_head for processed commands. * * Notes: @@ -1502,7 +1502,7 @@ static int scsi_eh_bus_device_reset(stru /** * scsi_eh_target_reset - send target reset if needed * @shost: scsi host being recovered. - * @work_q: list_head for pending commands. + * @work_q: list_head for pending commands. * @done_q: list_head for processed commands. * * Notes: @@ -1567,7 +1567,7 @@ static int scsi_eh_target_reset(struct S /** * scsi_eh_bus_reset - send a bus reset * @shost: scsi host being recovered. - * @work_q: list_head for pending commands. + * @work_q: list_head for pending commands. * @done_q: list_head for processed commands. */ static int scsi_eh_bus_reset(struct Scsi_Host *shost, @@ -1638,8 +1638,9 @@ static int scsi_eh_bus_reset(struct Scsi /** * scsi_eh_host_reset - send a host reset - * @work_q: list_head for processed commands. - * @done_q: list_head for processed commands. + * @shost: host to be reset. There is a space before the tab after @shost. + * @work_q: list_head for pending commands. + * @done_q: list_head for processed commands. */ static int scsi_eh_host_reset(struct Scsi_Host *shost, struct list_head *work_q, @@ -1677,8 +1678,8 @@ static int scsi_eh_host_reset(struct Scs /** * scsi_eh_offline_sdevs - offline scsi devices that fail to recover - * @work_q: list_head for processed commands. - * @done_q: list_head for processed commands. + * @work_q: list_head for pending commands. + * @done_q: list_head for processed commands. */ static void scsi_eh_offline_sdevs(struct list_head *work_q, struct list_head *done_q) @@ -2044,7 +2045,7 @@ static void scsi_restart_operations(stru /** * scsi_eh_ready_devs - check device ready state and recover if not. * @shost: host to be recovered. There a space before the tab after @shost. - * @work_q: list_head for pending commands. + * @work_q: list_head for pending commands. * @done_q: list_head for processed commands. */ void scsi_eh_ready_devs(struct Scsi_Host *shost, -- -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] fusion: fix excess parameter kernel-doc warning
On Sat, 2014-08-16 at 14:15 -0700, Randy Dunlap wrote: From: Randy Dunlap rdun...@infradead.org Fix kernel-doc excess parameter warning: Warning(..//drivers/message/fusion/mptbase.c:1411): Excess function parameter 'prod_name' description in 'mpt_get_product_name' Signed-off-by: Randy Dunlap rdun...@infradead.org Cc: dl-mptfusionli...@lsi.com Cc: mpt-fusionlinux@avagotech.com --- drivers/message/fusion/mptbase.c |1 - 1 file changed, 1 deletion(-) Index: lnx-317-rc1/drivers/message/fusion/mptbase.c === --- lnx-317-rc1.orig/drivers/message/fusion/mptbase.c +++ lnx-317-rc1/drivers/message/fusion/mptbase.c @@ -1400,7 +1400,6 @@ mpt_verify_adapter(int iocid, MPT_ADAPTE * @vendor: pci vendor id * @device: pci device id * @revision: pci revision id - * @prod_name: string returned * * Returns product string displayed when driver loads, * in /proc/mpt/summary and /sysfs/class/scsi_host/hostX/version_product -- Goes with commit c9834c70efbaaa1461ec04289d97a842244fb294. Reviewed-by: Ewan D. Milne emi...@redhat.com -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH 13/14] scsi: add support for a blk-mq based I/O path.
-Original Message- From: linux-scsi-ow...@vger.kernel.org [mailto:linux-scsi- ow...@vger.kernel.org] On Behalf Of Christoph Hellwig Sent: Friday, July 18, 2014 3:43 PM To: James Bottomley; linux-scsi@vger.kernel.org Cc: Jens Axboe; Bart Van Assche; Mike Christie; Martin K. Petersen; Robert Elliott; Webb Scales; linux-ker...@vger.kernel.org Subject: [PATCH 13/14] scsi: add support for a blk-mq based I/O path. This patch adds support for an alternate I/O path in the scsi midlayer which uses the blk-mq infrastructure instead of the legacy request code. Use of blk-mq is fully transparent to drivers, although for now a host template field is provided to opt out of blk-mq usage in case any unforseen incompatibilities arise. In general replacing the legacy request code with blk-mq is a simple and mostly mechanical transformation. The biggest exception is the new code that deals with the fact the I/O submissions in blk-mq must happen from process context, which slightly complicates the I/O completion handler. The second biggest differences is that blk-mq is build around the concept of preallocated requests that also include driver specific data, which in SCSI context means the scsi_cmnd structure. This completely avoids dynamic memory allocations for the fast path through I/O submission. Due the preallocated requests the MQ code path exclusively uses the host- wide shared tag allocator instead of a per-LUN one. This only affects drivers actually using the block layer provided tag allocator instead of their own. Unlike the old path blk-mq always provides a tag, although drivers don't have to use it. For now the blk-mq path is disable by defauly and must be enabled using the use_blk_mq module parameter. Once the remaining work in the block layer to make blk-mq more suitable for slow devices is complete I hope to make it the default and eventually even remove the old code path. Based on the earlier scsi-mq prototype by Nicholas Bellinger. Thanks to Bart Van Assche and Robert Elliot for testing, benchmarking and various sugestions and code contributions. Signed-off-by: Christoph Hellwig h...@lst.de Reviewed-by: Hannes Reinecke h...@suse.de Reviewed-by: Webb Scales web...@hp.com Acked-by: Jens Axboe ax...@kernel.dk Tested-by: Bart Van Assche bvanass...@acm.org Tested-by: Robert Elliott elli...@hp.com --- drivers/scsi/hosts.c | 35 +++- drivers/scsi/scsi.c | 5 +- drivers/scsi/scsi_lib.c | 464 -- drivers/scsi/scsi_priv.h | 3 + drivers/scsi/scsi_scan.c | 5 +- drivers/scsi/scsi_sysfs.c | 2 + include/scsi/scsi_host.h | 18 +- include/scsi/scsi_tcq.h | 28 ++- 8 files changed, 488 insertions(+), 72 deletions(-) diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c index 0632eee..6de80e3 100644 --- a/drivers/scsi/hosts.c +++ b/drivers/scsi/hosts.c @@ -213,9 +213,24 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev, goto fail; } + if (shost_use_blk_mq(shost)) { + error = scsi_mq_setup_tags(shost); + if (error) + goto fail; + } + + /* + * Note that we allocate the freelist even for the MQ case for now, + * as we need a command set aside for scsi_reset_provider. Having + * the full host freelist and one command available for that is a + * little heavy-handed, but avoids introducing a special allocator + * just for this. Eventually the structure of scsi_reset_provider + * will need a major overhaul. + */ error = scsi_setup_command_freelist(shost); if (error) - goto fail; + goto out_destroy_tags; + if (!shost-shost_gendev.parent) shost-shost_gendev.parent = dev ? dev : platform_bus; @@ -226,7 +241,7 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev, error = device_add(shost-shost_gendev); if (error) - goto out; + goto out_destroy_freelist; pm_runtime_set_active(shost-shost_gendev); pm_runtime_enable(shost-shost_gendev); @@ -279,8 +294,11 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev, device_del(shost-shost_dev); out_del_gendev: device_del(shost-shost_gendev); - out: + out_destroy_freelist: scsi_destroy_command_freelist(shost); + out_destroy_tags: + if (shost_use_blk_mq(shost)) + scsi_mq_destroy_tags(shost); fail: return error; } @@ -309,8 +327,13 @@ static void scsi_host_dev_release(struct device *dev) } scsi_destroy_command_freelist(shost); - if (shost-bqt) - blk_free_tags(shost-bqt); + if (shost_use_blk_mq(shost)) { + if (shost-tag_set.tags) + scsi_mq_destroy_tags(shost); + } else { + if (shost-bqt) +
Re: [PATCH v3 1/3] init / kthread: add module_long_probe_init() and module_long_probe_exit()
On Mon, Aug 18, 2014 at 10:19 AM, Oleg Nesterov o...@redhat.com wrote: And, again, I do not really know which version is better. In Chicago right now -- feedback was it seems the that generally splitting up probe from init might be good in the end, if we do this we won't need a work around for drivers that wait until our grandmothers die on probe, but we certainly will then be penalizing drivers who's init does take over 30 seconds. I'm waiting to see an alternative version of the solution provided as an example on the other thread, maybe it will fix my keyboard issue :) Luis -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 0/17] arcmsr: change note since v13 or v2
Change note: 1,5,7~17/17 since v1.3 are not change. 2,3,4/17 since v2 are not change. 6/17 since v2: 1. pre-define adapter_type value in private data of pci_device_id. 2. remove the arcmsr_define_adapter_type function. Ching Huang ching2...@areca.com.tw -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html