Re: [PATCH 0/5] blk-mq/scsi-mq: support global tags & introduce force_blk_mq
Hi Kashyap, On Tue, Feb 06, 2018 at 11:33:50AM +0530, Kashyap Desai wrote: > > > We still have more than one reply queue ending up completion one CPU. > > > > pci_alloc_irq_vectors(PCI_IRQ_AFFINITY) has to be used, that means > > smp_affinity_enable has to be set as 1, but seems it is the default > setting. > > > > Please see kernel/irq/affinity.c, especially irq_calc_affinity_vectors() > which > > figures out an optimal number of vectors, and the computation is based > on > > cpumask_weight(cpu_possible_mask) now. If all offline CPUs are mapped to > > some of reply queues, these queues won't be active(no request submitted > to > > these queues). The mechanism of PCI_IRQ_AFFINITY basically makes sure > that > > more than one irq vector won't be handled by one same CPU, and the irq > > vector spread is done in irq_create_affinity_masks(). > > > > > Try to reduce MSI-x vector of megaraid_sas or mpt3sas driver via > > > module parameter to simulate the issue. We need more number of Online > > > CPU than reply-queue. > > > > IMO, you don't need to simulate the issue, pci_alloc_irq_vectors( > > PCI_IRQ_AFFINITY) will handle that for you. You can dump the returned > irq > > vector number, num_possible_cpus()/num_online_cpus() and each irq > > vector's affinity assignment. > > > > > We may see completion redirected to original CPU because of > > > "QUEUE_FLAG_SAME_FORCE", but ISR of low level driver can keep one CPU > > > busy in local ISR routine. > > > > Could you dump each irq vector's affinity assignment of your megaraid in > your > > test? > > To quickly reproduce, I restricted to single MSI-x vector on megaraid_sas > driver. System has total 16 online CPUs. I suggest you don't do the restriction of single MSI-x vector, and just use the device supported number of msi-x vector. > > Output of affinity hints. > kernel version: > Linux rhel7.3 4.15.0-rc1+ #2 SMP Mon Feb 5 12:13:34 EST 2018 x86_64 x86_64 > x86_64 GNU/Linux > PCI name is 83:00.0, dump its irq affinity: > irq 105, cpu list 0-3,8-11 In this case, which CPU is selected for handling the interrupt is decided by interrupt controller, and it is easy to cause CPU overload if interrupt controller always selects one same CPU to handle the irq. > > Affinity mask is created properly, but only CPU-0 is overloaded with > interrupt processing. > > # numactl --hardware > available: 2 nodes (0-1) > node 0 cpus: 0 1 2 3 8 9 10 11 > node 0 size: 47861 MB > node 0 free: 46516 MB > node 1 cpus: 4 5 6 7 12 13 14 15 > node 1 size: 64491 MB > node 1 free: 62805 MB > node distances: > node 0 1 > 0: 10 21 > 1: 21 10 > > Output of system activities (sar). (gnice is 100% and it is consumed in > megaraid_sas ISR routine.) > > > 12:44:40 PM CPU %usr %nice %sys %iowait%steal > %irq %soft%guest%gnice %idle > 12:44:41 PM all 6.03 0.0029.98 0.00 > 0.00 0.000.000.000.00 63.99 > 12:44:41 PM 0 0.00 0.00 0.000.00 > 0.00 0.000.000.00 100.00 0 > > > In my test, I used rq_affinity is set to 2. (QUEUE_FLAG_SAME_FORCE). I > also used " host_tagset" V2 patch set for megaraid_sas. > > Using RFC requested in - > "https://marc.info/?l=linux-scsi&m=151601833418346&w=2 " lockup is avoided > (you can noticed that gnice is shifted to softirq. Even though it is 100% > consumed, There is always exit for existing completion loop due to > irqpoll_weight @irq_poll_init(). > > Average:CPU %usr %nice %sys %iowait%steal > %irq %soft%guest%gnice %idle > Average:all 4.25 0.0021.61 0.00 > 0.00 0.00 6.61 0.00 0.00 67.54 > Average: 0 0.00 0.00 0.00 0.00 > 0.00 0.00 100.000.00 0.00 0.00 > > > Hope this clarifies. We need different fix to avoid lockups. Can we > consider using irq poll interface if #CPU is more than Reply queue/MSI-x. > ? Please use the device's supported msi-x vectors number, and see if there is this issue. If there is, you can use irq poll too, which isn't contradictory with the blk-mq approach taken by this patchset. Hope I clarifies too, :-) Thanks, Ming
[Bug 198689] New: Setro has no effect for SCSI device
https://bugzilla.kernel.org/show_bug.cgi?id=198689 Bug ID: 198689 Summary: Setro has no effect for SCSI device Product: SCSI Drivers Version: 2.5 Kernel Version: all Hardware: All OS: Linux Tree: Mainline Status: NEW Severity: high Priority: P1 Component: AACRAID Assignee: scsi_drivers-aacr...@kernel-bugs.osdl.org Reporter: yzlin...@foxmail.com Regression: No Hi, We found a problem when using SCSI device. Setting the read-only attribute to scsi disk by calling "ioctl(fd, BLKROSET, &ro)" only block the first write operation. In detail: 1: set ioctl(fd, BLKROSET, &ro) 2: dd to the block device(as /dev/sdc), write failed 3: dd to the block device again, write successed Above operation can be reproduced by following script: #! /bin/bash DEV=$1 [[ "$DEV" =~ ^/dev/sd ]] || echo "Need a scsi device to reproduce" blockdev --setro $DEV echo $DEV getro is [ $(blockdev --getro $DEV) ] dd if=/dev/zero of=$DEV count=1 echo $DEV getro is [ $(blockdev --getro $1) ] dd if=/dev/zero of=$DEV count=1 Environment: - Kernel: ALL We reproduced this problem in following kernel version: 4.15 4.10, 3.10. And by reference source, we think the problem exist in all versions. - Driver: SCSI it exists only when using SCSI disks, and xen-blk,virtio-blk do not have such a problem Here is a test result: # uname -r 4.15.0+ # ./reproduce.sh /dev/sda /dev/sda getro is [ 1 ] dd: writing to ‘/dev/sda’: Operation not permitted 1+0 records in 0+0 records out 0 bytes (0 B) copied, 0.000258806 s, 0.0 kB/s /dev/sda getro is [ 0 ] 1+0 records in 1+0 records out 512 bytes (512 B) copied, 0.000321595 s, 1.6 MB/s --- -- You are receiving this mail because: You are watching the assignee of the bug.
Re: [PATCH V2 8/8] scsi: hpsa: use blk_mq to solve irq affinity issue
Hello chenxiang, On Tue, Feb 06, 2018 at 10:18:19AM +0800, chenxiang (M) wrote: > 在 2018/2/5 23:20, Ming Lei 写道: > > This patch uses .force_blk_mq to drive HPSA via SCSI_MQ, meantime maps > > each reply queue to blk_mq's hw queue, then .queuecommand can always > > choose the hw queue as the reply queue. And if no any online CPU is > > mapped to one hw queue, request can't be submitted to this hw queue > > at all, finally the irq affinity issue is solved. > > > > Cc: Hannes Reinecke > > Cc: Arun Easi > > Cc: Omar Sandoval , > > Cc: "Martin K. Petersen" , > > Cc: James Bottomley , > > Cc: Christoph Hellwig , > > Cc: Don Brace > > Cc: Kashyap Desai > > Cc: Peter Rivera > > Cc: Paolo Bonzini > > Cc: Mike Snitzer > > Tested-by: Laurence Oberman > > Signed-off-by: Ming Lei > > --- > > drivers/scsi/hpsa.c | 51 > > ++- > > 1 file changed, 34 insertions(+), 17 deletions(-) > > > > diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c > > index 443eabf63a9f..e517a4c74a28 100644 > > --- a/drivers/scsi/hpsa.c > > +++ b/drivers/scsi/hpsa.c > > @@ -51,6 +51,7 @@ > > #include > > #include > > #include > > +#include > > #include > > #include > > #include "hpsa_cmd.h" > > @@ -956,6 +957,13 @@ static struct device_attribute *hpsa_shost_attrs[] = { > > #define HPSA_NRESERVED_CMDS (HPSA_CMDS_RESERVED_FOR_DRIVER +\ > > HPSA_MAX_CONCURRENT_PASSTHRUS) > > +static int hpsa_map_queues(struct Scsi_Host *shost) > > +{ > > +struct ctlr_info *h = shost_to_hba(shost); > > + > > +return blk_mq_pci_map_queues(&shost->tag_set, h->pdev); > > +} > > + > > Hi Lei Ming, > It is okay to use blk_mq_pci_map_queue to solve automatic irq affinity issue > when the first interrupt vector for queues is 0. > But if the first interrupt vector for queues is not 0, we seems couldn't > use blk_mq_pci_map_queue directly, > such as blk_mq_virtio_map_queues, it realizes a interface itself. Is it > possible to provide a general interface for those > situations? I guess it isn't necessary to do that, as you see .map_queues has been introduced to 'scsi_host_template' for dealing driver specific irq vector difference, such as, virtio-pci, 'irq_affinity' is needed for excluding 'pre_vectors' which should serve as virtio config vector. But that should belong to another topic about implementing generic .map_queues interface, and seems not related with this patch, since the usage of blk_mq_pci_map_queues() in this patch is correct. Thanks, Ming
[Bug 198689] Setro has no effect for SCSI device
https://bugzilla.kernel.org/show_bug.cgi?id=198689 Li Ning (yzlin...@foxmail.com) changed: What|Removed |Added Component|AACRAID |Other -- You are receiving this mail because: You are watching the assignee of the bug.
Re: [PATCH V2 7/8] scsi: hpsa: call hpsa_hba_inquiry() after adding host
On 02/05/2018 04:20 PM, Ming Lei wrote: > So that we can decide the default reply queue by the map created > during adding host. > > Cc: Hannes Reinecke > Cc: Arun Easi > Cc: Omar Sandoval , > Cc: "Martin K. Petersen" , > Cc: James Bottomley , > Cc: Christoph Hellwig , > Cc: Don Brace > Cc: Kashyap Desai > Cc: Peter Rivera > Cc: Paolo Bonzini > Cc: Mike Snitzer > Tested-by: Laurence Oberman > Signed-off-by: Ming Lei > --- > drivers/scsi/hpsa.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c > index 287e5eb0723f..443eabf63a9f 100644 > --- a/drivers/scsi/hpsa.c > +++ b/drivers/scsi/hpsa.c > @@ -8691,12 +8691,9 @@ static int hpsa_init_one(struct pci_dev *pdev, const > struct pci_device_id *ent) > /* Disable discovery polling.*/ > h->discovery_polling = 0; > > - > /* Turn the interrupts on so we can service requests */ > h->access.set_intr_mask(h, HPSA_INTR_ON); > > - hpsa_hba_inquiry(h); > - > h->lastlogicals = kzalloc(sizeof(*(h->lastlogicals)), GFP_KERNEL); > if (!h->lastlogicals) > dev_info(&h->pdev->dev, > @@ -8707,6 +8704,8 @@ static int hpsa_init_one(struct pci_dev *pdev, const > struct pci_device_id *ent) > if (rc) > goto clean7; /* perf, sg, cmd, irq, shost, pci, lu, aer/h */ > > + hpsa_hba_inquiry(h); > + > /* Monitor the controller for firmware lockups */ > h->heartbeat_sample_interval = HEARTBEAT_SAMPLE_INTERVAL; > INIT_DELAYED_WORK(&h->monitor_ctlr_work, hpsa_monitor_ctlr_worker); > Reviewed-by: Hannes Reinecke Cheers, Hannes -- Dr. Hannes ReineckeTeamlead Storage & Networking h...@suse.de +49 911 74053 688 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG Nürnberg)
Re: [PATCH V2 8/8] scsi: hpsa: use blk_mq to solve irq affinity issue
On 02/05/2018 04:20 PM, Ming Lei wrote: > This patch uses .force_blk_mq to drive HPSA via SCSI_MQ, meantime maps > each reply queue to blk_mq's hw queue, then .queuecommand can always > choose the hw queue as the reply queue. And if no any online CPU is > mapped to one hw queue, request can't be submitted to this hw queue > at all, finally the irq affinity issue is solved. > > Cc: Hannes Reinecke > Cc: Arun Easi > Cc: Omar Sandoval , > Cc: "Martin K. Petersen" , > Cc: James Bottomley , > Cc: Christoph Hellwig , > Cc: Don Brace > Cc: Kashyap Desai > Cc: Peter Rivera > Cc: Paolo Bonzini > Cc: Mike Snitzer > Tested-by: Laurence Oberman > Signed-off-by: Ming Lei > --- > drivers/scsi/hpsa.c | 51 ++- > 1 file changed, 34 insertions(+), 17 deletions(-) > > diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c > index 443eabf63a9f..e517a4c74a28 100644 > --- a/drivers/scsi/hpsa.c > +++ b/drivers/scsi/hpsa.c > @@ -51,6 +51,7 @@ > #include > #include > #include > +#include > #include > #include > #include "hpsa_cmd.h" > @@ -956,6 +957,13 @@ static struct device_attribute *hpsa_shost_attrs[] = { > #define HPSA_NRESERVED_CMDS (HPSA_CMDS_RESERVED_FOR_DRIVER +\ >HPSA_MAX_CONCURRENT_PASSTHRUS) > > +static int hpsa_map_queues(struct Scsi_Host *shost) > +{ > +struct ctlr_info *h = shost_to_hba(shost); > + > +return blk_mq_pci_map_queues(&shost->tag_set, h->pdev); > +} > + > static struct scsi_host_template hpsa_driver_template = { > .module = THIS_MODULE, > .name = HPSA, > @@ -974,10 +982,13 @@ static struct scsi_host_template hpsa_driver_template = > { > #ifdef CONFIG_COMPAT > .compat_ioctl = hpsa_compat_ioctl, > #endif > + .map_queues = hpsa_map_queues, > .sdev_attrs = hpsa_sdev_attrs, > .shost_attrs = hpsa_shost_attrs, > .max_sectors = 1024, > .no_write_same = 1, > + .force_blk_mq = 1, > + .host_tagset = 1, > }; > > static inline u32 next_command(struct ctlr_info *h, u8 q) > @@ -1045,11 +1056,7 @@ static void set_performant_mode(struct ctlr_info *h, > struct CommandList *c, > c->busaddr |= 1 | (h->blockFetchTable[c->Header.SGList] << 1); > if (unlikely(!h->msix_vectors)) > return; > - if (likely(reply_queue == DEFAULT_REPLY_QUEUE)) > - c->Header.ReplyQueue = > - raw_smp_processor_id() % h->nreply_queues; > - else > - c->Header.ReplyQueue = reply_queue % h->nreply_queues; > + c->Header.ReplyQueue = reply_queue; > } > } > > @@ -1063,10 +1070,7 @@ static void set_ioaccel1_performant_mode(struct > ctlr_info *h, >* Tell the controller to post the reply to the queue for this >* processor. This seems to give the best I/O throughput. >*/ > - if (likely(reply_queue == DEFAULT_REPLY_QUEUE)) > - cp->ReplyQueue = smp_processor_id() % h->nreply_queues; > - else > - cp->ReplyQueue = reply_queue % h->nreply_queues; > + cp->ReplyQueue = reply_queue; > /* >* Set the bits in the address sent down to include: >* - performant mode bit (bit 0) > @@ -1087,10 +1091,7 @@ static void set_ioaccel2_tmf_performant_mode(struct > ctlr_info *h, > /* Tell the controller to post the reply to the queue for this >* processor. This seems to give the best I/O throughput. >*/ > - if (likely(reply_queue == DEFAULT_REPLY_QUEUE)) > - cp->reply_queue = smp_processor_id() % h->nreply_queues; > - else > - cp->reply_queue = reply_queue % h->nreply_queues; > + cp->reply_queue = reply_queue; > /* Set the bits in the address sent down to include: >* - performant mode bit not used in ioaccel mode 2 >* - pull count (bits 0-3) > @@ -1109,10 +1110,7 @@ static void set_ioaccel2_performant_mode(struct > ctlr_info *h, >* Tell the controller to post the reply to the queue for this >* processor. This seems to give the best I/O throughput. >*/ > - if (likely(reply_queue == DEFAULT_REPLY_QUEUE)) > - cp->reply_queue = smp_processor_id() % h->nreply_queues; > - else > - cp->reply_queue = reply_queue % h->nreply_queues; > + cp->reply_queue = reply_queue; > /* >* Set the bits in the address sent down to include: >* - performant mode bit not used in ioaccel mode 2 > @@ -1152,11 +1150,27 @@ static void > dial_up_lockup_detection_on_fw_flash_complete(struct ctlr_info *h, > h->heartbeat_sample_interval = HEARTBEAT_SAMPLE_INTERVAL; > } > > +static unsigned get_reply_queue(struct ctlr_info *h, struct CommandList *c) > +{ > + struct scsi_cmnd *cmd = c->scsi_cmd; > + int *map; > + > + if (cmd && cmd->request) { > +
Re: [PATCH V2 8/8] scsi: hpsa: use blk_mq to solve irq affinity issue
On Tue, Feb 06, 2018 at 09:39:26AM +0100, Hannes Reinecke wrote: > On 02/05/2018 04:20 PM, Ming Lei wrote: > > This patch uses .force_blk_mq to drive HPSA via SCSI_MQ, meantime maps > > each reply queue to blk_mq's hw queue, then .queuecommand can always > > choose the hw queue as the reply queue. And if no any online CPU is > > mapped to one hw queue, request can't be submitted to this hw queue > > at all, finally the irq affinity issue is solved. > > > > Cc: Hannes Reinecke > > Cc: Arun Easi > > Cc: Omar Sandoval , > > Cc: "Martin K. Petersen" , > > Cc: James Bottomley , > > Cc: Christoph Hellwig , > > Cc: Don Brace > > Cc: Kashyap Desai > > Cc: Peter Rivera > > Cc: Paolo Bonzini > > Cc: Mike Snitzer > > Tested-by: Laurence Oberman > > Signed-off-by: Ming Lei > > --- > > drivers/scsi/hpsa.c | 51 > > ++- > > 1 file changed, 34 insertions(+), 17 deletions(-) > > > > diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c > > index 443eabf63a9f..e517a4c74a28 100644 > > --- a/drivers/scsi/hpsa.c > > +++ b/drivers/scsi/hpsa.c > > @@ -51,6 +51,7 @@ > > #include > > #include > > #include > > +#include > > #include > > #include > > #include "hpsa_cmd.h" > > @@ -956,6 +957,13 @@ static struct device_attribute *hpsa_shost_attrs[] = { > > #define HPSA_NRESERVED_CMDS(HPSA_CMDS_RESERVED_FOR_DRIVER +\ > > HPSA_MAX_CONCURRENT_PASSTHRUS) > > > > +static int hpsa_map_queues(struct Scsi_Host *shost) > > +{ > > +struct ctlr_info *h = shost_to_hba(shost); > > + > > +return blk_mq_pci_map_queues(&shost->tag_set, h->pdev); > > +} > > + > > static struct scsi_host_template hpsa_driver_template = { > > .module = THIS_MODULE, > > .name = HPSA, > > @@ -974,10 +982,13 @@ static struct scsi_host_template hpsa_driver_template > > = { > > #ifdef CONFIG_COMPAT > > .compat_ioctl = hpsa_compat_ioctl, > > #endif > > + .map_queues = hpsa_map_queues, > > .sdev_attrs = hpsa_sdev_attrs, > > .shost_attrs = hpsa_shost_attrs, > > .max_sectors = 1024, > > .no_write_same = 1, > > + .force_blk_mq = 1, > > + .host_tagset = 1, > > }; > > > > static inline u32 next_command(struct ctlr_info *h, u8 q) > > @@ -1045,11 +1056,7 @@ static void set_performant_mode(struct ctlr_info *h, > > struct CommandList *c, > > c->busaddr |= 1 | (h->blockFetchTable[c->Header.SGList] << 1); > > if (unlikely(!h->msix_vectors)) > > return; > > - if (likely(reply_queue == DEFAULT_REPLY_QUEUE)) > > - c->Header.ReplyQueue = > > - raw_smp_processor_id() % h->nreply_queues; > > - else > > - c->Header.ReplyQueue = reply_queue % h->nreply_queues; > > + c->Header.ReplyQueue = reply_queue; > > } > > } > > > > @@ -1063,10 +1070,7 @@ static void set_ioaccel1_performant_mode(struct > > ctlr_info *h, > > * Tell the controller to post the reply to the queue for this > > * processor. This seems to give the best I/O throughput. > > */ > > - if (likely(reply_queue == DEFAULT_REPLY_QUEUE)) > > - cp->ReplyQueue = smp_processor_id() % h->nreply_queues; > > - else > > - cp->ReplyQueue = reply_queue % h->nreply_queues; > > + cp->ReplyQueue = reply_queue; > > /* > > * Set the bits in the address sent down to include: > > * - performant mode bit (bit 0) > > @@ -1087,10 +1091,7 @@ static void set_ioaccel2_tmf_performant_mode(struct > > ctlr_info *h, > > /* Tell the controller to post the reply to the queue for this > > * processor. This seems to give the best I/O throughput. > > */ > > - if (likely(reply_queue == DEFAULT_REPLY_QUEUE)) > > - cp->reply_queue = smp_processor_id() % h->nreply_queues; > > - else > > - cp->reply_queue = reply_queue % h->nreply_queues; > > + cp->reply_queue = reply_queue; > > /* Set the bits in the address sent down to include: > > * - performant mode bit not used in ioaccel mode 2 > > * - pull count (bits 0-3) > > @@ -1109,10 +1110,7 @@ static void set_ioaccel2_performant_mode(struct > > ctlr_info *h, > > * Tell the controller to post the reply to the queue for this > > * processor. This seems to give the best I/O throughput. > > */ > > - if (likely(reply_queue == DEFAULT_REPLY_QUEUE)) > > - cp->reply_queue = smp_processor_id() % h->nreply_queues; > > - else > > - cp->reply_queue = reply_queue % h->nreply_queues; > > + cp->reply_queue = reply_queue; > > /* > > * Set the bits in the address sent down to include: > > * - performant mode bit not used in ioaccel mode 2 > > @@ -1152,11 +1150,27 @@ static void > > dial_up_lockup_detection_on_fw_flash_complete(struct ctlr_info *h, > > h->heartbeat_sample_interval = HEARTBEAT_SAMPLE_INTERVAL;
[PATCH/RFC 3/6] usb: gadget: Add NO_DMA dummies for DMA mapping API
Add dummies for usb_gadget_{,un}map_request{,_by_dev}(), to allow compile-testing if NO_DMA=y. This prevents the following from showing up later: ERROR: "usb_gadget_unmap_request_by_dev" [drivers/usb/renesas_usbhs/renesas_usbhs.ko] undefined! ERROR: "usb_gadget_map_request_by_dev" [drivers/usb/renesas_usbhs/renesas_usbhs.ko] undefined! ERROR: "usb_gadget_map_request" [drivers/usb/mtu3/mtu3.ko] undefined! ERROR: "usb_gadget_unmap_request" [drivers/usb/mtu3/mtu3.ko] undefined! ERROR: "usb_gadget_map_request" [drivers/usb/gadget/udc/renesas_usb3.ko] undefined! ERROR: "usb_gadget_unmap_request" [drivers/usb/gadget/udc/renesas_usb3.ko] undefined! Signed-off-by: Geert Uytterhoeven --- include/linux/usb/gadget.h | 12 1 file changed, 12 insertions(+) diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index 66a5cff7ee142d6a..b68e7f9b210be122 100644 --- a/include/linux/usb/gadget.h +++ b/include/linux/usb/gadget.h @@ -805,6 +805,7 @@ int usb_otg_descriptor_init(struct usb_gadget *gadget, /* utility to simplify map/unmap of usb_requests to/from DMA */ +#ifdef CONFIG_HAS_DMA extern int usb_gadget_map_request_by_dev(struct device *dev, struct usb_request *req, int is_in); extern int usb_gadget_map_request(struct usb_gadget *gadget, @@ -814,6 +815,17 @@ extern void usb_gadget_unmap_request_by_dev(struct device *dev, struct usb_request *req, int is_in); extern void usb_gadget_unmap_request(struct usb_gadget *gadget, struct usb_request *req, int is_in); +#else /* !CONFIG_HAS_DMA */ +static inline int usb_gadget_map_request_by_dev(struct device *dev, + struct usb_request *req, int is_in) { return -ENOSYS; } +static inline int usb_gadget_map_request(struct usb_gadget *gadget, + struct usb_request *req, int is_in) { return -ENOSYS; } + +static inline void usb_gadget_unmap_request_by_dev(struct device *dev, + struct usb_request *req, int is_in) { } +static inline void usb_gadget_unmap_request(struct usb_gadget *gadget, + struct usb_request *req, int is_in) { } +#endif /* !CONFIG_HAS_DMA */ /*-*/ -- 2.7.4
[PATCH/RFC 5/6] scsi: Add NO_DMA dummies for SCSI DMA mapping API
Add dummies for scsi_dma_{,un}map(), to allow compile-testing if NO_DMA=y. This prevents the following from showing up later: ERROR: "scsi_dma_unmap" [drivers/firewire/firewire-sbp2.ko] undefined! ERROR: "scsi_dma_map" [drivers/firewire/firewire-sbp2.ko] undefined! Signed-off-by: Geert Uytterhoeven --- include/scsi/scsi_cmnd.h | 5 + 1 file changed, 5 insertions(+) diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h index d8d4a902a88dedbc..6a123d1dd2f80624 100644 --- a/include/scsi/scsi_cmnd.h +++ b/include/scsi/scsi_cmnd.h @@ -171,8 +171,13 @@ extern void scsi_kunmap_atomic_sg(void *virt); extern int scsi_init_io(struct scsi_cmnd *cmd); +#ifdef CONFIG_SCSI_DMA extern int scsi_dma_map(struct scsi_cmnd *cmd); extern void scsi_dma_unmap(struct scsi_cmnd *cmd); +#else /* !CONFIG_SCSI_DMA */ +static inline int scsi_dma_map(struct scsi_cmnd *cmd) { return -ENOSYS; } +static inline void scsi_dma_unmap(struct scsi_cmnd *cmd) { } +#endif /* !CONFIG_SCSI_DMA */ static inline unsigned scsi_sg_count(struct scsi_cmnd *cmd) { -- 2.7.4
[PATCH/RFC 4/6] mm: Add NO_DMA dummies for DMA pool API
Add dummies for dma{,m}_pool_{create,destroy,alloc,free}(), to allow compile-testing if NO_DMA=y. This prevents the following from showing up later: ERROR: "dma_pool_destroy" [drivers/usb/mtu3/mtu3.ko] undefined! ERROR: "dma_pool_free" [drivers/usb/mtu3/mtu3.ko] undefined! ERROR: "dma_pool_alloc" [drivers/usb/mtu3/mtu3.ko] undefined! ERROR: "dma_pool_create" [drivers/usb/mtu3/mtu3.ko] undefined! ERROR: "dma_pool_destroy" [drivers/scsi/hisi_sas/hisi_sas_main.ko] undefined! ERROR: "dma_pool_free" [drivers/scsi/hisi_sas/hisi_sas_main.ko] undefined! ERROR: "dma_pool_alloc" [drivers/scsi/hisi_sas/hisi_sas_main.ko] undefined! ERROR: "dma_pool_create" [drivers/scsi/hisi_sas/hisi_sas_main.ko] undefined! ERROR: "dma_pool_alloc" [drivers/mailbox/bcm-pdc-mailbox.ko] undefined! ERROR: "dma_pool_free" [drivers/mailbox/bcm-pdc-mailbox.ko] undefined! ERROR: "dma_pool_create" [drivers/mailbox/bcm-pdc-mailbox.ko] undefined! ERROR: "dma_pool_destroy" [drivers/mailbox/bcm-pdc-mailbox.ko] undefined! Signed-off-by: Geert Uytterhoeven --- include/linux/dmapool.h | 21 +++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/include/linux/dmapool.h b/include/linux/dmapool.h index 53ba737505df31c7..adeb5e56c3ad73a8 100644 --- a/include/linux/dmapool.h +++ b/include/linux/dmapool.h @@ -16,6 +16,7 @@ struct device; +#ifdef CONFIG_HAS_DMA struct dma_pool *dma_pool_create(const char *name, struct device *dev, size_t size, size_t align, size_t allocation); @@ -23,6 +24,17 @@ void dma_pool_destroy(struct dma_pool *pool); void *dma_pool_alloc(struct dma_pool *pool, gfp_t mem_flags, dma_addr_t *handle); +void dma_pool_free(struct dma_pool *pool, void *vaddr, dma_addr_t addr); +#else /* !CONFIG_HAS_DMA */ +static inline struct dma_pool *dma_pool_create(const char *name, + struct device *dev, size_t size, size_t align, size_t allocation) +{ return NULL; } +static inline void dma_pool_destroy(struct dma_pool *pool) { } +static inline void *dma_pool_alloc(struct dma_pool *pool, gfp_t mem_flags, + dma_addr_t *handle) { return NULL; } +static inline void dma_pool_free(struct dma_pool *pool, void *vaddr, +dma_addr_t addr) { } +#endif /* !CONFIG_HAS_DMA */ static inline void *dma_pool_zalloc(struct dma_pool *pool, gfp_t mem_flags, dma_addr_t *handle) @@ -30,14 +42,19 @@ static inline void *dma_pool_zalloc(struct dma_pool *pool, gfp_t mem_flags, return dma_pool_alloc(pool, mem_flags | __GFP_ZERO, handle); } -void dma_pool_free(struct dma_pool *pool, void *vaddr, dma_addr_t addr); - /* * Managed DMA pool */ +#ifdef CONFIG_HAS_DMA struct dma_pool *dmam_pool_create(const char *name, struct device *dev, size_t size, size_t align, size_t allocation); void dmam_pool_destroy(struct dma_pool *pool); +#else /* !CONFIG_HAS_DMA */ +static inline struct dma_pool *dmam_pool_create(const char *name, + struct device *dev, size_t size, size_t align, size_t allocation) +{ return NULL; } +static inline void dmam_pool_destroy(struct dma_pool *pool) { } +#endif /* !CONFIG_HAS_DMA */ #endif -- 2.7.4
[PATCH/RFC 6/6] Treewide: Remove depends on HAS_DMA in case of platform dependency
Remove dependencies on HAS_DMA where a Kconfig symbol depends on another symbol that implies HAS_DMA, and, optionally, on "|| COMPILE_TEST". In most cases this other symbol is an architecture or platform specific symbol, or PCI. Generic symbols and drivers without platform dependencies keep their dependencies on HAS_DMA, to prevent compiling subsystems or drivers that cannot work anyway. This simplifies the dependencies, and allows to improve compile-testing. Notes: - FSL_FMAN keeps its dependency on HAS_DMA, as it calls set_dma_ops(), which does not exist if HAS_DMA=n (Do we need a dummy? The use of set_dma_ops() in this driver is questionable), - SND_SOC_LPASS_IPQ806X and SND_SOC_LPASS_PLATFORM loose their dependency on HAS_DMA, as they are selected from SND_SOC_APQ8016_SBC. Signed-off-by: Geert Uytterhoeven --- drivers/ata/Kconfig | 2 -- drivers/crypto/Kconfig | 14 +++-- drivers/firewire/Kconfig| 1 - drivers/fpga/Kconfig| 1 - drivers/gpu/ipu-v3/Kconfig | 1 - drivers/i2c/busses/Kconfig | 3 -- drivers/iio/adc/Kconfig | 3 -- drivers/iommu/Kconfig | 5 ++-- drivers/lightnvm/Kconfig| 2 +- drivers/mailbox/Kconfig | 2 -- drivers/media/pci/dt3155/Kconfig| 1 - drivers/media/pci/solo6x10/Kconfig | 1 - drivers/media/pci/sta2x11/Kconfig | 1 - drivers/media/pci/tw5864/Kconfig| 1 - drivers/media/pci/tw686x/Kconfig| 1 - drivers/media/platform/Kconfig | 40 - drivers/media/platform/am437x/Kconfig | 2 +- drivers/media/platform/atmel/Kconfig| 4 +-- drivers/media/platform/blackfin/Kconfig | 1 - drivers/media/platform/davinci/Kconfig | 6 drivers/media/platform/marvell-ccic/Kconfig | 3 +- drivers/media/platform/rcar-vin/Kconfig | 2 +- drivers/media/platform/soc_camera/Kconfig | 3 +- drivers/media/platform/sti/c8sectpfe/Kconfig| 2 +- drivers/mmc/host/Kconfig| 10 ++- drivers/mtd/nand/Kconfig| 8 ++--- drivers/mtd/spi-nor/Kconfig | 2 +- drivers/net/ethernet/amd/Kconfig| 2 +- drivers/net/ethernet/apm/xgene-v2/Kconfig | 1 - drivers/net/ethernet/apm/xgene/Kconfig | 1 - drivers/net/ethernet/arc/Kconfig| 6 ++-- drivers/net/ethernet/broadcom/Kconfig | 2 -- drivers/net/ethernet/calxeda/Kconfig| 2 +- drivers/net/ethernet/hisilicon/Kconfig | 2 +- drivers/net/ethernet/marvell/Kconfig| 8 ++--- drivers/net/ethernet/mellanox/mlxsw/Kconfig | 2 +- drivers/net/ethernet/renesas/Kconfig| 2 -- drivers/net/ethernet/socionext/Kconfig | 4 +-- drivers/net/wireless/broadcom/brcm80211/Kconfig | 1 - drivers/net/wireless/quantenna/qtnfmac/Kconfig | 2 +- drivers/remoteproc/Kconfig | 1 - drivers/scsi/hisi_sas/Kconfig | 2 +- drivers/spi/Kconfig | 12 ++-- drivers/staging/media/davinci_vpfe/Kconfig | 1 - drivers/staging/media/omap4iss/Kconfig | 1 - drivers/staging/vc04_services/Kconfig | 1 - drivers/tty/serial/Kconfig | 4 --- drivers/usb/gadget/udc/Kconfig | 4 +-- drivers/usb/mtu3/Kconfig| 2 +- drivers/video/fbdev/Kconfig | 3 +- sound/soc/bcm/Kconfig | 3 +- sound/soc/kirkwood/Kconfig | 1 - sound/soc/pxa/Kconfig | 1 - sound/soc/qcom/Kconfig | 6 ++-- 54 files changed, 58 insertions(+), 141 deletions(-) diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig index a7120d6211546949..9eaeed1fb237fa33 100644 --- a/drivers/ata/Kconfig +++ b/drivers/ata/Kconfig @@ -398,7 +398,6 @@ config SATA_DWC_VDEBUG config SATA_HIGHBANK tristate "Calxeda Highbank SATA support" - depends on HAS_DMA depends on ARCH_HIGHBANK || COMPILE_TEST help This option enables support for the Calxeda Highbank SoC's @@ -408,7 +407,6 @@ config SATA_HIGHBANK config SATA_MV tristate "Marvell SATA support" - depends on HAS_DMA depends on PCI || ARCH_DOVE || ARCH_MV78XX0 || \ ARCH_MVEBU || ARCH_ORION5X || COMPILE_TEST select GENERIC_PHY diff --git a/drivers/crypto/Kconfig b/drivers/crypto/Kconfig index 4b741b83e23ff4de..3d27da7a430c0bc2 100644 --- a/drivers/crypto/Kconfig +++ b/drivers/crypto/Kconfig @@ -419,7 +419,7 @@ config CRYPTO_DEV_EXYNOS_RNG config CRYPTO_DEV_S5P tristate "Support for Sams
[PATCH/RFC 1/6] dma-mapping: Convert NO_DMA get_dma_ops() into a real dummy
If NO_DMA=y, get_dma_ops() returns a reference to the non-existing symbol bad_dma_ops, thus causing a link failure if it is ever used. Make get_dma_ops() return NULL instead, to avoid the link failure. This allows to improve compile-testing, and limits the need to keep on sprinkling dependencies on HAS_DMA all over the place. Signed-off-by: Geert Uytterhoeven --- include/linux/dma-mapping.h | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h index 34fe8463d10ea3be..d78d7541f784875b 100644 --- a/include/linux/dma-mapping.h +++ b/include/linux/dma-mapping.h @@ -212,14 +212,14 @@ static inline void set_dma_ops(struct device *dev, } #else /* - * Define the dma api to allow compilation but not linking of - * dma dependent code. Code that depends on the dma-mapping - * API needs to set 'depends on HAS_DMA' in its Kconfig + * Define the dma api to allow compilation of dma dependent code. + * Code that depends on the dma-mapping API needs to set 'depends on HAS_DMA' + * in its Kconfig, unless it already depends on || COMPILE_TEST, + * where guarantuees the availability of the dma-mapping API. */ -extern const struct dma_map_ops bad_dma_ops; static inline const struct dma_map_ops *get_dma_ops(struct device *dev) { - return &bad_dma_ops; + return NULL; } #endif -- 2.7.4
[PATCH/RFC 0/6] Allow compile-testing NO_DMA
Hi all, If NO_DMA=y, get_dma_ops() returns a reference to the non-existing symbol bad_dma_ops, thus causing a link failure if it is ever used. The intention of this is twofold: 1. To catch users of the DMA API on systems that do no support the DMA mapping API, 2. To avoid building drivers that cannot work on such systems anyway. However, the disadvantage is that we have to keep on adding dependencies on HAS_DMA all over the place. Thanks to the COMPILE_TEST symbol, lots of drivers now depend on one or more platform dependencies (that imply HAS_DMA) || COMPILE_TEST, thus already covering intention #2. Having to add an explicit dependency on HAS_DMA here is cumbersome, and hinders compile-testing. Hence I think the time is ripe to reconsider the link failure. This patch series: - Changes get_dma_ops() to return NULL instead, - Adds a few more dummies to enable compile-testing, - Removes dependencies on HAS_DMA for symbols that already have platform dependencies implying HAS_DMA. Note that adding more platform dependencies and/or dependencies on COMPILE_TEST is encouraged! This may make life harder for UML, though, as UML usually satisfies all other platform dependencies for HAS_DMA. Similarly, HAS_IOMEM is even more complicated. Can/do we want to do something similar for HAS_IOMEM? This series is against my current local tree, which has a few more "depends on HAS_DMA" than upstream. Of course I will rebase, and split the last patch per subsystem, if this RFC is welcomed positively. Compile-tested with allmodconfig and allyesconfig for m68k/sun3. Thanks for your comments! Geert Uytterhoeven (6): [RFC] dma-mapping: Convert NO_DMA get_dma_ops() into a real dummy [RFC] dma-coherent: Add NO_DMA dummies for managed DMA API [RFC] usb: gadget: Add NO_DMA dummies for DMA mapping API [RFC] mm: Add NO_DMA dummies for DMA pool API [RFC] scsi: Add NO_DMA dummies for SCSI DMA mapping API [RFC] Treewide: Remove depends on HAS_DMA in case of platform dependency drivers/ata/Kconfig | 2 -- drivers/crypto/Kconfig | 14 +++-- drivers/firewire/Kconfig| 1 - drivers/fpga/Kconfig| 1 - drivers/gpu/ipu-v3/Kconfig | 1 - drivers/i2c/busses/Kconfig | 3 -- drivers/iio/adc/Kconfig | 3 -- drivers/iommu/Kconfig | 5 ++-- drivers/lightnvm/Kconfig| 2 +- drivers/mailbox/Kconfig | 2 -- drivers/media/pci/dt3155/Kconfig| 1 - drivers/media/pci/solo6x10/Kconfig | 1 - drivers/media/pci/sta2x11/Kconfig | 1 - drivers/media/pci/tw5864/Kconfig| 1 - drivers/media/pci/tw686x/Kconfig| 1 - drivers/media/platform/Kconfig | 40 - drivers/media/platform/am437x/Kconfig | 2 +- drivers/media/platform/atmel/Kconfig| 4 +-- drivers/media/platform/blackfin/Kconfig | 1 - drivers/media/platform/davinci/Kconfig | 6 drivers/media/platform/marvell-ccic/Kconfig | 3 +- drivers/media/platform/rcar-vin/Kconfig | 2 +- drivers/media/platform/soc_camera/Kconfig | 3 +- drivers/media/platform/sti/c8sectpfe/Kconfig| 2 +- drivers/mmc/host/Kconfig| 10 ++- drivers/mtd/nand/Kconfig| 8 ++--- drivers/mtd/spi-nor/Kconfig | 2 +- drivers/net/ethernet/amd/Kconfig| 2 +- drivers/net/ethernet/apm/xgene-v2/Kconfig | 1 - drivers/net/ethernet/apm/xgene/Kconfig | 1 - drivers/net/ethernet/arc/Kconfig| 6 ++-- drivers/net/ethernet/broadcom/Kconfig | 2 -- drivers/net/ethernet/calxeda/Kconfig| 2 +- drivers/net/ethernet/hisilicon/Kconfig | 2 +- drivers/net/ethernet/marvell/Kconfig| 8 ++--- drivers/net/ethernet/mellanox/mlxsw/Kconfig | 2 +- drivers/net/ethernet/renesas/Kconfig| 2 -- drivers/net/ethernet/socionext/Kconfig | 4 +-- drivers/net/wireless/broadcom/brcm80211/Kconfig | 1 - drivers/net/wireless/quantenna/qtnfmac/Kconfig | 2 +- drivers/remoteproc/Kconfig | 1 - drivers/scsi/hisi_sas/Kconfig | 2 +- drivers/spi/Kconfig | 12 ++-- drivers/staging/media/davinci_vpfe/Kconfig | 1 - drivers/staging/media/omap4iss/Kconfig | 1 - drivers/staging/vc04_services/Kconfig | 1 - drivers/tty/serial/Kconfig | 4 --- drivers/usb/gadget/udc/Kconfig | 4 +-- drivers/usb/mtu3/Kconfig| 2 +- drivers/video/fbdev/Kconfig | 3 +- include/linux/dma-mapping.h | 19 inc
[PATCH/RFC 2/6] dma-coherent: Add NO_DMA dummies for managed DMA API
Add dummies for dmam_{alloc,free}_coherent(), to allow compile-testing if NO_DMA=y. This prevents the following from showing up later: ERROR: "dmam_alloc_coherent" [drivers/net/ethernet/arc/arc_emac.ko] undefined! ERROR: "dmam_free_coherent" [drivers/net/ethernet/apm/xgene/xgene-enet.ko] undefined! ERROR: "dmam_alloc_coherent" [drivers/net/ethernet/apm/xgene/xgene-enet.ko] undefined! ERROR: "dmam_alloc_coherent" [drivers/mtd/nand/hisi504_nand.ko] undefined! ERROR: "dmam_alloc_coherent" [drivers/mmc/host/dw_mmc.ko] undefined! Signed-off-by: Geert Uytterhoeven --- include/linux/dma-mapping.h | 9 + 1 file changed, 9 insertions(+) diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h index d78d7541f784875b..4d92956a4ddb8a5c 100644 --- a/include/linux/dma-mapping.h +++ b/include/linux/dma-mapping.h @@ -776,10 +776,19 @@ static inline void dma_deconfigure(struct device *dev) {} /* * Managed DMA API */ +#ifdef CONFIG_HAS_DMA extern void *dmam_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, gfp_t gfp); extern void dmam_free_coherent(struct device *dev, size_t size, void *vaddr, dma_addr_t dma_handle); +#else /* !CONFIG_HAS_DMA */ +static inline void *dmam_alloc_coherent(struct device *dev, size_t size, + dma_addr_t *dma_handle, gfp_t gfp) +{ return NULL; } +static inline void dmam_free_coherent(struct device *dev, size_t size, + void *vaddr, dma_addr_t dma_handle) { } +#endif /* !CONFIG_HAS_DMA */ + extern void *dmam_alloc_attrs(struct device *dev, size_t size, dma_addr_t *dma_handle, gfp_t gfp, unsigned long attrs); -- 2.7.4
RE: [PATCH 0/5] blk-mq/scsi-mq: support global tags & introduce force_blk_mq
> -Original Message- > From: Ming Lei [mailto:ming@redhat.com] > Sent: Tuesday, February 6, 2018 1:35 PM > To: Kashyap Desai > Cc: Hannes Reinecke; Jens Axboe; linux-bl...@vger.kernel.org; Christoph > Hellwig; Mike Snitzer; linux-scsi@vger.kernel.org; Arun Easi; Omar Sandoval; > Martin K . Petersen; James Bottomley; Christoph Hellwig; Don Brace; Peter > Rivera; Paolo Bonzini; Laurence Oberman > Subject: Re: [PATCH 0/5] blk-mq/scsi-mq: support global tags & introduce > force_blk_mq > > Hi Kashyap, > > On Tue, Feb 06, 2018 at 11:33:50AM +0530, Kashyap Desai wrote: > > > > We still have more than one reply queue ending up completion one CPU. > > > > > > pci_alloc_irq_vectors(PCI_IRQ_AFFINITY) has to be used, that means > > > smp_affinity_enable has to be set as 1, but seems it is the default > > setting. > > > > > > Please see kernel/irq/affinity.c, especially > > > irq_calc_affinity_vectors() > > which > > > figures out an optimal number of vectors, and the computation is > > > based > > on > > > cpumask_weight(cpu_possible_mask) now. If all offline CPUs are > > > mapped to some of reply queues, these queues won't be active(no > > > request submitted > > to > > > these queues). The mechanism of PCI_IRQ_AFFINITY basically makes > > > sure > > that > > > more than one irq vector won't be handled by one same CPU, and the > > > irq vector spread is done in irq_create_affinity_masks(). > > > > > > > Try to reduce MSI-x vector of megaraid_sas or mpt3sas driver via > > > > module parameter to simulate the issue. We need more number of > > > > Online CPU than reply-queue. > > > > > > IMO, you don't need to simulate the issue, pci_alloc_irq_vectors( > > > PCI_IRQ_AFFINITY) will handle that for you. You can dump the > > > returned > > irq > > > vector number, num_possible_cpus()/num_online_cpus() and each irq > > > vector's affinity assignment. > > > > > > > We may see completion redirected to original CPU because of > > > > "QUEUE_FLAG_SAME_FORCE", but ISR of low level driver can keep one > > > > CPU busy in local ISR routine. > > > > > > Could you dump each irq vector's affinity assignment of your > > > megaraid in > > your > > > test? > > > > To quickly reproduce, I restricted to single MSI-x vector on > > megaraid_sas driver. System has total 16 online CPUs. > > I suggest you don't do the restriction of single MSI-x vector, and just use the > device supported number of msi-x vector. Hi Ming, CPU lock up is seen even though it is not single msi-x vector. Actual scenario need some specific topology and server for overnight test. Issue can be seen on servers which has more than 16 logical CPUs and Thunderbolt series MR controller which supports at max 16 MSIx vectors. > > > > > Output of affinity hints. > > kernel version: > > Linux rhel7.3 4.15.0-rc1+ #2 SMP Mon Feb 5 12:13:34 EST 2018 x86_64 > > x86_64 > > x86_64 GNU/Linux > > PCI name is 83:00.0, dump its irq affinity: > > irq 105, cpu list 0-3,8-11 > > In this case, which CPU is selected for handling the interrupt is decided by > interrupt controller, and it is easy to cause CPU overload if interrupt controller > always selects one same CPU to handle the irq. > > > > > Affinity mask is created properly, but only CPU-0 is overloaded with > > interrupt processing. > > > > # numactl --hardware > > available: 2 nodes (0-1) > > node 0 cpus: 0 1 2 3 8 9 10 11 > > node 0 size: 47861 MB > > node 0 free: 46516 MB > > node 1 cpus: 4 5 6 7 12 13 14 15 > > node 1 size: 64491 MB > > node 1 free: 62805 MB > > node distances: > > node 0 1 > > 0: 10 21 > > 1: 21 10 > > > > Output of system activities (sar). (gnice is 100% and it is consumed > > in megaraid_sas ISR routine.) > > > > > > 12:44:40 PM CPU %usr %nice %sys %iowait%steal > > %irq %soft%guest%gnice %idle > > 12:44:41 PM all 6.03 0.0029.98 0.00 > > 0.00 0.000.000.000.00 63.99 > > 12:44:41 PM 0 0.00 0.00 0.000.00 > > 0.00 0.000.000.00 100.00 0 > > > > > > In my test, I used rq_affinity is set to 2. (QUEUE_FLAG_SAME_FORCE). I > > also used " host_tagset" V2 patch set for megaraid_sas. > > > > Using RFC requested in - > > "https://marc.info/?l=linux-scsi&m=151601833418346&w=2 " lockup is > > avoided (you can noticed that gnice is shifted to softirq. Even though > > it is 100% consumed, There is always exit for existing completion loop > > due to irqpoll_weight @irq_poll_init(). > > > > Average:CPU %usr %nice %sys %iowait%steal > > %irq %soft%guest%gnice %idle > > Average:all 4.25 0.0021.61 0.00 > > 0.00 0.00 6.61 0.00 0.00 67.54 > > Average: 0 0.00 0.00 0.00 0.00 > > 0.00 0.00 100.000.00 0.00 0.00 > > > > > > Hope this clarifies. We need dif
Re: [PATCH/RFC 0/6] Allow compile-testing NO_DMA
On Tue, Feb 06, 2018 at 11:14:46AM +0100, Geert Uytterhoeven wrote: > The intention of this is twofold: > 1. To catch users of the DMA API on systems that do no support the DMA > mapping API, > 2. To avoid building drivers that cannot work on such systems anyway. > > However, the disadvantage is that we have to keep on adding dependencies > on HAS_DMA all over the place. > Thanks to the COMPILE_TEST symbol, lots of drivers now depend on one or > more platform dependencies (that imply HAS_DMA) || COMPILE_TEST, thus > already covering intention #2. Having to add an explicit dependency on > HAS_DMA here is cumbersome, and hinders compile-testing. Thanks for doing this, hopefully it'll make everyone's life easier! Reviwed-by: Mark Brown signature.asc Description: PGP signature
Re: [PATCH 0/5] blk-mq/scsi-mq: support global tags & introduce force_blk_mq
Hi Kashyap, On Tue, Feb 06, 2018 at 04:59:51PM +0530, Kashyap Desai wrote: > > -Original Message- > > From: Ming Lei [mailto:ming@redhat.com] > > Sent: Tuesday, February 6, 2018 1:35 PM > > To: Kashyap Desai > > Cc: Hannes Reinecke; Jens Axboe; linux-bl...@vger.kernel.org; Christoph > > Hellwig; Mike Snitzer; linux-scsi@vger.kernel.org; Arun Easi; Omar > Sandoval; > > Martin K . Petersen; James Bottomley; Christoph Hellwig; Don Brace; > Peter > > Rivera; Paolo Bonzini; Laurence Oberman > > Subject: Re: [PATCH 0/5] blk-mq/scsi-mq: support global tags & introduce > > force_blk_mq > > > > Hi Kashyap, > > > > On Tue, Feb 06, 2018 at 11:33:50AM +0530, Kashyap Desai wrote: > > > > > We still have more than one reply queue ending up completion one > CPU. > > > > > > > > pci_alloc_irq_vectors(PCI_IRQ_AFFINITY) has to be used, that means > > > > smp_affinity_enable has to be set as 1, but seems it is the default > > > setting. > > > > > > > > Please see kernel/irq/affinity.c, especially > > > > irq_calc_affinity_vectors() > > > which > > > > figures out an optimal number of vectors, and the computation is > > > > based > > > on > > > > cpumask_weight(cpu_possible_mask) now. If all offline CPUs are > > > > mapped to some of reply queues, these queues won't be active(no > > > > request submitted > > > to > > > > these queues). The mechanism of PCI_IRQ_AFFINITY basically makes > > > > sure > > > that > > > > more than one irq vector won't be handled by one same CPU, and the > > > > irq vector spread is done in irq_create_affinity_masks(). > > > > > > > > > Try to reduce MSI-x vector of megaraid_sas or mpt3sas driver via > > > > > module parameter to simulate the issue. We need more number of > > > > > Online CPU than reply-queue. > > > > > > > > IMO, you don't need to simulate the issue, pci_alloc_irq_vectors( > > > > PCI_IRQ_AFFINITY) will handle that for you. You can dump the > > > > returned > > > irq > > > > vector number, num_possible_cpus()/num_online_cpus() and each irq > > > > vector's affinity assignment. > > > > > > > > > We may see completion redirected to original CPU because of > > > > > "QUEUE_FLAG_SAME_FORCE", but ISR of low level driver can keep one > > > > > CPU busy in local ISR routine. > > > > > > > > Could you dump each irq vector's affinity assignment of your > > > > megaraid in > > > your > > > > test? > > > > > > To quickly reproduce, I restricted to single MSI-x vector on > > > megaraid_sas driver. System has total 16 online CPUs. > > > > I suggest you don't do the restriction of single MSI-x vector, and just > use the > > device supported number of msi-x vector. > > Hi Ming, CPU lock up is seen even though it is not single msi-x vector. > Actual scenario need some specific topology and server for overnight test. > Issue can be seen on servers which has more than 16 logical CPUs and > Thunderbolt series MR controller which supports at max 16 MSIx vectors. > > > > > > > > Output of affinity hints. > > > kernel version: > > > Linux rhel7.3 4.15.0-rc1+ #2 SMP Mon Feb 5 12:13:34 EST 2018 x86_64 > > > x86_64 > > > x86_64 GNU/Linux > > > PCI name is 83:00.0, dump its irq affinity: > > > irq 105, cpu list 0-3,8-11 > > > > In this case, which CPU is selected for handling the interrupt is > decided by > > interrupt controller, and it is easy to cause CPU overload if interrupt > controller > > always selects one same CPU to handle the irq. > > > > > > > > Affinity mask is created properly, but only CPU-0 is overloaded with > > > interrupt processing. > > > > > > # numactl --hardware > > > available: 2 nodes (0-1) > > > node 0 cpus: 0 1 2 3 8 9 10 11 > > > node 0 size: 47861 MB > > > node 0 free: 46516 MB > > > node 1 cpus: 4 5 6 7 12 13 14 15 > > > node 1 size: 64491 MB > > > node 1 free: 62805 MB > > > node distances: > > > node 0 1 > > > 0: 10 21 > > > 1: 21 10 > > > > > > Output of system activities (sar). (gnice is 100% and it is consumed > > > in megaraid_sas ISR routine.) > > > > > > > > > 12:44:40 PM CPU %usr %nice %sys %iowait%steal > > > %irq %soft%guest%gnice %idle > > > 12:44:41 PM all 6.03 0.0029.98 0.00 > > > 0.00 0.000.000.000.00 63.99 > > > 12:44:41 PM 0 0.00 0.00 0.000.00 > > > 0.00 0.000.000.00 100.00 0 > > > > > > > > > In my test, I used rq_affinity is set to 2. (QUEUE_FLAG_SAME_FORCE). I > > > also used " host_tagset" V2 patch set for megaraid_sas. > > > > > > Using RFC requested in - > > > "https://marc.info/?l=linux-scsi&m=151601833418346&w=2 " lockup is > > > avoided (you can noticed that gnice is shifted to softirq. Even though > > > it is 100% consumed, There is always exit for existing completion loop > > > due to irqpoll_weight @irq_poll_init(). > > > > > > Average:CPU %usr %nice %sys %iowait%steal > > > %irq %soft%guest%gnice
Re: [PATCH/RFC 4/6] mm: Add NO_DMA dummies for DMA pool API
Hi Geert, On 06/02/18 10:14, Geert Uytterhoeven wrote: Add dummies for dma{,m}_pool_{create,destroy,alloc,free}(), to allow compile-testing if NO_DMA=y. This prevents the following from showing up later: ERROR: "dma_pool_destroy" [drivers/usb/mtu3/mtu3.ko] undefined! ERROR: "dma_pool_free" [drivers/usb/mtu3/mtu3.ko] undefined! ERROR: "dma_pool_alloc" [drivers/usb/mtu3/mtu3.ko] undefined! ERROR: "dma_pool_create" [drivers/usb/mtu3/mtu3.ko] undefined! ERROR: "dma_pool_destroy" [drivers/scsi/hisi_sas/hisi_sas_main.ko] undefined! ERROR: "dma_pool_free" [drivers/scsi/hisi_sas/hisi_sas_main.ko] undefined! ERROR: "dma_pool_alloc" [drivers/scsi/hisi_sas/hisi_sas_main.ko] undefined! ERROR: "dma_pool_create" [drivers/scsi/hisi_sas/hisi_sas_main.ko] undefined! ERROR: "dma_pool_alloc" [drivers/mailbox/bcm-pdc-mailbox.ko] undefined! ERROR: "dma_pool_free" [drivers/mailbox/bcm-pdc-mailbox.ko] undefined! ERROR: "dma_pool_create" [drivers/mailbox/bcm-pdc-mailbox.ko] undefined! ERROR: "dma_pool_destroy" [drivers/mailbox/bcm-pdc-mailbox.ko] undefined! Signed-off-by: Geert Uytterhoeven --- include/linux/dmapool.h | 21 +++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/include/linux/dmapool.h b/include/linux/dmapool.h index 53ba737505df31c7..adeb5e56c3ad73a8 100644 --- a/include/linux/dmapool.h +++ b/include/linux/dmapool.h @@ -16,6 +16,7 @@ struct device; +#ifdef CONFIG_HAS_DMA struct dma_pool *dma_pool_create(const char *name, struct device *dev, size_t size, size_t align, size_t allocation); @@ -23,6 +24,17 @@ void dma_pool_destroy(struct dma_pool *pool); void *dma_pool_alloc(struct dma_pool *pool, gfp_t mem_flags, dma_addr_t *handle); +void dma_pool_free(struct dma_pool *pool, void *vaddr, dma_addr_t addr); +#else /* !CONFIG_HAS_DMA */ +static inline struct dma_pool *dma_pool_create(const char *name, + struct device *dev, size_t size, size_t align, size_t allocation) +{ return NULL; } +static inline void dma_pool_destroy(struct dma_pool *pool) { } +static inline void *dma_pool_alloc(struct dma_pool *pool, gfp_t mem_flags, + dma_addr_t *handle) { return NULL; } +static inline void dma_pool_free(struct dma_pool *pool, void *vaddr, +dma_addr_t addr) { } +#endif /* !CONFIG_HAS_DMA */ static inline void *dma_pool_zalloc(struct dma_pool *pool, gfp_t mem_flags, dma_addr_t *handle) @@ -30,14 +42,19 @@ static inline void *dma_pool_zalloc(struct dma_pool *pool, gfp_t mem_flags, return dma_pool_alloc(pool, mem_flags | __GFP_ZERO, handle); } -void dma_pool_free(struct dma_pool *pool, void *vaddr, dma_addr_t addr); - /* * Managed DMA pool */ +#ifdef CONFIG_HAS_DMA struct dma_pool *dmam_pool_create(const char *name, struct device *dev, size_t size, size_t align, size_t allocation); void dmam_pool_destroy(struct dma_pool *pool); +#else /* !CONFIG_HAS_DMA */ +static inline struct dma_pool *dmam_pool_create(const char *name, + struct device *dev, size_t size, size_t align, size_t allocation) +{ return NULL; } +static inline void dmam_pool_destroy(struct dma_pool *pool) { } +#endif /* !CONFIG_HAS_DMA */ Nit: It might be tidier to add *all* the stubs down here so that there only need be a single #ifdef, then move the dma_pool_zalloc definition outside at the end (where we might eventually get rid of it anyway). Other than that, though, I think I agree with the series in general - more COMPILE_TEST is always good from the point of view of weeding out drivers using architecture-specific DMA API internals which aren't part of the proper generic interface. Robin. #endif
Re: [PATCH/RFC 0/6] Allow compile-testing NO_DMA
On 06/02/18 10:14, Geert Uytterhoeven wrote: Hi all, If NO_DMA=y, get_dma_ops() returns a reference to the non-existing symbol bad_dma_ops, thus causing a link failure if it is ever used. The intention of this is twofold: 1. To catch users of the DMA API on systems that do no support the DMA mapping API, 2. To avoid building drivers that cannot work on such systems anyway. However, the disadvantage is that we have to keep on adding dependencies on HAS_DMA all over the place. Thanks to the COMPILE_TEST symbol, lots of drivers now depend on one or more platform dependencies (that imply HAS_DMA) || COMPILE_TEST, thus already covering intention #2. Having to add an explicit dependency on HAS_DMA here is cumbersome, and hinders compile-testing. Hence I think the time is ripe to reconsider the link failure. This patch series: - Changes get_dma_ops() to return NULL instead, - Adds a few more dummies to enable compile-testing, - Removes dependencies on HAS_DMA for symbols that already have platform dependencies implying HAS_DMA. Note that adding more platform dependencies and/or dependencies on COMPILE_TEST is encouraged! This may make life harder for UML, though, as UML usually satisfies all other platform dependencies for HAS_DMA. Similarly, HAS_IOMEM is even more complicated. Can/do we want to do something similar for HAS_IOMEM? It looks like we have only one real arch (score) without IOMEM, and two (s390 and tile) where it is possible to configure out, so it does seem like a reasonable feature to assume. Maybe we could have something like asm-generic/no-io.h to provide an "unimplemented" version of those interfaces. Anyway, for this series: Acked-by: Robin Murphy Thanks, Robin. This series is against my current local tree, which has a few more "depends on HAS_DMA" than upstream. Of course I will rebase, and split the last patch per subsystem, if this RFC is welcomed positively. Compile-tested with allmodconfig and allyesconfig for m68k/sun3. Thanks for your comments! Geert Uytterhoeven (6): [RFC] dma-mapping: Convert NO_DMA get_dma_ops() into a real dummy [RFC] dma-coherent: Add NO_DMA dummies for managed DMA API [RFC] usb: gadget: Add NO_DMA dummies for DMA mapping API [RFC] mm: Add NO_DMA dummies for DMA pool API [RFC] scsi: Add NO_DMA dummies for SCSI DMA mapping API [RFC] Treewide: Remove depends on HAS_DMA in case of platform dependency drivers/ata/Kconfig | 2 -- drivers/crypto/Kconfig | 14 +++-- drivers/firewire/Kconfig| 1 - drivers/fpga/Kconfig| 1 - drivers/gpu/ipu-v3/Kconfig | 1 - drivers/i2c/busses/Kconfig | 3 -- drivers/iio/adc/Kconfig | 3 -- drivers/iommu/Kconfig | 5 ++-- drivers/lightnvm/Kconfig| 2 +- drivers/mailbox/Kconfig | 2 -- drivers/media/pci/dt3155/Kconfig| 1 - drivers/media/pci/solo6x10/Kconfig | 1 - drivers/media/pci/sta2x11/Kconfig | 1 - drivers/media/pci/tw5864/Kconfig| 1 - drivers/media/pci/tw686x/Kconfig| 1 - drivers/media/platform/Kconfig | 40 - drivers/media/platform/am437x/Kconfig | 2 +- drivers/media/platform/atmel/Kconfig| 4 +-- drivers/media/platform/blackfin/Kconfig | 1 - drivers/media/platform/davinci/Kconfig | 6 drivers/media/platform/marvell-ccic/Kconfig | 3 +- drivers/media/platform/rcar-vin/Kconfig | 2 +- drivers/media/platform/soc_camera/Kconfig | 3 +- drivers/media/platform/sti/c8sectpfe/Kconfig| 2 +- drivers/mmc/host/Kconfig| 10 ++- drivers/mtd/nand/Kconfig| 8 ++--- drivers/mtd/spi-nor/Kconfig | 2 +- drivers/net/ethernet/amd/Kconfig| 2 +- drivers/net/ethernet/apm/xgene-v2/Kconfig | 1 - drivers/net/ethernet/apm/xgene/Kconfig | 1 - drivers/net/ethernet/arc/Kconfig| 6 ++-- drivers/net/ethernet/broadcom/Kconfig | 2 -- drivers/net/ethernet/calxeda/Kconfig| 2 +- drivers/net/ethernet/hisilicon/Kconfig | 2 +- drivers/net/ethernet/marvell/Kconfig| 8 ++--- drivers/net/ethernet/mellanox/mlxsw/Kconfig | 2 +- drivers/net/ethernet/renesas/Kconfig| 2 -- drivers/net/ethernet/socionext/Kconfig | 4 +-- drivers/net/wireless/broadcom/brcm80211/Kconfig | 1 - drivers/net/wireless/quantenna/qtnfmac/Kconfig | 2 +- drivers/remoteproc/Kconfig | 1 - drivers/scsi/hisi_sas/Kconfig | 2 +- drivers/spi/Kconfig | 12 ++---
[PATCH 0/2] Code cleanup and bug fix for truncated CHAP name and secret
Bart, Lee, This patch set consists of v2 solution for the bug fix for CHAP name and secret. Please review and let know the comments. Martin, Please consider below patch set for next 'scsi-fixes' submission. Thanks, Nilesh Andrew Vasquez (1): qedi: Fix truncation of CHAP name and secret Nilesh Javali (1): qedi: Cleanup local str variable drivers/scsi/qedi/qedi_main.c | 76 ++- 1 file changed, 47 insertions(+), 29 deletions(-) -- 1.8.3.1
[PATCH V2 1/2] qedi: Fix truncation of CHAP name and secret
From: Andrew Vasquez The data in NVRAM is not guaranteed to be NUL terminated. Copy the data upto the element size or to the first NUL in the byte-stream and then append a NUL. Signed-off-by: Andrew Vasquez Signed-off-by: Nilesh Javali --- drivers/scsi/qedi/qedi_main.c | 45 +++ 1 file changed, 33 insertions(+), 12 deletions(-) diff --git a/drivers/scsi/qedi/qedi_main.c b/drivers/scsi/qedi/qedi_main.c index 8808f0d..f3dd438 100644 --- a/drivers/scsi/qedi/qedi_main.c +++ b/drivers/scsi/qedi/qedi_main.c @@ -1705,6 +1705,27 @@ void qedi_reset_host_mtu(struct qedi_ctx *qedi, u16 mtu) qedi_ops->ll2->start(qedi->cdev, ¶ms); } +static ssize_t +qedi_show_copy_data(char *buf, size_t size, u8 *data) +{ + size_t i; + + if (!data) + return sprintf(buf, "\n"); + + /* +* Data not guaranteed to be NUL terminated. Copy until NUL found or +* complete copy done. +*/ + for (i = 0; i < size && data[i]; i++) + buf[i] = data[i]; + + /* Data copy complete, append NEWLINE and NUL terminator. */ + buf[i] = '\n'; + buf[i + 1] = '\0'; + return strlen(buf); +} + /** * qedi_get_nvram_block: - Scan through the iSCSI NVRAM block (while accounting * for gaps) for the matching absolute-pf-id of the QEDI device. @@ -1842,8 +1863,8 @@ static ssize_t qedi_show_boot_ini_info(void *data, int type, char *buf) switch (type) { case ISCSI_BOOT_INI_INITIATOR_NAME: - rc = snprintf(str, NVM_ISCSI_CFG_ISCSI_NAME_MAX_LEN, "%s\n", - initiator->initiator_name.byte); + rc = qedi_show_copy_data(str, NVM_ISCSI_CFG_ISCSI_NAME_MAX_LEN, +initiator->initiator_name.byte); break; default: rc = 0; @@ -1910,8 +1931,8 @@ static umode_t qedi_ini_get_attr_visibility(void *data, int type) switch (type) { case ISCSI_BOOT_TGT_NAME: - rc = snprintf(str, NVM_ISCSI_CFG_ISCSI_NAME_MAX_LEN, "%s\n", - block->target[idx].target_name.byte); + rc = qedi_show_copy_data(str, NVM_ISCSI_CFG_ISCSI_NAME_MAX_LEN, +block->target[idx].target_name.byte); break; case ISCSI_BOOT_TGT_IP_ADDR: if (ipv6_en) @@ -1932,20 +1953,20 @@ static umode_t qedi_ini_get_attr_visibility(void *data, int type) block->target[idx].lun.value[0]); break; case ISCSI_BOOT_TGT_CHAP_NAME: - rc = snprintf(str, NVM_ISCSI_CFG_CHAP_NAME_MAX_LEN, "%s\n", - chap_name); + rc = qedi_show_copy_data(str, NVM_ISCSI_CFG_CHAP_NAME_MAX_LEN, +chap_name); break; case ISCSI_BOOT_TGT_CHAP_SECRET: - rc = snprintf(str, NVM_ISCSI_CFG_CHAP_PWD_MAX_LEN, "%s\n", - chap_secret); + rc = qedi_show_copy_data(str, NVM_ISCSI_CFG_CHAP_PWD_MAX_LEN, +chap_secret); break; case ISCSI_BOOT_TGT_REV_CHAP_NAME: - rc = snprintf(str, NVM_ISCSI_CFG_CHAP_NAME_MAX_LEN, "%s\n", - mchap_name); + rc = qedi_show_copy_data(str, NVM_ISCSI_CFG_CHAP_NAME_MAX_LEN, +mchap_name); break; case ISCSI_BOOT_TGT_REV_CHAP_SECRET: - rc = snprintf(str, NVM_ISCSI_CFG_CHAP_PWD_MAX_LEN, "%s\n", - mchap_secret); + rc = qedi_show_copy_data(str, NVM_ISCSI_CFG_CHAP_PWD_MAX_LEN, +mchap_secret); break; case ISCSI_BOOT_TGT_FLAGS: rc = snprintf(str, 3, "%hhd\n", SYSFS_FLAG_FW_SEL_BOOT); -- 1.8.3.1
[PATCH 2/2] qedi: Cleanup local str variable
Signed-off-by: Nilesh Javali --- drivers/scsi/qedi/qedi_main.c | 43 --- 1 file changed, 20 insertions(+), 23 deletions(-) diff --git a/drivers/scsi/qedi/qedi_main.c b/drivers/scsi/qedi/qedi_main.c index f3dd438..701bc72 100644 --- a/drivers/scsi/qedi/qedi_main.c +++ b/drivers/scsi/qedi/qedi_main.c @@ -1756,7 +1756,6 @@ static ssize_t qedi_show_boot_eth_info(void *data, int type, char *buf) { struct qedi_ctx *qedi = data; struct nvm_iscsi_initiator *initiator; - char *str = buf; int rc = 1; u32 ipv6_en, dhcp_en, ip_len; struct nvm_iscsi_block *block; @@ -1790,32 +1789,32 @@ static ssize_t qedi_show_boot_eth_info(void *data, int type, char *buf) switch (type) { case ISCSI_BOOT_ETH_IP_ADDR: - rc = snprintf(str, ip_len, fmt, ip); + rc = snprintf(buf, ip_len, fmt, ip); break; case ISCSI_BOOT_ETH_SUBNET_MASK: - rc = snprintf(str, ip_len, fmt, sub); + rc = snprintf(buf, ip_len, fmt, sub); break; case ISCSI_BOOT_ETH_GATEWAY: - rc = snprintf(str, ip_len, fmt, gw); + rc = snprintf(buf, ip_len, fmt, gw); break; case ISCSI_BOOT_ETH_FLAGS: - rc = snprintf(str, 3, "%hhd\n", + rc = snprintf(buf, 3, "%hhd\n", SYSFS_FLAG_FW_SEL_BOOT); break; case ISCSI_BOOT_ETH_INDEX: - rc = snprintf(str, 3, "0\n"); + rc = snprintf(buf, 3, "0\n"); break; case ISCSI_BOOT_ETH_MAC: - rc = sysfs_format_mac(str, qedi->mac, ETH_ALEN); + rc = sysfs_format_mac(buf, qedi->mac, ETH_ALEN); break; case ISCSI_BOOT_ETH_VLAN: - rc = snprintf(str, 12, "%d\n", + rc = snprintf(buf, 12, "%d\n", GET_FIELD2(initiator->generic_cont0, NVM_ISCSI_CFG_INITIATOR_VLAN)); break; case ISCSI_BOOT_ETH_ORIGIN: if (dhcp_en) - rc = snprintf(str, 3, "3\n"); + rc = snprintf(buf, 3, "3\n"); break; default: rc = 0; @@ -1851,7 +1850,6 @@ static ssize_t qedi_show_boot_ini_info(void *data, int type, char *buf) { struct qedi_ctx *qedi = data; struct nvm_iscsi_initiator *initiator; - char *str = buf; int rc; struct nvm_iscsi_block *block; @@ -1863,7 +1861,7 @@ static ssize_t qedi_show_boot_ini_info(void *data, int type, char *buf) switch (type) { case ISCSI_BOOT_INI_INITIATOR_NAME: - rc = qedi_show_copy_data(str, NVM_ISCSI_CFG_ISCSI_NAME_MAX_LEN, + rc = qedi_show_copy_data(buf, NVM_ISCSI_CFG_ISCSI_NAME_MAX_LEN, initiator->initiator_name.byte); break; default: @@ -1892,7 +1890,6 @@ static umode_t qedi_ini_get_attr_visibility(void *data, int type) qedi_show_boot_tgt_info(struct qedi_ctx *qedi, int type, char *buf, enum qedi_nvm_tgts idx) { - char *str = buf; int rc = 1; u32 ctrl_flags, ipv6_en, chap_en, mchap_en, ip_len; struct nvm_iscsi_block *block; @@ -1931,48 +1928,48 @@ static umode_t qedi_ini_get_attr_visibility(void *data, int type) switch (type) { case ISCSI_BOOT_TGT_NAME: - rc = qedi_show_copy_data(str, NVM_ISCSI_CFG_ISCSI_NAME_MAX_LEN, + rc = qedi_show_copy_data(buf, NVM_ISCSI_CFG_ISCSI_NAME_MAX_LEN, block->target[idx].target_name.byte); break; case ISCSI_BOOT_TGT_IP_ADDR: if (ipv6_en) - rc = snprintf(str, ip_len, "%pI6\n", + rc = snprintf(buf, ip_len, "%pI6\n", block->target[idx].ipv6_addr.byte); else - rc = snprintf(str, ip_len, "%pI4\n", + rc = snprintf(buf, ip_len, "%pI4\n", block->target[idx].ipv4_addr.byte); break; case ISCSI_BOOT_TGT_PORT: - rc = snprintf(str, 12, "%d\n", + rc = snprintf(buf, 12, "%d\n", GET_FIELD2(block->target[idx].generic_cont0, NVM_ISCSI_CFG_TARGET_TCP_PORT)); break; case ISCSI_BOOT_TGT_LUN: - rc = snprintf(str, 22, "%.*d\n", + rc = snprintf(buf, 22, "%.*d\n", block->target[idx].lun.value[1], block->target[idx].lun.value[0]); break; case ISCSI_BOOT_TGT_CHAP_NAME: - rc = qedi_show_copy_data(str, NVM_ISCSI_CFG
[PATCH] scsi: qedf: remove redundant initialization of 'fcport'
From: Colin Ian King Pointer fcport is initialized with a value that is never read, it is re-assigned a new value later on, hence the initialization is redundant and can be removed. Cleans up clang warning: drivers/scsi/qedf/qedf_io.c:920:21: warning: Value stored to 'fcport' during its initialization is never read Signed-off-by: Colin Ian King --- drivers/scsi/qedf/qedf_io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/qedf/qedf_io.c b/drivers/scsi/qedf/qedf_io.c index b15e69586a36..50a50c4249d0 100644 --- a/drivers/scsi/qedf/qedf_io.c +++ b/drivers/scsi/qedf/qedf_io.c @@ -917,7 +917,7 @@ qedf_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *sc_cmd) struct qedf_ctx *qedf = lport_priv(lport); struct fc_rport *rport = starget_to_rport(scsi_target(sc_cmd->device)); struct fc_rport_libfc_priv *rp = rport->dd_data; - struct qedf_rport *fcport = rport->dd_data; + struct qedf_rport *fcport; struct qedf_ioreq *io_req; int rc = 0; int rval; -- 2.15.1
Re: [PATCH] scsi_debug: Add two new parameters to scsi_debug driver
On 2018-02-03 01:38 PM, Laurence Oberman wrote: --- This patch adds two new parameters to the scsi_debug driver. During various fault injection scenarios it would be useful to be able to pick a specific starting sector and number of follow on sectors where a MEDIUM ERROR for reads would be returned against a scsi-debug device. Right now this only works against sector 0x1234 and OPT_MEDIUM_ERR_NUM follow on sectors. However during testing of md-raid and other scenarios I wanted more flexibility. The idea is add 2 new parameters: medium_error_start medium_error_count If medium_error_start is set then we don't use the default of OPT_MEDIUM_ERR_ADDR, but use that set value. If medium_error_count is set we use that value otherwise default to OPT_MEDIUM_ERR_NUM. Signed-off-by: Laurence Oberman Tested-by: Laurence Oberman Acked-by: Douglas Gilbert drivers/scsi/scsi_debug.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index a5986da..5a5aba0 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c @@ -616,6 +616,8 @@ enum sdeb_opcode_index { static int sdebug_lowest_aligned = DEF_LOWEST_ALIGNED; static int sdebug_max_luns = DEF_MAX_LUNS; static int sdebug_max_queue = SDEBUG_CANQUEUE;/* per submit queue */ +static unsigned int sdebug_medium_error_start = OPT_MEDIUM_ERR_ADDR; +static int sdebug_medium_error_count = OPT_MEDIUM_ERR_NUM; static atomic_t retired_max_queue;/* if > 0 then was prior max_queue */ static int sdebug_ndelay = DEF_NDELAY;/* if > 0 then unit is nanoseconds */ static int sdebug_no_lun_0 = DEF_NO_LUN_0; @@ -2712,8 +2714,8 @@ static int resp_read_dt0(struct scsi_cmnd *scp, struct sdebug_dev_info *devip) } if (unlikely((SDEBUG_OPT_MEDIUM_ERR & sdebug_opts) && -(lba <= (OPT_MEDIUM_ERR_ADDR + OPT_MEDIUM_ERR_NUM - 1)) && -((lba + num) > OPT_MEDIUM_ERR_ADDR))) { +(lba <= (sdebug_medium_error_start + sdebug_medium_error_count - 1)) && +((lba + num) > sdebug_medium_error_start))) { /* claim unrecoverable read error */ mk_sense_buffer(scp, MEDIUM_ERROR, UNRECOVERED_READ_ERR, 0); /* set info field and valid bit for fixed descriptor */ @@ -4440,6 +4442,8 @@ static int schedule_resp(struct scsi_cmnd *cmnd, struct sdebug_dev_info *devip, module_param_named(lowest_aligned, sdebug_lowest_aligned, int, S_IRUGO); module_param_named(max_luns, sdebug_max_luns, int, S_IRUGO | S_IWUSR); module_param_named(max_queue, sdebug_max_queue, int, S_IRUGO | S_IWUSR); +module_param_named(medium_error_start, sdebug_medium_error_start, int, S_IRUGO | S_IWUSR); +module_param_named(medium_error_count, sdebug_medium_error_count, int, S_IRUGO | S_IWUSR); module_param_named(ndelay, sdebug_ndelay, int, S_IRUGO | S_IWUSR); module_param_named(no_lun_0, sdebug_no_lun_0, int, S_IRUGO | S_IWUSR); module_param_named(no_uld, sdebug_no_uld, int, S_IRUGO); @@ -4497,6 +4501,8 @@ static int schedule_resp(struct scsi_cmnd *cmnd, struct sdebug_dev_info *devip, MODULE_PARM_DESC(lowest_aligned, "lowest aligned lba (def=0)"); MODULE_PARM_DESC(max_luns, "number of LUNs per target to simulate(def=1)"); MODULE_PARM_DESC(max_queue, "max number of queued commands (1 to max(def))"); +MODULE_PARM_DESC(medium_error_start, "starting sector number to return MEDIUM error"); +MODULE_PARM_DESC(medium_error_count, "count of sectors to return follow on MEDIUM error"); MODULE_PARM_DESC(ndelay, "response delay in nanoseconds (def=0 -> ignore)"); MODULE_PARM_DESC(no_lun_0, "no LU number 0 (def=0 -> have lun 0)"); MODULE_PARM_DESC(no_uld, "stop ULD (e.g. sd driver) attaching (def=0))");
[PATCH] scsi: isci: remove redundant initialization to 'bit'
From: Colin Ian King Variable bit is initialized with a value that is never read and is being updated immediately after the initialization, hence the initialization is redundant and can be removed. Cleans up clang warning: drivers/scsi/isci/host.c:2769:8: warning: Value stored to 'bit' during its initialization is never read Signed-off-by: Colin Ian King --- drivers/scsi/isci/host.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/isci/host.c b/drivers/scsi/isci/host.c index 13b37cdffa8e..1ee3868ade07 100644 --- a/drivers/scsi/isci/host.c +++ b/drivers/scsi/isci/host.c @@ -2766,7 +2766,7 @@ static int sci_write_gpio_tx_gp(struct isci_host *ihost, u8 reg_index, u8 reg_co int i; for (i = 0; i < 3; i++) { - int bit = (i << 2) + 2; + int bit; bit = try_test_sas_gpio_gp_bit(to_sas_gpio_od(d, i), write_data, reg_index, -- 2.15.1
[PATCH] scsi: libfc: remove redundant initialization of 'disc'
From: Colin Ian King Pointer disc is being intializated a value that is never read and then re-assigned the same value later on, hence the initialization is redundant and can be removed. Cleans up clang warning: drivers/scsi/libfc/fc_disc.c:734:18: warning: Value stored to 'disc' during its initialization is never read Signed-off-by: Colin Ian King --- drivers/scsi/libfc/fc_disc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/libfc/fc_disc.c b/drivers/scsi/libfc/fc_disc.c index 8660f923ace0..3f3569ec5ce3 100644 --- a/drivers/scsi/libfc/fc_disc.c +++ b/drivers/scsi/libfc/fc_disc.c @@ -731,7 +731,7 @@ static void fc_disc_stop_final(struct fc_lport *lport) */ void fc_disc_config(struct fc_lport *lport, void *priv) { - struct fc_disc *disc = &lport->disc; + struct fc_disc *disc; if (!lport->tt.disc_start) lport->tt.disc_start = fc_disc_start; -- 2.15.1
RE: [PATCH 0/5] blk-mq/scsi-mq: support global tags & introduce force_blk_mq
> -Original Message- > From: Ming Lei [mailto:ming@redhat.com] > Sent: Tuesday, February 6, 2018 6:02 PM > To: Kashyap Desai > Cc: Hannes Reinecke; Jens Axboe; linux-bl...@vger.kernel.org; Christoph > Hellwig; Mike Snitzer; linux-scsi@vger.kernel.org; Arun Easi; Omar Sandoval; > Martin K . Petersen; James Bottomley; Christoph Hellwig; Don Brace; Peter > Rivera; Paolo Bonzini; Laurence Oberman > Subject: Re: [PATCH 0/5] blk-mq/scsi-mq: support global tags & introduce > force_blk_mq > > Hi Kashyap, > > On Tue, Feb 06, 2018 at 04:59:51PM +0530, Kashyap Desai wrote: > > > -Original Message- > > > From: Ming Lei [mailto:ming@redhat.com] > > > Sent: Tuesday, February 6, 2018 1:35 PM > > > To: Kashyap Desai > > > Cc: Hannes Reinecke; Jens Axboe; linux-bl...@vger.kernel.org; > > > Christoph Hellwig; Mike Snitzer; linux-scsi@vger.kernel.org; Arun > > > Easi; Omar > > Sandoval; > > > Martin K . Petersen; James Bottomley; Christoph Hellwig; Don Brace; > > Peter > > > Rivera; Paolo Bonzini; Laurence Oberman > > > Subject: Re: [PATCH 0/5] blk-mq/scsi-mq: support global tags & > > > introduce force_blk_mq > > > > > > Hi Kashyap, > > > > > > On Tue, Feb 06, 2018 at 11:33:50AM +0530, Kashyap Desai wrote: > > > > > > We still have more than one reply queue ending up completion > > > > > > one > > CPU. > > > > > > > > > > pci_alloc_irq_vectors(PCI_IRQ_AFFINITY) has to be used, that > > > > > means smp_affinity_enable has to be set as 1, but seems it is > > > > > the default > > > > setting. > > > > > > > > > > Please see kernel/irq/affinity.c, especially > > > > > irq_calc_affinity_vectors() > > > > which > > > > > figures out an optimal number of vectors, and the computation is > > > > > based > > > > on > > > > > cpumask_weight(cpu_possible_mask) now. If all offline CPUs are > > > > > mapped to some of reply queues, these queues won't be active(no > > > > > request submitted > > > > to > > > > > these queues). The mechanism of PCI_IRQ_AFFINITY basically makes > > > > > sure > > > > that > > > > > more than one irq vector won't be handled by one same CPU, and > > > > > the irq vector spread is done in irq_create_affinity_masks(). > > > > > > > > > > > Try to reduce MSI-x vector of megaraid_sas or mpt3sas driver > > > > > > via module parameter to simulate the issue. We need more > > > > > > number of Online CPU than reply-queue. > > > > > > > > > > IMO, you don't need to simulate the issue, > > > > > pci_alloc_irq_vectors( > > > > > PCI_IRQ_AFFINITY) will handle that for you. You can dump the > > > > > returned > > > > irq > > > > > vector number, num_possible_cpus()/num_online_cpus() and each > > > > > irq vector's affinity assignment. > > > > > > > > > > > We may see completion redirected to original CPU because of > > > > > > "QUEUE_FLAG_SAME_FORCE", but ISR of low level driver can keep > > > > > > one CPU busy in local ISR routine. > > > > > > > > > > Could you dump each irq vector's affinity assignment of your > > > > > megaraid in > > > > your > > > > > test? > > > > > > > > To quickly reproduce, I restricted to single MSI-x vector on > > > > megaraid_sas driver. System has total 16 online CPUs. > > > > > > I suggest you don't do the restriction of single MSI-x vector, and > > > just > > use the > > > device supported number of msi-x vector. > > > > Hi Ming, CPU lock up is seen even though it is not single msi-x vector. > > Actual scenario need some specific topology and server for overnight test. > > Issue can be seen on servers which has more than 16 logical CPUs and > > Thunderbolt series MR controller which supports at max 16 MSIx vectors. > > > > > > > > > > > Output of affinity hints. > > > > kernel version: > > > > Linux rhel7.3 4.15.0-rc1+ #2 SMP Mon Feb 5 12:13:34 EST 2018 > > > > x86_64 > > > > x86_64 > > > > x86_64 GNU/Linux > > > > PCI name is 83:00.0, dump its irq affinity: > > > > irq 105, cpu list 0-3,8-11 > > > > > > In this case, which CPU is selected for handling the interrupt is > > decided by > > > interrupt controller, and it is easy to cause CPU overload if > > > interrupt > > controller > > > always selects one same CPU to handle the irq. > > > > > > > > > > > Affinity mask is created properly, but only CPU-0 is overloaded > > > > with interrupt processing. > > > > > > > > # numactl --hardware > > > > available: 2 nodes (0-1) > > > > node 0 cpus: 0 1 2 3 8 9 10 11 > > > > node 0 size: 47861 MB > > > > node 0 free: 46516 MB > > > > node 1 cpus: 4 5 6 7 12 13 14 15 > > > > node 1 size: 64491 MB > > > > node 1 free: 62805 MB > > > > node distances: > > > > node 0 1 > > > > 0: 10 21 > > > > 1: 21 10 > > > > > > > > Output of system activities (sar). (gnice is 100% and it is > > > > consumed in megaraid_sas ISR routine.) > > > > > > > > > > > > 12:44:40 PM CPU %usr %nice %sys %iowait %steal > > > > %irq %soft%guest%gnice %idle > > > > 12:44:41 PM all 6.03 0.0029.98 0.00 > > > > 0.00 0.00
[PATCH] scsi: pmcraid: remove redundant initializations of pointer 'ioadl'
From: Colin Ian King There are several occurrances where pointer ioadl is initialized with a value that is never read and where it is re-assigned a new value later on, hence the initialization is redundant and can be removed. Cleans up clang warnings: drivers/scsi/pmcraid.c:1028:29: warning: Value stored to 'ioadl' during its initialization is never read drivers/scsi/pmcraid.c:3178:29: warning: Value stored to 'ioadl' during its initialization is never read drivers/scsi/pmcraid.c:5495:29: warning: Value stored to 'ioadl' during its initialization is never read drivers/scsi/pmcraid.c:5668:29: warning: Value stored to 'ioadl' during its initialization is never read Signed-off-by: Colin Ian King --- drivers/scsi/pmcraid.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c index 201c8de1853d..9330cc5ba34d 100644 --- a/drivers/scsi/pmcraid.c +++ b/drivers/scsi/pmcraid.c @@ -1025,7 +1025,7 @@ static void pmcraid_get_fwversion_done(struct pmcraid_cmd *cmd) static void pmcraid_get_fwversion(struct pmcraid_cmd *cmd) { struct pmcraid_ioarcb *ioarcb = &cmd->ioa_cb->ioarcb; - struct pmcraid_ioadl_desc *ioadl = ioarcb->add_data.u.ioadl; + struct pmcraid_ioadl_desc *ioadl; struct pmcraid_instance *pinstance = cmd->drv_inst; u16 data_size = sizeof(struct pmcraid_inquiry_data); @@ -3175,7 +3175,7 @@ static int pmcraid_build_ioadl( struct scsi_cmnd *scsi_cmd = cmd->scsi_cmd; struct pmcraid_ioarcb *ioarcb = &(cmd->ioa_cb->ioarcb); - struct pmcraid_ioadl_desc *ioadl = ioarcb->add_data.u.ioadl; + struct pmcraid_ioadl_desc *ioadl; u32 length = scsi_bufflen(scsi_cmd); @@ -5492,7 +5492,7 @@ static void pmcraid_set_timestamp(struct pmcraid_cmd *cmd) struct pmcraid_instance *pinstance = cmd->drv_inst; struct pmcraid_ioarcb *ioarcb = &cmd->ioa_cb->ioarcb; __be32 time_stamp_len = cpu_to_be32(PMCRAID_TIMESTAMP_LEN); - struct pmcraid_ioadl_desc *ioadl = ioarcb->add_data.u.ioadl; + struct pmcraid_ioadl_desc *ioadl; u64 timestamp; timestamp = ktime_get_real_seconds() * 1000; @@ -5665,7 +5665,7 @@ static void pmcraid_init_res_table(struct pmcraid_cmd *cmd) static void pmcraid_querycfg(struct pmcraid_cmd *cmd) { struct pmcraid_ioarcb *ioarcb = &cmd->ioa_cb->ioarcb; - struct pmcraid_ioadl_desc *ioadl = ioarcb->add_data.u.ioadl; + struct pmcraid_ioadl_desc *ioadl; struct pmcraid_instance *pinstance = cmd->drv_inst; __be32 cfg_table_size = cpu_to_be32(sizeof(struct pmcraid_config_table)); -- 2.15.1
Re: [PATCH] scsi: libfc: remove redundant initialization of 'disc'
Looks good, Acked-by: Johannes Thumshirn -- Johannes Thumshirn Storage jthumsh...@suse.de+49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
Re: [PATCH/RFC 0/6] Allow compile-testing NO_DMA
On Tue, Feb 6, 2018 at 11:14 AM, Geert Uytterhoeven wrote: > Hi all, > > If NO_DMA=y, get_dma_ops() returns a reference to the non-existing > symbol bad_dma_ops, thus causing a link failure if it is ever used. > > The intention of this is twofold: > 1. To catch users of the DMA API on systems that do no support the DMA > mapping API, > 2. To avoid building drivers that cannot work on such systems anyway. > > However, the disadvantage is that we have to keep on adding dependencies > on HAS_DMA all over the place. > > Thanks to the COMPILE_TEST symbol, lots of drivers now depend on one or > more platform dependencies (that imply HAS_DMA) || COMPILE_TEST, thus > already covering intention #2. Having to add an explicit dependency on > HAS_DMA here is cumbersome, and hinders compile-testing. > > Hence I think the time is ripe to reconsider the link failure. > This patch series: > - Changes get_dma_ops() to return NULL instead, > - Adds a few more dummies to enable compile-testing, > - Removes dependencies on HAS_DMA for symbols that already have > platform dependencies implying HAS_DMA. > > Note that adding more platform dependencies and/or dependencies on > COMPILE_TEST is encouraged! > > This may make life harder for UML, though, as UML usually satisfies all > other platform dependencies for HAS_DMA. Similarly, HAS_IOMEM is even > more complicated. Can/do we want to do something similar for > HAS_IOMEM? > > This series is against my current local tree, which has a few more > "depends on HAS_DMA" than upstream. Of course I will rebase, and split > the last patch per subsystem, if this RFC is welcomed positively. > > Compile-tested with allmodconfig and allyesconfig for m68k/sun3. David Woodhouse has been looking at some other structures with indirect pointers (kvm_x86_ops) to reduce the overhead that was added for avoiding speculative execution of those pointers. I wonder if there are any dma_map_ops operations that are in a fastpath that needs a similar optimization. If yes, we might want to think about how to do that part first to avoid rewriting the same code more than once. Otherwise, your approach seems fine. Arnd
Re: [PATCH V2 1/2] qedi: Fix truncation of CHAP name and secret
On Tue, 2018-02-06 at 05:12 -0800, Nilesh Javali wrote: > From: Andrew Vasquez > > The data in NVRAM is not guaranteed to be NUL terminated. > Copy the data upto the element size or to the first NUL > in the byte-stream and then append a NUL. > > Signed-off-by: Andrew Vasquez > Signed-off-by: Nilesh Javali > --- > drivers/scsi/qedi/qedi_main.c | 45 > +++ > 1 file changed, 33 insertions(+), 12 deletions(-) > > diff --git a/drivers/scsi/qedi/qedi_main.c b/drivers/scsi/qedi/qedi_main.c > index 8808f0d..f3dd438 100644 > --- a/drivers/scsi/qedi/qedi_main.c > +++ b/drivers/scsi/qedi/qedi_main.c > @@ -1705,6 +1705,27 @@ void qedi_reset_host_mtu(struct qedi_ctx *qedi, u16 > mtu) > qedi_ops->ll2->start(qedi->cdev, ¶ms); > } > > +static ssize_t > +qedi_show_copy_data(char *buf, size_t size, u8 *data) > +{ > + size_t i; > + > + if (!data) > + return sprintf(buf, "\n"); > + > + /* > + * Data not guaranteed to be NUL terminated. Copy until NUL found or > + * complete copy done. > + */ > + for (i = 0; i < size && data[i]; i++) > + buf[i] = data[i]; > + /* Data copy complete, append NEWLINE and NUL terminator. */ > + buf[i] = '\n'; > + buf[i + 1] = '\0'; > + return strlen(buf); > +} Can the body of the above function be changed into the following, which is much shorter? sprintf(buf, "%.*s", (int)size, data ? : "") Additionally, are you aware that sysfs show callbacks do not have to terminate data with '\0'? Thanks, Bart.
Re: [PATCH/RFC 0/6] Allow compile-testing NO_DMA
On Tue, Feb 6, 2018 at 2:05 PM, Robin Murphy wrote: > > It looks like we have only one real arch (score) without IOMEM, and two > (s390 and tile) where it is possible to configure out, so it does seem like > a reasonable feature to assume. Maybe we could have something like > asm-generic/no-io.h to provide an "unimplemented" version of those > interfaces. Agreed, there is no use trying to optimize for any of those three cases: For s390, all new machines come with PCI, so distros will enable it all the time. Few users run their own kernels even on older machines. score has been de-facto unmaintained for a few years, and tile has recently been orphaned with the hardware platform being abandoned by Mellanox. Arnd
Re: [PATCH 0/5] blk-mq/scsi-mq: support global tags & introduce force_blk_mq
Hi Kashyap, On Tue, Feb 06, 2018 at 07:57:35PM +0530, Kashyap Desai wrote: > > -Original Message- > > From: Ming Lei [mailto:ming@redhat.com] > > Sent: Tuesday, February 6, 2018 6:02 PM > > To: Kashyap Desai > > Cc: Hannes Reinecke; Jens Axboe; linux-bl...@vger.kernel.org; Christoph > > Hellwig; Mike Snitzer; linux-scsi@vger.kernel.org; Arun Easi; Omar > Sandoval; > > Martin K . Petersen; James Bottomley; Christoph Hellwig; Don Brace; > Peter > > Rivera; Paolo Bonzini; Laurence Oberman > > Subject: Re: [PATCH 0/5] blk-mq/scsi-mq: support global tags & introduce > > force_blk_mq > > > > Hi Kashyap, > > > > On Tue, Feb 06, 2018 at 04:59:51PM +0530, Kashyap Desai wrote: > > > > -Original Message- > > > > From: Ming Lei [mailto:ming@redhat.com] > > > > Sent: Tuesday, February 6, 2018 1:35 PM > > > > To: Kashyap Desai > > > > Cc: Hannes Reinecke; Jens Axboe; linux-bl...@vger.kernel.org; > > > > Christoph Hellwig; Mike Snitzer; linux-scsi@vger.kernel.org; Arun > > > > Easi; Omar > > > Sandoval; > > > > Martin K . Petersen; James Bottomley; Christoph Hellwig; Don Brace; > > > Peter > > > > Rivera; Paolo Bonzini; Laurence Oberman > > > > Subject: Re: [PATCH 0/5] blk-mq/scsi-mq: support global tags & > > > > introduce force_blk_mq > > > > > > > > Hi Kashyap, > > > > > > > > On Tue, Feb 06, 2018 at 11:33:50AM +0530, Kashyap Desai wrote: > > > > > > > We still have more than one reply queue ending up completion > > > > > > > one > > > CPU. > > > > > > > > > > > > pci_alloc_irq_vectors(PCI_IRQ_AFFINITY) has to be used, that > > > > > > means smp_affinity_enable has to be set as 1, but seems it is > > > > > > the default > > > > > setting. > > > > > > > > > > > > Please see kernel/irq/affinity.c, especially > > > > > > irq_calc_affinity_vectors() > > > > > which > > > > > > figures out an optimal number of vectors, and the computation is > > > > > > based > > > > > on > > > > > > cpumask_weight(cpu_possible_mask) now. If all offline CPUs are > > > > > > mapped to some of reply queues, these queues won't be active(no > > > > > > request submitted > > > > > to > > > > > > these queues). The mechanism of PCI_IRQ_AFFINITY basically makes > > > > > > sure > > > > > that > > > > > > more than one irq vector won't be handled by one same CPU, and > > > > > > the irq vector spread is done in irq_create_affinity_masks(). > > > > > > > > > > > > > Try to reduce MSI-x vector of megaraid_sas or mpt3sas driver > > > > > > > via module parameter to simulate the issue. We need more > > > > > > > number of Online CPU than reply-queue. > > > > > > > > > > > > IMO, you don't need to simulate the issue, > > > > > > pci_alloc_irq_vectors( > > > > > > PCI_IRQ_AFFINITY) will handle that for you. You can dump the > > > > > > returned > > > > > irq > > > > > > vector number, num_possible_cpus()/num_online_cpus() and each > > > > > > irq vector's affinity assignment. > > > > > > > > > > > > > We may see completion redirected to original CPU because of > > > > > > > "QUEUE_FLAG_SAME_FORCE", but ISR of low level driver can keep > > > > > > > one CPU busy in local ISR routine. > > > > > > > > > > > > Could you dump each irq vector's affinity assignment of your > > > > > > megaraid in > > > > > your > > > > > > test? > > > > > > > > > > To quickly reproduce, I restricted to single MSI-x vector on > > > > > megaraid_sas driver. System has total 16 online CPUs. > > > > > > > > I suggest you don't do the restriction of single MSI-x vector, and > > > > just > > > use the > > > > device supported number of msi-x vector. > > > > > > Hi Ming, CPU lock up is seen even though it is not single msi-x > vector. > > > Actual scenario need some specific topology and server for overnight > test. > > > Issue can be seen on servers which has more than 16 logical CPUs and > > > Thunderbolt series MR controller which supports at max 16 MSIx > vectors. > > > > > > > > > > > > > > Output of affinity hints. > > > > > kernel version: > > > > > Linux rhel7.3 4.15.0-rc1+ #2 SMP Mon Feb 5 12:13:34 EST 2018 > > > > > x86_64 > > > > > x86_64 > > > > > x86_64 GNU/Linux > > > > > PCI name is 83:00.0, dump its irq affinity: > > > > > irq 105, cpu list 0-3,8-11 > > > > > > > > In this case, which CPU is selected for handling the interrupt is > > > decided by > > > > interrupt controller, and it is easy to cause CPU overload if > > > > interrupt > > > controller > > > > always selects one same CPU to handle the irq. > > > > > > > > > > > > > > Affinity mask is created properly, but only CPU-0 is overloaded > > > > > with interrupt processing. > > > > > > > > > > # numactl --hardware > > > > > available: 2 nodes (0-1) > > > > > node 0 cpus: 0 1 2 3 8 9 10 11 > > > > > node 0 size: 47861 MB > > > > > node 0 free: 46516 MB > > > > > node 1 cpus: 4 5 6 7 12 13 14 15 > > > > > node 1 size: 64491 MB > > > > > node 1 free: 62805 MB > > > > > node distances: > > > > > node 0 1 > > > > > 0: 10 21 > > > > > 1: 21 10 > > > > > > > > > > Output of syste
[PATCH v5 01/11] scsi: ufs: sysfs: attribute group for existing sysfs entries.
This patch introduces attribute group to show existing sysfs entries. Signed-off-by: Stanislav Nijnikov --- drivers/scsi/ufs/Makefile| 3 +- drivers/scsi/ufs/ufs-sysfs.c | 156 +++ drivers/scsi/ufs/ufs-sysfs.h | 14 drivers/scsi/ufs/ufshcd.c| 156 ++- drivers/scsi/ufs/ufshcd.h| 2 + 5 files changed, 178 insertions(+), 153 deletions(-) create mode 100644 drivers/scsi/ufs/ufs-sysfs.c create mode 100644 drivers/scsi/ufs/ufs-sysfs.h diff --git a/drivers/scsi/ufs/Makefile b/drivers/scsi/ufs/Makefile index 9310c6c..918f579 100644 --- a/drivers/scsi/ufs/Makefile +++ b/drivers/scsi/ufs/Makefile @@ -3,6 +3,7 @@ obj-$(CONFIG_SCSI_UFS_DWC_TC_PCI) += tc-dwc-g210-pci.o ufshcd-dwc.o tc-dwc-g210.o obj-$(CONFIG_SCSI_UFS_DWC_TC_PLATFORM) += tc-dwc-g210-pltfrm.o ufshcd-dwc.o tc-dwc-g210.o obj-$(CONFIG_SCSI_UFS_QCOM) += ufs-qcom.o -obj-$(CONFIG_SCSI_UFSHCD) += ufshcd.o +obj-$(CONFIG_SCSI_UFSHCD) += ufshcd-core.o +ufshcd-core-objs := ufshcd.o ufs-sysfs.o obj-$(CONFIG_SCSI_UFSHCD_PCI) += ufshcd-pci.o obj-$(CONFIG_SCSI_UFSHCD_PLATFORM) += ufshcd-pltfrm.o diff --git a/drivers/scsi/ufs/ufs-sysfs.c b/drivers/scsi/ufs/ufs-sysfs.c new file mode 100644 index 000..ce8dcb6 --- /dev/null +++ b/drivers/scsi/ufs/ufs-sysfs.c @@ -0,0 +1,156 @@ +// SPDX-License-Identifier: GPL-2.0-only +// Copyright (C) 2018 Western Digital Corporation + +#include +#include + +#include "ufs-sysfs.h" + +static const char *ufschd_uic_link_state_to_string( + enum uic_link_state state) +{ + switch (state) { + case UIC_LINK_OFF_STATE:return "OFF"; + case UIC_LINK_ACTIVE_STATE: return "ACTIVE"; + case UIC_LINK_HIBERN8_STATE:return "HIBERN8"; + default:return "UNKNOWN"; + } +} + +static const char *ufschd_ufs_dev_pwr_mode_to_string( + enum ufs_dev_pwr_mode state) +{ + switch (state) { + case UFS_ACTIVE_PWR_MODE: return "ACTIVE"; + case UFS_SLEEP_PWR_MODE:return "SLEEP"; + case UFS_POWERDOWN_PWR_MODE:return "POWERDOWN"; + default:return "UNKNOWN"; + } +} + +static inline ssize_t ufs_sysfs_pm_lvl_store(struct device *dev, +struct device_attribute *attr, +const char *buf, size_t count, +bool rpm) +{ + struct ufs_hba *hba = dev_get_drvdata(dev); + unsigned long flags, value; + + if (kstrtoul(buf, 0, &value)) + return -EINVAL; + + if (value >= UFS_PM_LVL_MAX) + return -EINVAL; + + spin_lock_irqsave(hba->host->host_lock, flags); + if (rpm) + hba->rpm_lvl = value; + else + hba->spm_lvl = value; + spin_unlock_irqrestore(hba->host->host_lock, flags); + return count; +} + +static ssize_t rpm_lvl_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct ufs_hba *hba = dev_get_drvdata(dev); + int curr_len; + u8 lvl; + + curr_len = snprintf(buf, PAGE_SIZE, + "\nCurrent Runtime PM level [%d] => dev_state [%s] link_state [%s]\n", + hba->rpm_lvl, + ufschd_ufs_dev_pwr_mode_to_string( + ufs_pm_lvl_states[hba->rpm_lvl].dev_state), + ufschd_uic_link_state_to_string( + ufs_pm_lvl_states[hba->rpm_lvl].link_state)); + + curr_len += snprintf((buf + curr_len), (PAGE_SIZE - curr_len), +"\nAll available Runtime PM levels info:\n"); + for (lvl = UFS_PM_LVL_0; lvl < UFS_PM_LVL_MAX; lvl++) + curr_len += snprintf((buf + curr_len), (PAGE_SIZE - curr_len), +"\tRuntime PM level [%d] => dev_state [%s] link_state [%s]\n", + lvl, + ufschd_ufs_dev_pwr_mode_to_string( + ufs_pm_lvl_states[lvl].dev_state), + ufschd_uic_link_state_to_string( + ufs_pm_lvl_states[lvl].link_state)); + + return curr_len; +} + +static ssize_t rpm_lvl_store(struct device *dev, + struct device_attribute *attr, const char *buf, size_t count) +{ + return ufs_sysfs_pm_lvl_store(dev, attr, buf, count, true); +} + +static ssize_t spm_lvl_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct ufs_hba *hba = dev_get_drvdata(dev); + int curr_len; + u8 lvl; + + curr_len = snprintf(buf, PAGE_SIZE, + "\nCurrent System PM level [%d] => dev_state [%s] link_state [%s]\n", +
[PATCH v5 00/11] ufs: sysfs: read-only access to device
This patch introduces sysfs entries that will provide read-only access to device management data that could be received with UFS query requests. User-space applications will be able to read UFS device descriptors, flags and attributes. This will allow to get full UFS device configuration and its status. The descriptors are provided as set of files representing its parameters. The flags are using "true"/"false" representation of their value. The attributes are shown as hexadecimal value. The descriptors, attributes and flags are placed in separate subfolders under the UFS device sysfs entry (/sys/bus/platform/drivers/ufshcd/*/). The string descriptor subfolder contains five string descriptors defined by UFS specification 2.1. The LUN specific descriptor and attribute are placed under corresponding SCSI device sysfs entries (/sys/class/scsi_device/*/device/). In addition the patch presents an additional field in the scsi_host_template structure - struct attribute_group **sdev_group. This field allows to define groups of attributes. It will provide an ability to use binary attributes in addition to device attributes and to group them under subfolders if necessary. Changelog: v4 -> v5 Added "scsi: " to clarify the patch naming The scsi: ufs: sysfs: unit descriptor was split to two patches "scsi: host template attribute groups" and "scsi: ufs: sysfs: unit descriptor" The "const" modificator was added to the sdev_groups member type and all corresponding data structures. The type conversions in the relative calls of sysfs_create_groups/sysfs_remove_groups were cleared. The ufs_desc_param_size enumeration was replaced with numeric constants The UFS_LUN_ATTRIBUTE macro was removed The be*_to_cpu function calls were replaced with corresponding get_unaligned_be* calls The legal information was cut leaving only the SPDX line and the copyright information v3 -> v4 Additional patch that introduces default attributes group for the existing ufs sysfs entries (rpm_lvl and spm_lvl) The ufs_sysfs_read_desc_param function calls to ufshcd_read_desc_param insted of ufshcd_query_descriptor_retry to avoid code duplication. The code was updated to remove the checkpatch error "ERROR: Macros with complex values should be enclosed in parentheses" Added "_" to macros parameters to remove "#undef DEVICE_CLASS" The legal information was updated to satisfy the SPDX requirements The date in Documentation/ABI/testing/sysfs-driver-ufs was updated. v2 -> v3 The Makefile is updated to make ufs-sysfs.c part of the ufshcd module. The unnecessary EXPORT_SYMBOL were removed Added a legal info header to the new files The date in Documentation/ABI/testing/sysfs-driver-ufs was updated. v1 -> v2 Provided additional description for the changes Stanislav Nijnikov (11): scsi: ufs: sysfs: attribute group for existing sysfs entries. scsi: ufs: sysfs: device descriptor scsi: ufs: sysfs: interconnect descriptor scsi: ufs: sysfs: geometry descriptor scsi: ufs: sysfs: health descriptor scsi: ufs: sysfs: power descriptor scsi: ufs: sysfs: string descriptors scsi: host template attribute groups scsi: ufs: sysfs: unit descriptor scsi: ufs: sysfs: flags scsi: ufs: sysfs: attributes Documentation/ABI/testing/sysfs-driver-ufs | 804 + drivers/scsi/scsi_sysfs.c | 12 + drivers/scsi/ufs/Makefile | 3 +- drivers/scsi/ufs/ufs-sysfs.c | 737 ++ drivers/scsi/ufs/ufs-sysfs.h | 17 + drivers/scsi/ufs/ufs.h | 115 - drivers/scsi/ufs/ufshcd.c | 218 ++-- drivers/scsi/ufs/ufshcd.h | 34 ++ include/scsi/scsi_host.h | 6 + 9 files changed, 1755 insertions(+), 191 deletions(-) create mode 100644 Documentation/ABI/testing/sysfs-driver-ufs create mode 100644 drivers/scsi/ufs/ufs-sysfs.c create mode 100644 drivers/scsi/ufs/ufs-sysfs.h -- 2.7.4
[PATCH v5 04/11] scsi: ufs: sysfs: geometry descriptor
This patch introduces a sysfs group entry for the UFS geometry descriptor parameters. The group adds "geometry_descriptor" folder under the UFS driver sysfs entry (/sys/bus/platform/drivers/ufshcd/*). The parameters are shown as hexadecimal numbers. The full information about the parameters could be found at UFS specifications 2.1. Signed-off-by: Stanislav Nijnikov Reviewed-by: Greg Kroah-Hartman --- Documentation/ABI/testing/sysfs-driver-ufs | 173 + drivers/scsi/ufs/ufs-sysfs.c | 84 ++ drivers/scsi/ufs/ufs.h | 36 ++ 3 files changed, 293 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-driver-ufs b/Documentation/ABI/testing/sysfs-driver-ufs index 099e6fa..6ea7613 100644 --- a/Documentation/ABI/testing/sysfs-driver-ufs +++ b/Documentation/ABI/testing/sysfs-driver-ufs @@ -240,3 +240,176 @@ Description: This file shows the MIPI M-PHY version number in BCD format. The full information about the descriptor could be found at UFS specifications 2.1. The file is read only. + + +What: /sys/bus/platform/drivers/ufshcd/*/geometry_descriptor/raw_device_capacity +Date: February 2018 +Contact: Stanislav Nijnikov +Description: This file shows the total memory quantity available to + the user to configure the device logical units. This is one + of the UFS geometry descriptor parameters. The full + information about the descriptor could be found at + UFS specifications 2.1. + The file is read only. + +What: /sys/bus/platform/drivers/ufshcd/*/geometry_descriptor/max_number_of_luns +Date: February 2018 +Contact: Stanislav Nijnikov +Description: This file shows the maximum number of logical units + supported by the UFS device. This is one of the UFS + geometry descriptor parameters. The full information about + the descriptor could be found at UFS specifications 2.1. + The file is read only. + +What: /sys/bus/platform/drivers/ufshcd/*/geometry_descriptor/segment_size +Date: February 2018 +Contact: Stanislav Nijnikov +Description: This file shows the segment size. This is one of the UFS + geometry descriptor parameters. The full information about + the descriptor could be found at UFS specifications 2.1. + The file is read only. + +What: /sys/bus/platform/drivers/ufshcd/*/geometry_descriptor/allocation_unit_size +Date: February 2018 +Contact: Stanislav Nijnikov +Description: This file shows the allocation unit size. This is one of + the UFS geometry descriptor parameters. The full information + about the descriptor could be found at UFS specifications 2.1. + The file is read only. + +What: /sys/bus/platform/drivers/ufshcd/*/geometry_descriptor/min_addressable_block_size +Date: February 2018 +Contact: Stanislav Nijnikov +Description: This file shows the minimum addressable block size. This + is one of the UFS geometry descriptor parameters. The full + information about the descriptor could be found at UFS + specifications 2.1. + The file is read only. + +What: /sys/bus/platform/drivers/ufshcd/*/geometry_descriptor/optimal_read_block_size +Date: February 2018 +Contact: Stanislav Nijnikov +Description: This file shows the optimal read block size. This is one + of the UFS geometry descriptor parameters. The full + information about the descriptor could be found at UFS + specifications 2.1. + The file is read only. + +What: /sys/bus/platform/drivers/ufshcd/*/geometry_descriptor/optimal_write_block_size +Date: February 2018 +Contact: Stanislav Nijnikov +Description: This file shows the optimal write block size. This is one + of the UFS geometry descriptor parameters. The full + information about the descriptor could be found at UFS + specifications 2.1. + The file is read only. + +What: /sys/bus/platform/drivers/ufshcd/*/geometry_descriptor/max_in_buffer_size +Date: February 2018 +Contact: Stanislav Nijnikov +Description: This file shows the maximum data-in buffer size. This + is one of the UFS geometry descriptor parameters. The full + information about the descriptor could be found at UFS + specifications 2.1. + The file is read only. + +What: /sys/bus/platform/drivers/ufshcd/*/geometry_descriptor/max_out_buffer_size +Date: February 2018 +Contact: Stanislav Nijnikov +Description: This file shows the maximum
[PATCH v5 05/11] scsi: ufs: sysfs: health descriptor
This patch introduces a sysfs group entry for the UFS health descriptor parameters. The group adds "health_descriptor" folder under the UFS driver sysfs entry (/sys/bus/platform/drivers/ufshcd/*). The parameters are shown as hexadecimal numbers. The full information about the parameters could be found at UFS specifications 2.1. Signed-off-by: Stanislav Nijnikov Reviewed-by: Greg Kroah-Hartman --- Documentation/ABI/testing/sysfs-driver-ufs | 28 drivers/scsi/ufs/ufs-sysfs.c | 20 drivers/scsi/ufs/ufs.h | 11 +++ drivers/scsi/ufs/ufshcd.c | 8 drivers/scsi/ufs/ufshcd.h | 1 + 5 files changed, 68 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-driver-ufs b/Documentation/ABI/testing/sysfs-driver-ufs index 6ea7613..ddb012b 100644 --- a/Documentation/ABI/testing/sysfs-driver-ufs +++ b/Documentation/ABI/testing/sysfs-driver-ufs @@ -413,3 +413,31 @@ Description: This file shows the memory capacity adjustment factor for descriptor parameters. The full information about the descriptor could be found at UFS specifications 2.1. The file is read only. + + +What: /sys/bus/platform/drivers/ufshcd/*/health_descriptor/eol_info +Date: February 2018 +Contact: Stanislav Nijnikov +Description: This file shows preend of life information. This is one + of the UFS health descriptor parameters. The full + information about the descriptor could be found at + UFS specifications 2.1. + The file is read only. + +What: /sys/bus/platform/drivers/ufshcd/*/health_descriptor/life_time_estimation_a +Date: February 2018 +Contact: Stanislav Nijnikov +Description: This file shows indication of the device life time + (method a). This is one of the UFS health descriptor + parameters. The full information about the descriptor + could be found at UFS specifications 2.1. + The file is read only. + +What: /sys/bus/platform/drivers/ufshcd/*/health_descriptor/life_time_estimation_b +Date: February 2018 +Contact: Stanislav Nijnikov +Description: This file shows indication of the device life time + (method b). This is one of the UFS health descriptor + parameters. The full information about the descriptor + could be found at UFS specifications 2.1. + The file is read only. diff --git a/drivers/scsi/ufs/ufs-sysfs.c b/drivers/scsi/ufs/ufs-sysfs.c index 7dfa8fb..3279514 100644 --- a/drivers/scsi/ufs/ufs-sysfs.c +++ b/drivers/scsi/ufs/ufs-sysfs.c @@ -349,11 +349,31 @@ static const struct attribute_group ufs_sysfs_geometry_descriptor_group = { .attrs = ufs_sysfs_geometry_descriptor, }; +#define UFS_HEALTH_DESC_PARAM(_name, _uname, _size)\ + UFS_DESC_PARAM(_name, _uname, HEALTH, _size) + +UFS_HEALTH_DESC_PARAM(eol_info, _EOL_INFO, 1); +UFS_HEALTH_DESC_PARAM(life_time_estimation_a, _LIFE_TIME_EST_A, 1); +UFS_HEALTH_DESC_PARAM(life_time_estimation_b, _LIFE_TIME_EST_B, 1); + +static struct attribute *ufs_sysfs_health_descriptor[] = { + &dev_attr_eol_info.attr, + &dev_attr_life_time_estimation_a.attr, + &dev_attr_life_time_estimation_b.attr, + NULL, +}; + +static const struct attribute_group ufs_sysfs_health_descriptor_group = { + .name = "health_descriptor", + .attrs = ufs_sysfs_health_descriptor, +}; + static const struct attribute_group *ufs_sysfs_groups[] = { &ufs_sysfs_default_group, &ufs_sysfs_device_descriptor_group, &ufs_sysfs_interconnect_descriptor_group, &ufs_sysfs_geometry_descriptor_group, + &ufs_sysfs_health_descriptor_group, NULL, }; diff --git a/drivers/scsi/ufs/ufs.h b/drivers/scsi/ufs/ufs.h index 04d41c8..6bfeedb 100644 --- a/drivers/scsi/ufs/ufs.h +++ b/drivers/scsi/ufs/ufs.h @@ -154,6 +154,7 @@ enum desc_idn { QUERY_DESC_IDN_RFU_1= 0x6, QUERY_DESC_IDN_GEOMETRY = 0x7, QUERY_DESC_IDN_POWER= 0x8, + QUERY_DESC_IDN_HEALTH = 0x9, QUERY_DESC_IDN_MAX, }; @@ -169,6 +170,7 @@ enum ufs_desc_def_size { QUERY_DESC_INTERCONNECT_DEF_SIZE= 0x06, QUERY_DESC_GEOMETRY_DEF_SIZE= 0x44, QUERY_DESC_POWER_DEF_SIZE = 0x62, + QUERY_DESC_HEALTH_DEF_SIZE = 0x25, }; /* Unit descriptor parameters offsets in bytes*/ @@ -274,6 +276,15 @@ enum geometry_desc_param { GEOMETRY_DESC_PARAM_OPT_LOG_BLK_SIZE= 0x44, }; +/* Health descriptor parameters offsets in bytes*/ +enum health_desc_param { + HEALTH_DESC_PARAM_LEN = 0x0, + HEALTH_DESC_PARAM_TYPE = 0x1, + HEALTH_DESC_PARAM_EOL_IN
[PATCH v5 02/11] scsi: ufs: sysfs: device descriptor
This patch introduces a sysfs group entry for the UFS device descriptor parameters. The group adds "device_descriptor" folder under the UFS driver sysfs entry (/sys/bus/platform/drivers/ufshcd/*). The parameters are shown as hexadecimal numbers. The full information about the parameters could be found at UFS specifications 2.1. Signed-off-by: Stanislav Nijnikov --- Documentation/ABI/testing/sysfs-driver-ufs | 223 + drivers/scsi/ufs/ufs-sysfs.c | 116 +++ drivers/scsi/ufs/ufs.h | 8 ++ drivers/scsi/ufs/ufshcd.c | 12 +- drivers/scsi/ufs/ufshcd.h | 6 + 5 files changed, 359 insertions(+), 6 deletions(-) create mode 100644 Documentation/ABI/testing/sysfs-driver-ufs diff --git a/Documentation/ABI/testing/sysfs-driver-ufs b/Documentation/ABI/testing/sysfs-driver-ufs new file mode 100644 index 000..8da7b84 --- /dev/null +++ b/Documentation/ABI/testing/sysfs-driver-ufs @@ -0,0 +1,223 @@ +What: /sys/bus/platform/drivers/ufshcd/*/device_descriptor/device_type +Date: February 2018 +Contact: Stanislav Nijnikov +Description: This file shows the device type. This is one of the UFS + device descriptor parameters. The full information about + the descriptor could be found at UFS specifications 2.1. + The file is read only. + +What: /sys/bus/platform/drivers/ufshcd/*/device_descriptor/device_class +Date: February 2018 +Contact: Stanislav Nijnikov +Description: This file shows the device class. This is one of the UFS + device descriptor parameters. The full information about + the descriptor could be found at UFS specifications 2.1. + The file is read only. + +What: /sys/bus/platform/drivers/ufshcd/*/device_descriptor/device_sub_class +Date: February 2018 +Contact: Stanislav Nijnikov +Description: This file shows the UFS storage subclass. This is one of + the UFS device descriptor parameters. The full information + about the descriptor could be found at UFS specifications 2.1. + The file is read only. + +What: /sys/bus/platform/drivers/ufshcd/*/device_descriptor/protocol +Date: February 2018 +Contact: Stanislav Nijnikov +Description: This file shows the protocol supported by an UFS device. + This is one of the UFS device descriptor parameters. + The full information about the descriptor could be found + at UFS specifications 2.1. + The file is read only. + +What: /sys/bus/platform/drivers/ufshcd/*/device_descriptor/number_of_luns +Date: February 2018 +Contact: Stanislav Nijnikov +Description: This file shows number of logical units. This is one of + the UFS device descriptor parameters. The full information + about the descriptor could be found at UFS specifications 2.1. + The file is read only. + +What: /sys/bus/platform/drivers/ufshcd/*/device_descriptor/number_of_wluns +Date: February 2018 +Contact: Stanislav Nijnikov +Description: This file shows number of well known logical units. + This is one of the UFS device descriptor parameters. + The full information about the descriptor could be found + at UFS specifications 2.1. + The file is read only. + +What: /sys/bus/platform/drivers/ufshcd/*/device_descriptor/boot_enable +Date: February 2018 +Contact: Stanislav Nijnikov +Description: This file shows value that indicates whether the device is + enabled for boot. This is one of the UFS device descriptor + parameters. The full information about the descriptor could + be found at UFS specifications 2.1. + The file is read only. + +What: /sys/bus/platform/drivers/ufshcd/*/device_descriptor/descriptor_access_enable +Date: February 2018 +Contact: Stanislav Nijnikov +Description: This file shows value that indicates whether the device + descriptor could be read after partial initialization phase + of the boot sequence. This is one of the UFS device descriptor + parameters. The full information about the descriptor could + be found at UFS specifications 2.1. + The file is read only. + +What: /sys/bus/platform/drivers/ufshcd/*/device_descriptor/initial_power_mode +Date: February 2018 +Contact: Stanislav Nijnikov +Description: This file shows value that defines the power mode after + device initialization or hardware reset. This is one of + the UFS device descriptor parameters. The full information + about the descriptor could
[PATCH v5 06/11] scsi: ufs: sysfs: power descriptor
This patch introduces a sysfs group entry for the UFS power descriptor parameters. The group adds "power_descriptor" folder under the UFS driver sysfs entry (/sys/bus/platform/drivers/ufshcd/*). The parameters are shown as hexadecimal numbers. The full information about the parameters could be found at UFS specifications 2.1. Signed-off-by: Stanislav Nijnikov Reviewed-by: Greg Kroah-Hartman --- Documentation/ABI/testing/sysfs-driver-ufs | 10 +++ drivers/scsi/ufs/ufs-sysfs.c | 117 + 2 files changed, 127 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-driver-ufs b/Documentation/ABI/testing/sysfs-driver-ufs index ddb012b..7460566 100644 --- a/Documentation/ABI/testing/sysfs-driver-ufs +++ b/Documentation/ABI/testing/sysfs-driver-ufs @@ -441,3 +441,13 @@ Description: This file shows indication of the device life time parameters. The full information about the descriptor could be found at UFS specifications 2.1. The file is read only. + + +What: /sys/bus/platform/drivers/ufshcd/*/power_descriptor/active_icc_levels_vcc* +Date: February 2018 +Contact: Stanislav Nijnikov +Description: This file shows maximum VCC, VCCQ and VCCQ2 value for + active ICC levels from 0 to 15. This is one of the UFS + power descriptor parameters. The full information about + the descriptor could be found at UFS specifications 2.1. + The file is read only. diff --git a/drivers/scsi/ufs/ufs-sysfs.c b/drivers/scsi/ufs/ufs-sysfs.c index 3279514..43f965a 100644 --- a/drivers/scsi/ufs/ufs-sysfs.c +++ b/drivers/scsi/ufs/ufs-sysfs.c @@ -368,12 +368,129 @@ static const struct attribute_group ufs_sysfs_health_descriptor_group = { .attrs = ufs_sysfs_health_descriptor, }; +#define UFS_POWER_DESC_PARAM(_name, _uname, _index)\ +static ssize_t _name##_index##_show(struct device *dev, \ + struct device_attribute *attr, char *buf) \ +{ \ + struct ufs_hba *hba = dev_get_drvdata(dev); \ + return ufs_sysfs_read_desc_param(hba, QUERY_DESC_IDN_POWER, 0, \ + PWR_DESC##_uname##_0 + _index * 2, buf, 2); \ +} \ +static DEVICE_ATTR_RO(_name##_index) + +UFS_POWER_DESC_PARAM(active_icc_levels_vcc, _ACTIVE_LVLS_VCC, 0); +UFS_POWER_DESC_PARAM(active_icc_levels_vcc, _ACTIVE_LVLS_VCC, 1); +UFS_POWER_DESC_PARAM(active_icc_levels_vcc, _ACTIVE_LVLS_VCC, 2); +UFS_POWER_DESC_PARAM(active_icc_levels_vcc, _ACTIVE_LVLS_VCC, 3); +UFS_POWER_DESC_PARAM(active_icc_levels_vcc, _ACTIVE_LVLS_VCC, 4); +UFS_POWER_DESC_PARAM(active_icc_levels_vcc, _ACTIVE_LVLS_VCC, 5); +UFS_POWER_DESC_PARAM(active_icc_levels_vcc, _ACTIVE_LVLS_VCC, 6); +UFS_POWER_DESC_PARAM(active_icc_levels_vcc, _ACTIVE_LVLS_VCC, 7); +UFS_POWER_DESC_PARAM(active_icc_levels_vcc, _ACTIVE_LVLS_VCC, 8); +UFS_POWER_DESC_PARAM(active_icc_levels_vcc, _ACTIVE_LVLS_VCC, 9); +UFS_POWER_DESC_PARAM(active_icc_levels_vcc, _ACTIVE_LVLS_VCC, 10); +UFS_POWER_DESC_PARAM(active_icc_levels_vcc, _ACTIVE_LVLS_VCC, 11); +UFS_POWER_DESC_PARAM(active_icc_levels_vcc, _ACTIVE_LVLS_VCC, 12); +UFS_POWER_DESC_PARAM(active_icc_levels_vcc, _ACTIVE_LVLS_VCC, 13); +UFS_POWER_DESC_PARAM(active_icc_levels_vcc, _ACTIVE_LVLS_VCC, 14); +UFS_POWER_DESC_PARAM(active_icc_levels_vcc, _ACTIVE_LVLS_VCC, 15); +UFS_POWER_DESC_PARAM(active_icc_levels_vccq, _ACTIVE_LVLS_VCCQ, 0); +UFS_POWER_DESC_PARAM(active_icc_levels_vccq, _ACTIVE_LVLS_VCCQ, 1); +UFS_POWER_DESC_PARAM(active_icc_levels_vccq, _ACTIVE_LVLS_VCCQ, 2); +UFS_POWER_DESC_PARAM(active_icc_levels_vccq, _ACTIVE_LVLS_VCCQ, 3); +UFS_POWER_DESC_PARAM(active_icc_levels_vccq, _ACTIVE_LVLS_VCCQ, 4); +UFS_POWER_DESC_PARAM(active_icc_levels_vccq, _ACTIVE_LVLS_VCCQ, 5); +UFS_POWER_DESC_PARAM(active_icc_levels_vccq, _ACTIVE_LVLS_VCCQ, 6); +UFS_POWER_DESC_PARAM(active_icc_levels_vccq, _ACTIVE_LVLS_VCCQ, 7); +UFS_POWER_DESC_PARAM(active_icc_levels_vccq, _ACTIVE_LVLS_VCCQ, 8); +UFS_POWER_DESC_PARAM(active_icc_levels_vccq, _ACTIVE_LVLS_VCCQ, 9); +UFS_POWER_DESC_PARAM(active_icc_levels_vccq, _ACTIVE_LVLS_VCCQ, 10); +UFS_POWER_DESC_PARAM(active_icc_levels_vccq, _ACTIVE_LVLS_VCCQ, 11); +UFS_POWER_DESC_PARAM(active_icc_levels_vccq, _ACTIVE_LVLS_VCCQ, 12); +UFS_POWER_DESC_PARAM(active_icc_levels_vccq, _ACTIVE_LVLS_VCCQ, 13); +UFS_POWER_DESC_PARAM(active_icc_levels_vccq, _ACTIVE_LVLS_VCCQ, 14); +UFS_POWER_DESC_PARAM(active_icc_levels_vccq, _ACTIVE_LVLS_VCCQ, 15); +UFS_POWER_DESC_PARAM(active_icc_levels_vccq2, _ACTIVE_LVLS_VCCQ2, 0); +UFS_POWER_DESC_PARAM(active_icc_levels_vccq2, _ACTIVE_LVLS_VCCQ2, 1); +UFS_POWER_DESC_PARAM(active_icc_levels_vccq2, _ACTIVE_LVLS_VCCQ2, 2); +UFS_POWER_DESC_PARAM(active_icc_levels_vccq2, _ACTIVE_LVLS_VCCQ2, 3); +UFS_POWER_DESC
[PATCH v5 10/11] scsi: ufs: sysfs: flags
This patch introduces a sysfs group entry for the UFS flags. The group adds "flags" folder under the UFS driver sysfs entry (/sys/bus/platform/drivers/ufshcd/*). The flags are shown as boolean value ("true" or "false"). The full information about the UFS flags could be found at UFS specifications 2.1. Signed-off-by: Stanislav Nijnikov --- Documentation/ABI/testing/sysfs-driver-ufs | 65 ++ drivers/scsi/ufs/ufs-sysfs.c | 39 ++ drivers/scsi/ufs/ufs.h | 14 +-- 3 files changed, 115 insertions(+), 3 deletions(-) diff --git a/Documentation/ABI/testing/sysfs-driver-ufs b/Documentation/ABI/testing/sysfs-driver-ufs index 57c6a90..f4f49e2 100644 --- a/Documentation/ABI/testing/sysfs-driver-ufs +++ b/Documentation/ABI/testing/sysfs-driver-ufs @@ -598,3 +598,68 @@ Description: This file shows the granularity of the LUN. This is one of the UFS unit descriptor parameters. The full information about the descriptor could be found at UFS specifications 2.1. The file is read only. + + +What: /sys/bus/platform/drivers/ufshcd/*/flags/device_init +Date: February 2018 +Contact: Stanislav Nijnikov +Description: This file shows the device init status. The full information + about the flag could be found at UFS specifications 2.1. + The file is read only. + +What: /sys/bus/platform/drivers/ufshcd/*/flags/permanent_wpe +Date: February 2018 +Contact: Stanislav Nijnikov +Description: This file shows whether permanent write protection is enabled. + The full information about the flag could be found at + UFS specifications 2.1. + The file is read only. + +What: /sys/bus/platform/drivers/ufshcd/*/flags/power_on_wpe +Date: February 2018 +Contact: Stanislav Nijnikov +Description: This file shows whether write protection is enabled on all + logical units configured as power on write protected. The + full information about the flag could be found at + UFS specifications 2.1. + The file is read only. + +What: /sys/bus/platform/drivers/ufshcd/*/flags/bkops_enable +Date: February 2018 +Contact: Stanislav Nijnikov +Description: This file shows whether the device background operations are + enabled. The full information about the flag could be + found at UFS specifications 2.1. + The file is read only. + +What: /sys/bus/platform/drivers/ufshcd/*/flags/life_span_mode_enable +Date: February 2018 +Contact: Stanislav Nijnikov +Description: This file shows whether the device life span mode is enabled. + The full information about the flag could be found at + UFS specifications 2.1. + The file is read only. + +What: /sys/bus/platform/drivers/ufshcd/*/flags/phy_resource_removal +Date: February 2018 +Contact: Stanislav Nijnikov +Description: This file shows whether physical resource removal is enable. + The full information about the flag could be found at + UFS specifications 2.1. + The file is read only. + +What: /sys/bus/platform/drivers/ufshcd/*/flags/busy_rtc +Date: February 2018 +Contact: Stanislav Nijnikov +Description: This file shows whether the device is executing internal + operation related to real time clock. The full information + about the flag could be found at UFS specifications 2.1. + The file is read only. + +What: /sys/bus/platform/drivers/ufshcd/*/flags/disable_fw_update +Date: February 2018 +Contact: Stanislav Nijnikov +Description: This file shows whether the device FW update is permanently + disabled. The full information about the flag could be found + at UFS specifications 2.1. + The file is read only. diff --git a/drivers/scsi/ufs/ufs-sysfs.c b/drivers/scsi/ufs/ufs-sysfs.c index fc43583..258fb75 100644 --- a/drivers/scsi/ufs/ufs-sysfs.c +++ b/drivers/scsi/ufs/ufs-sysfs.c @@ -538,6 +538,44 @@ static const struct attribute_group ufs_sysfs_string_descriptors_group = { .attrs = ufs_sysfs_string_descriptors, }; +#define UFS_FLAG(_name, _uname) \ +static ssize_t _name##_show(struct device *dev, \ + struct device_attribute *attr, char *buf) \ +{ \ + bool flag; \ + struct ufs_hba *hba = dev_get_drvdata(dev); \ + if (ufshcd_query_flag(hba, UPIU_QUERY_OPCODE_READ_FLAG, \
[PATCH v5 11/11] scsi: ufs: sysfs: attributes
This patch introduces a sysfs group entry for the UFS attributes. The group adds "attributes" folder under the UFS driver sysfs entry (/sys/bus/platform/drivers/ufshcd/*). The attributes are shown as hexadecimal numbers. The full information about the attributes could be found at UFS specifications 2.1. Signed-off-by: Stanislav Nijnikov --- Documentation/ABI/testing/sysfs-driver-ufs | 139 + drivers/scsi/ufs/ufs-sysfs.c | 80 + drivers/scsi/ufs/ufs-sysfs.h | 1 + drivers/scsi/ufs/ufs.h | 27 +- drivers/scsi/ufs/ufshcd.c | 5 +- drivers/scsi/ufs/ufshcd.h | 3 +- 6 files changed, 248 insertions(+), 7 deletions(-) diff --git a/Documentation/ABI/testing/sysfs-driver-ufs b/Documentation/ABI/testing/sysfs-driver-ufs index f4f49e2..07f1c2f 100644 --- a/Documentation/ABI/testing/sysfs-driver-ufs +++ b/Documentation/ABI/testing/sysfs-driver-ufs @@ -663,3 +663,142 @@ Description: This file shows whether the device FW update is permanently disabled. The full information about the flag could be found at UFS specifications 2.1. The file is read only. + + +What: /sys/bus/platform/drivers/ufshcd/*/attributes/boot_lun_enabled +Date: February 2018 +Contact: Stanislav Nijnikov +Description: This file provides the boot lun enabled UFS device attribute. + The full information about the attribute could be found at + UFS specifications 2.1. + The file is read only. + +What: /sys/bus/platform/drivers/ufshcd/*/attributes/current_power_mode +Date: February 2018 +Contact: Stanislav Nijnikov +Description: This file provides the current power mode UFS device attribute. + The full information about the attribute could be found at + UFS specifications 2.1. + The file is read only. + +What: /sys/bus/platform/drivers/ufshcd/*/attributes/active_icc_level +Date: February 2018 +Contact: Stanislav Nijnikov +Description: This file provides the active icc level UFS device attribute. + The full information about the attribute could be found at + UFS specifications 2.1. + The file is read only. + +What: /sys/bus/platform/drivers/ufshcd/*/attributes/ooo_data_enabled +Date: February 2018 +Contact: Stanislav Nijnikov +Description: This file provides the out of order data transfer enabled UFS + device attribute. The full information about the attribute + could be found at UFS specifications 2.1. + The file is read only. + +What: /sys/bus/platform/drivers/ufshcd/*/attributes/bkops_status +Date: February 2018 +Contact: Stanislav Nijnikov +Description: This file provides the background operations status UFS device + attribute. The full information about the attribute could + be found at UFS specifications 2.1. + The file is read only. + +What: /sys/bus/platform/drivers/ufshcd/*/attributes/purge_status +Date: February 2018 +Contact: Stanislav Nijnikov +Description: This file provides the purge operation status UFS device + attribute. The full information about the attribute could + be found at UFS specifications 2.1. + The file is read only. + +What: /sys/bus/platform/drivers/ufshcd/*/attributes/max_data_in_size +Date: February 2018 +Contact: Stanislav Nijnikov +Description: This file shows the maximum data size in a DATA IN + UPIU. The full information about the attribute could + be found at UFS specifications 2.1. + The file is read only. + +What: /sys/bus/platform/drivers/ufshcd/*/attributes/max_data_out_size +Date: February 2018 +Contact: Stanislav Nijnikov +Description: This file shows the maximum number of bytes that can be + requested with a READY TO TRANSFER UPIU. The full information + about the attribute could be found at UFS specifications 2.1. + The file is read only. + +What: /sys/bus/platform/drivers/ufshcd/*/attributes/reference_clock_frequency +Date: February 2018 +Contact: Stanislav Nijnikov +Description: This file provides the reference clock frequency UFS device + attribute. The full information about the attribute could + be found at UFS specifications 2.1. + The file is read only. + +What: /sys/bus/platform/drivers/ufshcd/*/attributes/configuration_descriptor_lock +Date: February 2018 +Contact: Stanislav Nijnikov +Description: This file shows whether the configuration descriptor is locked. +
[PATCH v5 03/11] scsi: ufs: sysfs: interconnect descriptor
This patch introduces a sysfs group entry for the UFS interconnect descriptor parameters. The group adds "interconnect_descriptor" folder under the UFS driver sysfs entry (/sys/bus/platform/drivers/ufshcd/*). The parameters are shown as hexadecimal numbers. The full information about the parameters could be found at UFS specifications 2.1. Signed-off-by: Stanislav Nijnikov Reviewed-by: Greg Kroah-Hartman --- Documentation/ABI/testing/sysfs-driver-ufs | 19 +++ drivers/scsi/ufs/ufs-sysfs.c | 18 ++ drivers/scsi/ufs/ufs.h | 8 3 files changed, 45 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-driver-ufs b/Documentation/ABI/testing/sysfs-driver-ufs index 8da7b84..099e6fa 100644 --- a/Documentation/ABI/testing/sysfs-driver-ufs +++ b/Documentation/ABI/testing/sysfs-driver-ufs @@ -221,3 +221,22 @@ Description: This file shows the command maximum timeout for a change parameters. The full information about the descriptor could be found at UFS specifications 2.1. The file is read only. + + +What: /sys/bus/platform/drivers/ufshcd/*/interconnect_descriptor/unipro_version +Date: February 2018 +Contact: Stanislav Nijnikov +Description: This file shows the MIPI UniPro version number in BCD format. + This is one of the UFS interconnect descriptor parameters. + The full information about the descriptor could be found at + UFS specifications 2.1. + The file is read only. + +What: /sys/bus/platform/drivers/ufshcd/*/interconnect_descriptor/mphy_version +Date: February 2018 +Contact: Stanislav Nijnikov +Description: This file shows the MIPI M-PHY version number in BCD format. + This is one of the UFS interconnect descriptor parameters. + The full information about the descriptor could be found at + UFS specifications 2.1. + The file is read only. diff --git a/drivers/scsi/ufs/ufs-sysfs.c b/drivers/scsi/ufs/ufs-sysfs.c index aa2779a..e9e6ee4 100644 --- a/drivers/scsi/ufs/ufs-sysfs.c +++ b/drivers/scsi/ufs/ufs-sysfs.c @@ -249,9 +249,27 @@ static const struct attribute_group ufs_sysfs_device_descriptor_group = { .attrs = ufs_sysfs_device_descriptor, }; +#define UFS_INTERCONNECT_DESC_PARAM(_name, _uname, _size) \ + UFS_DESC_PARAM(_name, _uname, INTERCONNECT, _size) + +UFS_INTERCONNECT_DESC_PARAM(unipro_version, _UNIPRO_VER, 2); +UFS_INTERCONNECT_DESC_PARAM(mphy_version, _MPHY_VER, 2); + +static struct attribute *ufs_sysfs_interconnect_descriptor[] = { + &dev_attr_unipro_version.attr, + &dev_attr_mphy_version.attr, + NULL, +}; + +static const struct attribute_group ufs_sysfs_interconnect_descriptor_group = { + .name = "interconnect_descriptor", + .attrs = ufs_sysfs_interconnect_descriptor, +}; + static const struct attribute_group *ufs_sysfs_groups[] = { &ufs_sysfs_default_group, &ufs_sysfs_device_descriptor_group, + &ufs_sysfs_interconnect_descriptor_group, NULL, }; diff --git a/drivers/scsi/ufs/ufs.h b/drivers/scsi/ufs/ufs.h index 6ae1e08..773c049 100644 --- a/drivers/scsi/ufs/ufs.h +++ b/drivers/scsi/ufs/ufs.h @@ -230,6 +230,14 @@ enum device_desc_param { DEVICE_DESC_PARAM_PRDCT_REV = 0x2A, }; +/* Interconnect descriptor parameters offsets in bytes*/ +enum interconnect_desc_param { + INTERCONNECT_DESC_PARAM_LEN = 0x0, + INTERCONNECT_DESC_PARAM_TYPE= 0x1, + INTERCONNECT_DESC_PARAM_UNIPRO_VER = 0x2, + INTERCONNECT_DESC_PARAM_MPHY_VER= 0x4, +}; + /* * Logical Unit Write Protect * 00h: LU not write protected -- 2.7.4
[PATCH v5 07/11] scsi: ufs: sysfs: string descriptors
This patch introduces a sysfs group entry for the UFS string descriptors. The group adds "string_descriptors" folder under the UFS driver sysfs entry (/sys/bus/platform/drivers/ufshcd/*). The folder will contain 5 files that will show string values defined by the UFS spec: a manufacturer name, a product name, an OEM id, a serial number and a product revision. The full information about the string descriptors could be found at UFS specifications 2.1. Signed-off-by: Stanislav Nijnikov Reviewed-by: Greg Kroah-Hartman --- Documentation/ABI/testing/sysfs-driver-ufs | 39 + drivers/scsi/ufs/ufs-sysfs.c | 56 ++ drivers/scsi/ufs/ufshcd.c | 14 drivers/scsi/ufs/ufshcd.h | 9 + 4 files changed, 111 insertions(+), 7 deletions(-) diff --git a/Documentation/ABI/testing/sysfs-driver-ufs b/Documentation/ABI/testing/sysfs-driver-ufs index 7460566..c17a968 100644 --- a/Documentation/ABI/testing/sysfs-driver-ufs +++ b/Documentation/ABI/testing/sysfs-driver-ufs @@ -451,3 +451,42 @@ Description: This file shows maximum VCC, VCCQ and VCCQ2 value for power descriptor parameters. The full information about the descriptor could be found at UFS specifications 2.1. The file is read only. + + +What: /sys/bus/platform/drivers/ufshcd/*/string_descriptors/manufacturer_name +Date: February 2018 +Contact: Stanislav Nijnikov +Description: This file contains a device manufactureer name string. + The full information about the descriptor could be found at + UFS specifications 2.1. + The file is read only. + +What: /sys/bus/platform/drivers/ufshcd/*/string_descriptors/product_name +Date: February 2018 +Contact: Stanislav Nijnikov +Description: This file contains a product name string. The full information + about the descriptor could be found at UFS specifications 2.1. + The file is read only. + +What: /sys/bus/platform/drivers/ufshcd/*/string_descriptors/oem_id +Date: February 2018 +Contact: Stanislav Nijnikov +Description: This file contains a OEM ID string. The full information + about the descriptor could be found at UFS specifications 2.1. + The file is read only. + +What: /sys/bus/platform/drivers/ufshcd/*/string_descriptors/serial_number +Date: February 2018 +Contact: Stanislav Nijnikov +Description: This file contains a device serial number string. The full + information about the descriptor could be found at + UFS specifications 2.1. + The file is read only. + +What: /sys/bus/platform/drivers/ufshcd/*/string_descriptors/product_revision +Date: February 2018 +Contact: Stanislav Nijnikov +Description: This file contains a product revision string. The full + information about the descriptor could be found at + UFS specifications 2.1. + The file is read only. diff --git a/drivers/scsi/ufs/ufs-sysfs.c b/drivers/scsi/ufs/ufs-sysfs.c index 43f965a..7130e0d 100644 --- a/drivers/scsi/ufs/ufs-sysfs.c +++ b/drivers/scsi/ufs/ufs-sysfs.c @@ -484,6 +484,61 @@ static const struct attribute_group ufs_sysfs_power_descriptor_group = { .attrs = ufs_sysfs_power_descriptor, }; +#define UFS_STRING_DESCRIPTOR(_name, _pname) \ +static ssize_t _name##_show(struct device *dev, \ + struct device_attribute *attr, char *buf) \ +{ \ + u8 index; \ + struct ufs_hba *hba = dev_get_drvdata(dev); \ + int ret;\ + int desc_len = QUERY_DESC_MAX_SIZE; \ + u8 *desc_buf; \ + desc_buf = kzalloc(QUERY_DESC_MAX_SIZE, GFP_ATOMIC);\ + if (!desc_buf) \ + return -ENOMEM; \ + ret = ufshcd_query_descriptor_retry(hba,\ + UPIU_QUERY_OPCODE_READ_DESC, QUERY_DESC_IDN_DEVICE, \ + 0, 0, desc_buf, &desc_len); \ + if (ret) { \ + ret = -EINVAL; \ + goto out; \ + } \ + index = desc_buf[DEVICE_DESC_PARAM##_pname];\ + memset(desc_
[PATCH v5 08/11] scsi: host template attribute groups
The patch introduces an additional field in the scsi_host_template structure - struct attribute_group **sdev_group. This field allows to define groups of attributes. It will provide an ability to use binary attributes as well as device attributes and to group them under subfolders if necessary. Signed-off-by: Stanislav Nijnikov Reviewed-by: Greg Kroah-Hartman --- drivers/scsi/scsi_sysfs.c | 12 include/scsi/scsi_host.h | 6 ++ 2 files changed, 18 insertions(+) diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c index cbc0fe2..fe5d1cb 100644 --- a/drivers/scsi/scsi_sysfs.c +++ b/drivers/scsi/scsi_sysfs.c @@ -1309,6 +1309,13 @@ int scsi_sysfs_add_sdev(struct scsi_device *sdev) } } + if (sdev->host->hostt->sdev_groups) { + error = sysfs_create_groups(&sdev->sdev_gendev.kobj, + sdev->host->hostt->sdev_groups); + if (error) + return error; + } + scsi_autopm_put_device(sdev); return error; } @@ -1326,6 +1333,11 @@ void __scsi_remove_device(struct scsi_device *sdev) if (sdev->sdev_state == SDEV_DEL) return; + if (sdev->host->hostt->sdev_groups) { + sysfs_remove_groups(&sdev->sdev_gendev.kobj, + sdev->host->hostt->sdev_groups); + } + if (sdev->is_visible) { /* * If scsi_internal_target_block() is running concurrently, diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index 1a1df0d..1931758 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h @@ -477,6 +477,12 @@ struct scsi_host_template { struct device_attribute **sdev_attrs; /* +* Pointer to the SCSI device attribute groups for this host, +* NULL terminated. +*/ + const struct attribute_group **sdev_groups; + + /* * List of hosts per template. * * This is only for use by scsi_module.c for legacy templates. -- 2.7.4
[PATCH v5 09/11] scsi: ufs: sysfs: unit descriptor
This patch introduces a sysfs group entry for the UFS unit descriptor parameters. The group adds "unit_descriptor" folder under the corresponding SCSI device sysfs entry (/sys/class/scsi_device/*/device/). The parameters are shown as hexadecimal numbers. The full information about the parameters could be found at UFS specifications 2.1. Signed-off-by: Stanislav Nijnikov Reviewed-by: Greg Kroah-Hartman --- Documentation/ABI/testing/sysfs-driver-ufs | 108 + drivers/scsi/ufs/ufs-sysfs.c | 53 ++ drivers/scsi/ufs/ufs-sysfs.h | 2 + drivers/scsi/ufs/ufs.h | 11 +++ drivers/scsi/ufs/ufshcd.c | 23 ++ drivers/scsi/ufs/ufshcd.h | 15 6 files changed, 196 insertions(+), 16 deletions(-) diff --git a/Documentation/ABI/testing/sysfs-driver-ufs b/Documentation/ABI/testing/sysfs-driver-ufs index c17a968..57c6a90 100644 --- a/Documentation/ABI/testing/sysfs-driver-ufs +++ b/Documentation/ABI/testing/sysfs-driver-ufs @@ -490,3 +490,111 @@ Description: This file contains a product revision string. The full information about the descriptor could be found at UFS specifications 2.1. The file is read only. + + +What: /sys/class/scsi_device/*/device/unit_descriptor/boot_lun_id +Date: February 2018 +Contact: Stanislav Nijnikov +Description: This file shows boot LUN information. This is one of + the UFS unit descriptor parameters. The full information + about the descriptor could be found at UFS specifications 2.1. + The file is read only. + +What: /sys/class/scsi_device/*/device/unit_descriptor/lun_write_protect +Date: February 2018 +Contact: Stanislav Nijnikov +Description: This file shows LUN write protection status. This is one of + the UFS unit descriptor parameters. The full information + about the descriptor could be found at UFS specifications 2.1. + The file is read only. + +What: /sys/class/scsi_device/*/device/unit_descriptor/lun_queue_depth +Date: February 2018 +Contact: Stanislav Nijnikov +Description: This file shows LUN queue depth. This is one of the UFS + unit descriptor parameters. The full information about + the descriptor could be found at UFS specifications 2.1. + The file is read only. + +What: /sys/class/scsi_device/*/device/unit_descriptor/psa_sensitive +Date: February 2018 +Contact: Stanislav Nijnikov +Description: This file shows PSA sensitivity. This is one of the UFS + unit descriptor parameters. The full information about + the descriptor could be found at UFS specifications 2.1. + The file is read only. + +What: /sys/class/scsi_device/*/device/unit_descriptor/lun_memory_type +Date: February 2018 +Contact: Stanislav Nijnikov +Description: This file shows LUN memory type. This is one of the UFS + unit descriptor parameters. The full information about + the descriptor could be found at UFS specifications 2.1. + The file is read only. + +What: /sys/class/scsi_device/*/device/unit_descriptor/data_reliability +Date: February 2018 +Contact: Stanislav Nijnikov +Description: This file defines the device behavior when a power failure + occurs during a write operation. This is one of the UFS + unit descriptor parameters. The full information about + the descriptor could be found at UFS specifications 2.1. + The file is read only. + +What: /sys/class/scsi_device/*/device/unit_descriptor/logical_block_size +Date: February 2018 +Contact: Stanislav Nijnikov +Description: This file shows the size of addressable logical blocks + (calculated as an exponent with base 2). This is one of + the UFS unit descriptor parameters. The full information about + the descriptor could be found at UFS specifications 2.1. + The file is read only. + +What: /sys/class/scsi_device/*/device/unit_descriptor/logical_block_count +Date: February 2018 +Contact: Stanislav Nijnikov +Description: This file shows total number of addressable logical blocks. + This is one of the UFS unit descriptor parameters. The full + information about the descriptor could be found at + UFS specifications 2.1. + The file is read only. + +What: /sys/class/scsi_device/*/device/unit_descriptor/erase_block_size +Date: February 2018 +Contact: Stanislav Nijnikov +Description: This file shows the erase block size. This is one of + the UFS unit desc
Re: [PATCH v5 08/11] scsi: host template attribute groups
On Tue, 2018-02-06 at 18:06 +0200, Stanislav Nijnikov wrote: > + if (sdev->host->hostt->sdev_groups) { > + error = sysfs_create_groups(&sdev->sdev_gendev.kobj, > + sdev->host->hostt->sdev_groups); > + if (error) > + return error; > + } Please follow the indentation style that is used elsewhere in the kernel and move the sdev->host->hostt->sdev_groups argument to the right such that it starts one position to the right of the sysfs_create_groups() opening parenthesis. Please also indent the if (error) statement correctly. > @@ -1326,6 +1333,11 @@ void __scsi_remove_device(struct scsi_device *sdev) > if (sdev->sdev_state == SDEV_DEL) > return; > > + if (sdev->host->hostt->sdev_groups) { > + sysfs_remove_groups(&sdev->sdev_gendev.kobj, > + sdev->host->hostt->sdev_groups); > + } If sdev->is_visible is false then the device_add() call for sdev->sdev_gendev may have failed so calling sysfs_remove_groups() is not necessary. Please move this call down to just before the device_del(dev) since that call also removes sysfs attributes. Additionally, I think that checkpatch will complain about the above code and will report that braces are not necessary for single-line statements? Thanks, Bart.
Re: [PATCH V2 5/8] scsi: introduce force_blk_mq
On Mon, Feb 05, 2018 at 11:20:32PM +0800, Ming Lei wrote: > From scsi driver view, it is a bit troublesome to support both blk-mq > and non-blk-mq at the same time, especially when drivers need to support > multi hw-queue. > > This patch introduces 'force_blk_mq' to scsi_host_template so that drivers > can provide blk-mq only support, so driver code can avoid the trouble > for supporting both. > > This patch may clean up driver a lot by providing blk-mq only support, > espeically > it is easier to convert multiple reply queues into blk_mq's MQ for the > following > purposes: > > 1) use blk_mq multiple hw queue to deal with allocated irq vectors of all > offline > CPU affinity[1]: > > [1] https://marc.info/?l=linux-kernel&m=151748144730409&w=2 > > Now 84676c1f21e8ff5(genirq/affinity: assign vectors to all possible CPUs) > has been merged to V4.16-rc, and it is easy to allocate all offline CPUs > for some irq vectors, this can't be avoided even though the allocation > is improved. > > So all these drivers have to avoid to ask HBA to complete request in > reply queue which hasn't online CPUs assigned. > > This issue can be solved generically and easily via blk_mq(scsi_mq) multiple > hw queue by mapping each reply queue into hctx. > > 2) some drivers[1] require to complete request in the submission CPU for > avoiding hard/soft lockup, which is easily done with blk_mq, so not necessary > to reinvent wheels for solving the problem. > > [2] https://marc.info/?t=15160185141&r=1&w=2 > > Sovling the above issues for non-MQ path may not be easy, or introduce > unnecessary work, especially we plan to enable SCSI_MQ soon as discussed > recently[3]: > > [3] https://marc.info/?l=linux-scsi&m=151727684915589&w=2 > > Cc: Arun Easi > Cc: Omar Sandoval , > Cc: "Martin K. Petersen" , > Cc: James Bottomley , > Cc: Christoph Hellwig , > Cc: Don Brace > Cc: Kashyap Desai > Cc: Peter Rivera > Cc: Mike Snitzer > Reviewed-by: Hannes Reinecke > Tested-by: Laurence Oberman > Signed-off-by: Ming Lei > --- > drivers/scsi/hosts.c | 1 + > include/scsi/scsi_host.h | 3 +++ > 2 files changed, 4 insertions(+) > > diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c > index fe3a0da3ec97..c75cebd7911d 100644 > --- a/drivers/scsi/hosts.c > +++ b/drivers/scsi/hosts.c > @@ -471,6 +471,7 @@ struct Scsi_Host *scsi_host_alloc(struct > scsi_host_template *sht, int privsize) > shost->dma_boundary = 0x; > > shost->use_blk_mq = scsi_use_blk_mq; Not sure if this is a patch formatting issue, but this old line wasn't deleted. > + shost->use_blk_mq = scsi_use_blk_mq || !!shost->hostt->force_blk_mq;
Re: [PATCH V2 2/8] blk-mq: introduce BLK_MQ_F_GLOBAL_TAGS
On Mon, Feb 05, 2018 at 11:20:29PM +0800, Ming Lei wrote: > Quite a few HBAs(such as HPSA, megaraid, mpt3sas, ..) support multiple > reply queues, but tags is often HBA wide. > > These HBAs have switched to use pci_alloc_irq_vectors(PCI_IRQ_AFFINITY) > for automatic affinity assignment. > > Now 84676c1f21e8ff5(genirq/affinity: assign vectors to all possible CPUs) > has been merged to V4.16-rc, and it is easy to allocate all offline CPUs > for some irq vectors, this can't be avoided even though the allocation > is improved. > > So all these drivers have to avoid to ask HBA to complete request in > reply queue which hasn't online CPUs assigned, and HPSA has been broken > with v4.15+: > > https://marc.info/?l=linux-kernel&m=151748144730409&w=2 > > This issue can be solved generically and easily via blk_mq(scsi_mq) multiple > hw queue by mapping each reply queue into hctx, but one tricky thing is > the HBA wide(instead of hw queue wide) tags. > > This patch is based on the following Hannes's patch: > > https://marc.info/?l=linux-block&m=149132580511346&w=2 > > One big difference with Hannes's is that this patch only makes the tags > sbitmap > and active_queues data structure HBA wide, and others are kept as NUMA > locality, > such as request, hctx, tags, ... > > The following patch will support global tags on null_blk, also the performance > data is provided, no obvious performance loss is observed when the whole > hw queue depth is same. > > Cc: Hannes Reinecke > Cc: Arun Easi > Cc: Omar Sandoval , > Cc: "Martin K. Petersen" , > Cc: James Bottomley , > Cc: Christoph Hellwig , > Cc: Don Brace > Cc: Kashyap Desai > Cc: Peter Rivera > Cc: Mike Snitzer > Tested-by: Laurence Oberman > Signed-off-by: Ming Lei > --- > block/blk-mq-debugfs.c | 1 + > block/blk-mq-sched.c | 13 - > block/blk-mq-tag.c | 23 ++- > block/blk-mq-tag.h | 5 - > block/blk-mq.c | 29 - > block/blk-mq.h | 3 ++- > include/linux/blk-mq.h | 2 ++ > 7 files changed, 63 insertions(+), 13 deletions(-) > > diff --git a/block/blk-mq-debugfs.c b/block/blk-mq-debugfs.c > index 0dfafa4b655a..0f0fafe03f5d 100644 > --- a/block/blk-mq-debugfs.c > +++ b/block/blk-mq-debugfs.c > @@ -206,6 +206,7 @@ static const char *const hctx_flag_name[] = { > HCTX_FLAG_NAME(SHOULD_MERGE), > HCTX_FLAG_NAME(TAG_SHARED), > HCTX_FLAG_NAME(SG_MERGE), > + HCTX_FLAG_NAME(GLOBAL_TAGS), > HCTX_FLAG_NAME(BLOCKING), > HCTX_FLAG_NAME(NO_SCHED), > }; > diff --git a/block/blk-mq-sched.c b/block/blk-mq-sched.c > index 55c0a745b427..385bbec73804 100644 > --- a/block/blk-mq-sched.c > +++ b/block/blk-mq-sched.c > @@ -81,6 +81,17 @@ static bool blk_mq_sched_restart_hctx(struct blk_mq_hw_ctx > *hctx) > } else > clear_bit(BLK_MQ_S_SCHED_RESTART, &hctx->state); > > + /* need to restart all hw queues for global tags */ > + if (hctx->flags & BLK_MQ_F_GLOBAL_TAGS) { > + struct blk_mq_hw_ctx *hctx2; > + int i; > + > + queue_for_each_hw_ctx(hctx->queue, hctx2, i) > + if (blk_mq_run_hw_queue(hctx2, true)) > + return true; Is it intentional that we stop after the first hw queue does work? That seems fine but it's a little confusing because the comment claims we restart everything. > + return false; > + } > +
Re: [PATCH V2 1/8] blk-mq: tags: define several fields of tags as pointer
On Mon, Feb 05, 2018 at 11:20:28PM +0800, Ming Lei wrote: > This patch changes tags->breserved_tags, tags->bitmap_tags and > tags->active_queues as pointer, and prepares for supporting global tags. > > No functional change. > > Tested-by: Laurence Oberman > Reviewed-by: Hannes Reinecke Assuming it builds :) Reviewed-by: Omar Sandoval > Cc: Mike Snitzer > Cc: Christoph Hellwig > Signed-off-by: Ming Lei > --- > block/bfq-iosched.c| 4 ++-- > block/blk-mq-debugfs.c | 10 +- > block/blk-mq-tag.c | 48 ++-- > block/blk-mq-tag.h | 10 +++--- > block/blk-mq.c | 2 +- > block/kyber-iosched.c | 2 +- > 6 files changed, 42 insertions(+), 34 deletions(-) > > diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c > index 47e6ec7427c4..1e1211814a57 100644 > --- a/block/bfq-iosched.c > +++ b/block/bfq-iosched.c > @@ -534,9 +534,9 @@ static void bfq_limit_depth(unsigned int op, struct > blk_mq_alloc_data *data) > WARN_ON_ONCE(1); > return; > } > - bt = &tags->breserved_tags; > + bt = tags->breserved_tags; > } else > - bt = &tags->bitmap_tags; > + bt = tags->bitmap_tags; > > if (unlikely(bfqd->sb_shift != bt->sb.shift)) > bfq_update_depths(bfqd, bt); > diff --git a/block/blk-mq-debugfs.c b/block/blk-mq-debugfs.c > index 21cbc1f071c6..0dfafa4b655a 100644 > --- a/block/blk-mq-debugfs.c > +++ b/block/blk-mq-debugfs.c > @@ -433,14 +433,14 @@ static void blk_mq_debugfs_tags_show(struct seq_file *m, > seq_printf(m, "nr_tags=%u\n", tags->nr_tags); > seq_printf(m, "nr_reserved_tags=%u\n", tags->nr_reserved_tags); > seq_printf(m, "active_queues=%d\n", > -atomic_read(&tags->active_queues)); > +atomic_read(tags->active_queues)); > > seq_puts(m, "\nbitmap_tags:\n"); > - sbitmap_queue_show(&tags->bitmap_tags, m); > + sbitmap_queue_show(tags->bitmap_tags, m); > > if (tags->nr_reserved_tags) { > seq_puts(m, "\nbreserved_tags:\n"); > - sbitmap_queue_show(&tags->breserved_tags, m); > + sbitmap_queue_show(tags->breserved_tags, m); > } > } > > @@ -471,7 +471,7 @@ static int hctx_tags_bitmap_show(void *data, struct > seq_file *m) > if (res) > goto out; > if (hctx->tags) > - sbitmap_bitmap_show(&hctx->tags->bitmap_tags.sb, m); > + sbitmap_bitmap_show(&hctx->tags->bitmap_tags->sb, m); > mutex_unlock(&q->sysfs_lock); > > out: > @@ -505,7 +505,7 @@ static int hctx_sched_tags_bitmap_show(void *data, struct > seq_file *m) > if (res) > goto out; > if (hctx->sched_tags) > - sbitmap_bitmap_show(&hctx->sched_tags->bitmap_tags.sb, m); > + sbitmap_bitmap_show(&hctx->sched_tags->bitmap_tags->sb, m); > mutex_unlock(&q->sysfs_lock); > > out: > diff --git a/block/blk-mq-tag.c b/block/blk-mq-tag.c > index 336dde07b230..571797dc36cb 100644 > --- a/block/blk-mq-tag.c > +++ b/block/blk-mq-tag.c > @@ -18,7 +18,7 @@ bool blk_mq_has_free_tags(struct blk_mq_tags *tags) > if (!tags) > return true; > > - return sbitmap_any_bit_clear(&tags->bitmap_tags.sb); > + return sbitmap_any_bit_clear(&tags->bitmap_tags->sb); > } > > /* > @@ -28,7 +28,7 @@ bool __blk_mq_tag_busy(struct blk_mq_hw_ctx *hctx) > { > if (!test_bit(BLK_MQ_S_TAG_ACTIVE, &hctx->state) && > !test_and_set_bit(BLK_MQ_S_TAG_ACTIVE, &hctx->state)) > - atomic_inc(&hctx->tags->active_queues); > + atomic_inc(hctx->tags->active_queues); > > return true; > } > @@ -38,9 +38,9 @@ bool __blk_mq_tag_busy(struct blk_mq_hw_ctx *hctx) > */ > void blk_mq_tag_wakeup_all(struct blk_mq_tags *tags, bool include_reserve) > { > - sbitmap_queue_wake_all(&tags->bitmap_tags); > + sbitmap_queue_wake_all(tags->bitmap_tags); > if (include_reserve) > - sbitmap_queue_wake_all(&tags->breserved_tags); > + sbitmap_queue_wake_all(tags->breserved_tags); > } > > /* > @@ -54,7 +54,7 @@ void __blk_mq_tag_idle(struct blk_mq_hw_ctx *hctx) > if (!test_and_clear_bit(BLK_MQ_S_TAG_ACTIVE, &hctx->state)) > return; > > - atomic_dec(&tags->active_queues); > + atomic_dec(tags->active_queues); > > blk_mq_tag_wakeup_all(tags, false); > } > @@ -79,7 +79,7 @@ static inline bool hctx_may_queue(struct blk_mq_hw_ctx > *hctx, > if (bt->sb.depth == 1) > return true; > > - users = atomic_read(&hctx->tags->active_queues); > + users = atomic_read(hctx->tags->active_queues); > if (!users) > return true; > > @@ -117,10 +117,10 @@ unsigned int blk_mq_get_tag(struct blk_mq_alloc_data > *data) > WARN_ON_ONCE(1); > return BLK_MQ_TAG_FAIL; >
Re: [PATCH V2 4/8] block: null_blk: introduce module parameter of 'g_global_tags'
On Mon, Feb 05, 2018 at 11:20:31PM +0800, Ming Lei wrote: > This patch introduces the parameter of 'g_global_tags' so that we can > test this feature by null_blk easiy. > > Not see obvious performance drop with global_tags when the whole hw > depth is kept as same: > > 1) no 'global_tags', each hw queue depth is 1, and 4 hw queues > modprobe null_blk queue_mode=2 nr_devices=4 shared_tags=1 global_tags=0 > submit_queues=4 hw_queue_depth=1 > > 2) 'global_tags', global hw queue depth is 4, and 4 hw queues > modprobe null_blk queue_mode=2 nr_devices=4 shared_tags=1 global_tags=1 > submit_queues=4 hw_queue_depth=4 > > 3) fio test done in above two settings: >fio --bs=4k --size=512G --rw=randread --norandommap --direct=1 > --ioengine=libaio --iodepth=4 --runtime=$RUNTIME --group_reporting=1 > --name=nullb0 --filename=/dev/nullb0 --name=nullb1 --filename=/dev/nullb1 > --name=nullb2 --filename=/dev/nullb2 --name=nullb3 --filename=/dev/nullb3 > > 1M IOPS can be reached in both above tests which is done in one VM. > > Cc: Arun Easi > Cc: Omar Sandoval , > Cc: "Martin K. Petersen" , > Cc: James Bottomley , > Cc: Christoph Hellwig , > Cc: Don Brace > Cc: Kashyap Desai > Cc: Peter Rivera > Cc: Mike Snitzer > Tested-by: Laurence Oberman > Reviewed-by: Hannes Reinecke The module parameter is just called "global_tags", not "g_global_tags", right? The subject should say the former. Otherwise, Reviewed-by: Omar Sandoval > Signed-off-by: Ming Lei > --- > drivers/block/null_blk.c | 6 ++ > 1 file changed, 6 insertions(+) > > diff --git a/drivers/block/null_blk.c b/drivers/block/null_blk.c > index 287a09611c0f..ad0834efad42 100644 > --- a/drivers/block/null_blk.c > +++ b/drivers/block/null_blk.c > @@ -163,6 +163,10 @@ static int g_submit_queues = 1; > module_param_named(submit_queues, g_submit_queues, int, S_IRUGO); > MODULE_PARM_DESC(submit_queues, "Number of submission queues"); > > +static int g_global_tags = 0; > +module_param_named(global_tags, g_global_tags, int, S_IRUGO); > +MODULE_PARM_DESC(global_tags, "All submission queues share one tags"); > + > static int g_home_node = NUMA_NO_NODE; > module_param_named(home_node, g_home_node, int, S_IRUGO); > MODULE_PARM_DESC(home_node, "Home node for the device"); > @@ -1622,6 +1626,8 @@ static int null_init_tag_set(struct nullb *nullb, > struct blk_mq_tag_set *set) > set->flags = BLK_MQ_F_SHOULD_MERGE; > if (g_no_sched) > set->flags |= BLK_MQ_F_NO_SCHED; > + if (g_global_tags) > + set->flags |= BLK_MQ_F_GLOBAL_TAGS; > set->driver_data = NULL; > > if ((nullb && nullb->dev->blocking) || g_blocking) > -- > 2.9.5 >
Re: [PATCH] scsi: qedf: remove redundant initialization of 'fcport'
On Tue, 6 Feb 2018, 9:03am, Colin King wrote: > From: Colin Ian King > > Pointer fcport is initialized with a value that is never read, it is > re-assigned a new value later on, hence the initialization is redundant > and can be removed. > > Cleans up clang warning: > drivers/scsi/qedf/qedf_io.c:920:21: warning: Value stored to 'fcport' > during its initialization is never read > > Signed-off-by: Colin Ian King > --- > drivers/scsi/qedf/qedf_io.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/scsi/qedf/qedf_io.c b/drivers/scsi/qedf/qedf_io.c > index b15e69586a36..50a50c4249d0 100644 > --- a/drivers/scsi/qedf/qedf_io.c > +++ b/drivers/scsi/qedf/qedf_io.c > @@ -917,7 +917,7 @@ qedf_queuecommand(struct Scsi_Host *host, struct > scsi_cmnd *sc_cmd) > struct qedf_ctx *qedf = lport_priv(lport); > struct fc_rport *rport = starget_to_rport(scsi_target(sc_cmd->device)); > struct fc_rport_libfc_priv *rp = rport->dd_data; > - struct qedf_rport *fcport = rport->dd_data; > + struct qedf_rport *fcport; > struct qedf_ioreq *io_req; > int rc = 0; > int rval; > Acked-by: Chad Dupuis
Re: [PATCH V2 0/8] blk-mq/scsi-mq: support global tags & introduce force_blk_mq
On 2/5/18 8:20 AM, Ming Lei wrote: > Hi All, > > This patchset supports global tags which was started by Hannes originally: > > https://marc.info/?l=linux-block&m=149132580511346&w=2 > > Also inroduce 'force_blk_mq' and 'host_tagset' to 'struct scsi_host_template', > so that driver can avoid to support two IO paths(legacy and blk-mq), > especially > recent discusion mentioned that SCSI_MQ will be enabled at default soon. > > https://marc.info/?l=linux-scsi&m=151727684915589&w=2 > > With the above changes, it should be easier to convert SCSI drivers' > reply queue into blk-mq's hctx, then the automatic irq affinity issue can > be solved easily, please see detailed descrption in commit log and the > 8th patch for converting HPSA. > > Also drivers may require to complete request on the submission CPU > for avoiding hard/soft deadlock, which can be done easily with blk_mq > too. > > https://marc.info/?t=15160185141&r=1&w=2 > > The 6th patch uses the introduced 'force_blk_mq' to fix virtio_scsi > so that IO hang issue can be avoided inside legacy IO path, this issue is > a bit generic, at least HPSA/virtio-scsi are found broken with v4.15+. > > The 7th & 8th patch fixes HPSA's IO issue which is caused by the reply > queue selection algorithem. > > Laurence has verified that this patch makes HPSA working with the linus > tree with this patchset. Do you have any performance numbers for this patchset? I'd be curious to know how big the hit is. -- Jens Axboe
Re: [PATCH V2 2/8] blk-mq: introduce BLK_MQ_F_GLOBAL_TAGS
On 2/5/18 8:20 AM, Ming Lei wrote: > Quite a few HBAs(such as HPSA, megaraid, mpt3sas, ..) support multiple > reply queues, but tags is often HBA wide. > > These HBAs have switched to use pci_alloc_irq_vectors(PCI_IRQ_AFFINITY) > for automatic affinity assignment. > > Now 84676c1f21e8ff5(genirq/affinity: assign vectors to all possible CPUs) > has been merged to V4.16-rc, and it is easy to allocate all offline CPUs > for some irq vectors, this can't be avoided even though the allocation > is improved. > > So all these drivers have to avoid to ask HBA to complete request in > reply queue which hasn't online CPUs assigned, and HPSA has been broken > with v4.15+: > > https://marc.info/?l=linux-kernel&m=151748144730409&w=2 > > This issue can be solved generically and easily via blk_mq(scsi_mq) multiple > hw queue by mapping each reply queue into hctx, but one tricky thing is > the HBA wide(instead of hw queue wide) tags. > > This patch is based on the following Hannes's patch: > > https://marc.info/?l=linux-block&m=149132580511346&w=2 > > One big difference with Hannes's is that this patch only makes the tags > sbitmap > and active_queues data structure HBA wide, and others are kept as NUMA > locality, > such as request, hctx, tags, ... > > The following patch will support global tags on null_blk, also the performance > data is provided, no obvious performance loss is observed when the whole > hw queue depth is same. GLOBAL implies that it's, strangely enough, global. That isn't really the case. Why not call this BLK_MQ_F_HOST_TAGS or something like that? I'd welcome better names, but global doesn't seem to be a great choice. BLK_MQ_F_SET_TAGS? -- Jens Axboe
Re: [PATCH 0/3] scsi: aacraid: Multi controller Kdump IOP reset handling
Raghava, > During Kdump aacraid controller IOP reset is invoked, IOP reset > takes approx 40 seconds to bring the controller back up and running. > with timeout of 120 seconds and anything more than 2 controllers > will cause kdump to timeout. > > This patchset implements a new reset mechanism called DropIO, that > induces the fw to drop any pending IO in the fw and making the reset > process quicker. This series doesn't apply to my impending 4.17/scsi-queue. Since the latter won't exist until Linus releases rc1, please respin against current linus/master and resubmit. Thanks! -- Martin K. Petersen Oracle Linux Engineering
Re: [PATCH v3 00/19] lpfc updates for 11.4.0.7
James, > This patch set provides a number of fixes for the driver. Applied to my 4.17/scsi-queue staging tree. Thanks! -- Martin K. Petersen Oracle Linux Engineering
Re: [PATCH 04/13] lpfc: Add push-to-adapter support to sli4
James, > New if_type=6 adapters support and additional BAR that provides s/and/an/ -- Martin K. Petersen Oracle Linux Engineering
Re: [PATCH 01/13] lpfc: Rework lpfc to allow different sli4 cq and eq handlers
James, I was on the verge of applying this as well but saw that you intended a re-spin. Found a few typos while poring over these patches: > Prepare the code for new hardwre by creating a sli4-based callout hardware > table that can be set based on if_type. -- Martin K. Petersen Oracle Linux Engineering
Re: [PATCH 07/13] lpfc: Add if_type=6 support for cycling valid bits
James, > in accessng the EQ/CQ elements is eliminated. accessing -- Martin K. Petersen Oracle Linux Engineering
Re: [PATCH 1/6] qla2xxx: Fix a locking imbalance in qlt_24xx_handle_els()
Bart, > Ensure that upon return the tgt->ha->tgt.sess_lock spin lock is > unlocked no matter which code path is taken through this function. > This was detected by sparse. Applied to 4.16/scsi-fixes. Thanks! -- Martin K. Petersen Oracle Linux Engineering
Re: [PATCH 1/1] scsi: storvsc: Spread interrupts when picking a channel for I/O requests
Michael, > Update the algorithm in storvsc_do_io to look for a channel starting > with the current CPU + 1 and wrap around (within the current NUMA > node). This spreads VMbus interrupts more evenly across CPUs. Previous > code always started with first CPU in the current NUMA node, skewing > the interrupt load to that CPU. Applied to 4.16/scsi-fixes. Thanks! -- Martin K. Petersen Oracle Linux Engineering
Re: [PATCH 1/1] scsi: storvsc: Increase cmd_per_lun for higher speed devices
Michael, > Increase cmd_per_lun to allow more I/Os in progress per device, > particularly for NVMe's. The Hyper-V host side can handle the higher > count with no issues. Applied to 4.16/scsi-fixes. Thank you! -- Martin K. Petersen Oracle Linux Engineering
Re: [PATCH 0/2] qla2xxx: Bug fixes for driver
Himanshu, > Patch#1 is the issue reported by Max using KASAN tool. > Patch#2 fixes use of wrong queue handle for abort IOCB. Applied to 4.16/scsi-fixes, thank you! -- Martin K. Petersen Oracle Linux Engineering
Re: [PATCH V2 2/8] blk-mq: introduce BLK_MQ_F_GLOBAL_TAGS
On Tue, Feb 06, 2018 at 04:18:20PM -0700, Jens Axboe wrote: > On 2/5/18 8:20 AM, Ming Lei wrote: ... > > GLOBAL implies that it's, strangely enough, global. That isn't really the > case. Why not call this BLK_MQ_F_HOST_TAGS or something like that? I'd > welcome better names, but global doesn't seem to be a great choice. > > BLK_MQ_F_SET_TAGS? Good point, I am fine with either BLK_MQ_F_HOST_TAGS or BLK_MQ_F_SET_TAGS, will update in V3. Thanks, Ming
Re: [PATCH V2 2/8] blk-mq: introduce BLK_MQ_F_GLOBAL_TAGS
On Tue, Feb 06, 2018 at 12:33:36PM -0800, Omar Sandoval wrote: > On Mon, Feb 05, 2018 at 11:20:29PM +0800, Ming Lei wrote: .. > > > > + /* need to restart all hw queues for global tags */ > > + if (hctx->flags & BLK_MQ_F_GLOBAL_TAGS) { > > + struct blk_mq_hw_ctx *hctx2; > > + int i; > > + > > + queue_for_each_hw_ctx(hctx->queue, hctx2, i) > > + if (blk_mq_run_hw_queue(hctx2, true)) > > + return true; > > Is it intentional that we stop after the first hw queue does work? That > seems fine but it's a little confusing because the comment claims we > restart everything. Good catch, will update comment in V3. Thanks, Ming
Re: [PATCH V2 5/8] scsi: introduce force_blk_mq
On Tue, Feb 06, 2018 at 12:20:43PM -0800, Omar Sandoval wrote: > On Mon, Feb 05, 2018 at 11:20:32PM +0800, Ming Lei wrote: ... > > shost->use_blk_mq = scsi_use_blk_mq; > > Not sure if this is a patch formatting issue, but this old line wasn't > deleted. Good catch, the old line need to be removed. Thanks, Ming
Re: [PATCH 0/6] Six qla2xxx and qla4xxx patches
Bart, > The patches in this series are what I came up with after having > analyzed the source code of the qla[24]xxx drivers with several source > code analysis tools (scripts/kernel-doc, gcc, sparse and smatch). None > of the patches in this series have been tested. Yet I'm asking you to > consider at least the first patch of this series for kernel v4.16 > because it fixes a locking bug in one of the SCSI patches queued for > kernel v4.16. Applied to my staging tree for 4.17/scsi-queue. Thanks! -- Martin K. Petersen Oracle Linux Engineering
Re: [PATCHv3 0/4] Deprecate DAC960 driver
Hannes, > as we're trying to get rid of the remaining request_fn drivers here's > a patchset to move the DAC960 driver to the SCSI stack. As per > request from hch I've split up the driver into two new SCSI drivers > called 'myrb' and 'myrs'. > > The 'myrb' driver only supports the earlier (V1) firmware interface, > which doesn't have a SCSI interface for the logical drives; for those > I've added a (pretty rudimentary, admittedly) SCSI translation for > them. > > The 'myrs' driver supports the newer (V2) firmware interface, which is > SCSI based and doesn't need the translation layer. > > And the weird proc interface from DAC960 has been converted to sysfs > attributes. Thanks for doing this. I merged these into 4.17/scsi-queue. -- Martin K. Petersen Oracle Linux Engineering
Re: [PATCH] scsi_debug: Simplify request tag decoding
Bart, > Since commit 64d513ac31bd ("scsi: use host wide tags by default") all > SCSI requests have a tag, whether or not scsi-mq is enabled. > Additionally, it is safe to use blk_mq_unique_tag() and > blk_mq_unique_tag_to_hwq() for legacy SCSI queues. Since this means > that the sdebug_mq_active variable is superfluous, remove it. Applied to 4.17/scsi-queue. Thanks! -- Martin K. Petersen Oracle Linux Engineering
Re: [PATCH] scsi_debug: Add two new parameters to scsi_debug driver
Laurence, The patch description needs to go before the "---" separator. I fixed it up. -- Martin K. Petersen Oracle Linux Engineering
Re: [PATCH] scsi: libfc: remove redundant initialization of 'disc'
Colin, > Pointer disc is being intializated a value that is never read and then > re-assigned the same value later on, hence the initialization is redundant > and can be removed. Applied to 4.17/scsi-queue. -- Martin K. Petersen Oracle Linux Engineering
Re: [PATCH 5/6] scsi: qedi: fix building with LTO
Arnd, > When link-time optimizations are enabled, qedi fails to build because > of mismatched prototypes: Applied to 4.17/scsi-queue. Thanks! -- Martin K. Petersen Oracle Linux Engineering
Re: [PATCH] scsi: qedf: remove redundant initialization of 'fcport'
Colin, > Pointer fcport is initialized with a value that is never read, it is > re-assigned a new value later on, hence the initialization is redundant > and can be removed. Applied to 4.17/scsi-queue. Thanks! -- Martin K. Petersen Oracle Linux Engineering
Re: [PATCH 01/13] lpfc: Rework lpfc to allow different sli4 cq and eq handlers
On 2/6/2018 4:26 PM, Martin K. Petersen wrote: James, I was on the verge of applying this as well but saw that you intended a re-spin. Found a few typos while poring over these patches: Prepare the code for new hardwre by creating a sli4-based callout hardware table that can be set based on if_type. ok - I'll correct what's been pointed out and repost. Thanks -- james
[PATCH v2 07/13] lpfc: Add if_type=6 support for cycling valid bits
Traditional SLI4 required the driver to clear Valid bits on EQEs and CQEs after consuming them. The new if_type=6 hardware will cycle the value for what is valid on each queue itteration. The driver no longer has to touch the valid bits. This also means all the cpu cache dirtying and perhaps flush/refill's done by the hardware in accessing the EQ/CQ elements is eliminated. Signed-off-by: Dick Kennedy Signed-off-by: James Smart --- drivers/scsi/lpfc/lpfc_hw4.h | 18 -- drivers/scsi/lpfc/lpfc_init.c | 11 +++ drivers/scsi/lpfc/lpfc_sli.c | 77 +++ drivers/scsi/lpfc/lpfc_sli4.h | 3 ++ 4 files changed, 92 insertions(+), 17 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_hw4.h b/drivers/scsi/lpfc/lpfc_hw4.h index 0c33510fe75c..dba724e1f5ee 100644 --- a/drivers/scsi/lpfc/lpfc_hw4.h +++ b/drivers/scsi/lpfc/lpfc_hw4.h @@ -1040,6 +1040,9 @@ struct eq_context { #define lpfc_eq_context_valid_SHIFT29 #define lpfc_eq_context_valid_MASK 0x0001 #define lpfc_eq_context_valid_WORD word0 +#define lpfc_eq_context_autovalid_SHIFT 28 +#define lpfc_eq_context_autovalid_MASK 0x0001 +#define lpfc_eq_context_autovalid_WORD word0 uint32_t word1; #define lpfc_eq_context_count_SHIFT26 #define lpfc_eq_context_count_MASK 0x0003 @@ -1173,6 +1176,9 @@ struct cq_context { #define LPFC_CQ_CNT_5120x1 #define LPFC_CQ_CNT_1024 0x2 #define LPFC_CQ_CNT_WORD7 0x3 +#define lpfc_cq_context_autovalid_SHIFT 15 +#define lpfc_cq_context_autovalid_MASK 0x0001 +#define lpfc_cq_context_autovalid_WORD word0 uint32_t word1; #define lpfc_cq_eq_id_SHIFT22 /* Version 0 Only */ #define lpfc_cq_eq_id_MASK 0x00FF @@ -1231,9 +1237,9 @@ struct lpfc_mbx_cq_create_set { #define lpfc_mbx_cq_create_set_cqe_size_SHIFT 25 #define lpfc_mbx_cq_create_set_cqe_size_MASK 0x0003 #define lpfc_mbx_cq_create_set_cqe_size_WORD word1 -#define lpfc_mbx_cq_create_set_auto_SHIFT 15 -#define lpfc_mbx_cq_create_set_auto_MASK 0x001 -#define lpfc_mbx_cq_create_set_auto_WORD word1 +#define lpfc_mbx_cq_create_set_autovalid_SHIFT 15 +#define lpfc_mbx_cq_create_set_autovalid_MASK 0x001 +#define lpfc_mbx_cq_create_set_autovalid_WORD word1 #define lpfc_mbx_cq_create_set_nodelay_SHIFT 14 #define lpfc_mbx_cq_create_set_nodelay_MASK0x0001 #define lpfc_mbx_cq_create_set_nodelay_WORDword1 @@ -3288,6 +3294,9 @@ struct lpfc_sli4_parameters { #define cfg_sli_hint_2_MASK0x001f #define cfg_sli_hint_2_WORDword1 uint32_t word2; +#define cfg_eqav_SHIFT 31 +#define cfg_eqav_MASK 0x0001 +#define cfg_eqav_WORD word2 uint32_t word3; uint32_t word4; #define cfg_cqv_SHIFT 14 @@ -3296,6 +3305,9 @@ struct lpfc_sli4_parameters { #define cfg_cqpsize_SHIFT 16 #define cfg_cqpsize_MASK 0x00ff #define cfg_cqpsize_WORD word4 +#define cfg_cqav_SHIFT 31 +#define cfg_cqav_MASK 0x0001 +#define cfg_cqav_WORD word4 uint32_t word5; uint32_t word6; #define cfg_mqv_SHIFT 14 diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index c1d7436cca4a..65057e33b8b7 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c @@ -8060,6 +8060,7 @@ lpfc_alloc_nvme_wq_cq(struct lpfc_hba *phba, int wqidx) wqidx); return 1; } + qdesc->qe_valid = 1; phba->sli4_hba.nvme_cq[wqidx] = qdesc; qdesc = lpfc_sli4_queue_alloc(phba, LPFC_EXPANDED_PAGE_SIZE, @@ -8097,6 +8098,7 @@ lpfc_alloc_fcp_wq_cq(struct lpfc_hba *phba, int wqidx) "0499 Failed allocate fast-path FCP CQ (%d)\n", wqidx); return 1; } + qdesc->qe_valid = 1; phba->sli4_hba.fcp_cq[wqidx] = qdesc; /* Create Fast Path FCP WQs */ @@ -8290,6 +8292,7 @@ lpfc_sli4_queue_create(struct lpfc_hba *phba) "0497 Failed allocate EQ (%d)\n", idx); goto out_error; } + qdesc->qe_valid = 1; phba->sli4_hba.hba_eq[idx] = qdesc; } @@ -8315,6 +8318,7 @@ lpfc_sli4_queue_create(struct lpfc_hba *phba) "CQ Set (%d)\n", idx); goto out_error; } + qdesc->qe_valid = 1; phba->sli4_hba.nvmet_cqset[idx] = qdesc; } } @@ -8332,6 +8336,7 @@ lpfc_sli4_queue_create(struct lpfc_hba *phba) "0500 Failed allocate slow-path mailbox
[PATCH v2 10/13] lpfc: Fix nvme embedded io length on new hardware
Newer hardware more strictly enforces buffer lenghts, causing an mis-set value to be identified. Older hardware won't catch it. The difference is benign on old hardware. Set the right embedded buffer length for nvme ios. Signed-off-by: Dick Kennedy Signed-off-by: James Smart --- drivers/scsi/lpfc/lpfc_nvme.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/lpfc/lpfc_nvme.c b/drivers/scsi/lpfc/lpfc_nvme.c index 5a1a6e24a27f..c75958daf799 100644 --- a/drivers/scsi/lpfc/lpfc_nvme.c +++ b/drivers/scsi/lpfc/lpfc_nvme.c @@ -655,7 +655,7 @@ lpfc_nvme_adj_fcp_sgls(struct lpfc_vport *vport, /* Word 0-2 - NVME CMND IU (embedded payload) */ wqe->generic.bde.tus.f.bdeFlags = BUFF_TYPE_BDE_IMMED; - wqe->generic.bde.tus.f.bdeSize = 60; + wqe->generic.bde.tus.f.bdeSize = 56; wqe->generic.bde.addrHigh = 0; wqe->generic.bde.addrLow = 64; /* Word 16 */ -- 2.13.1
[PATCH v2 01/13] lpfc: Rework lpfc to allow different sli4 cq and eq handlers
Up until now, an SLI-4 device had no variance in the way it handled its EQs and CQs. With newer hardware, there are now differences in doorbells and some differences in how entries are valid. Prepare the code for new hardware by creating a sli4-based callout table that can be set based on if_type. Signed-off-by: Dick Kennedy Signed-off-by: James Smart --- drivers/scsi/lpfc/lpfc_init.c | 7 + drivers/scsi/lpfc/lpfc_sli.c | 63 ++- drivers/scsi/lpfc/lpfc_sli4.h | 5 3 files changed, 44 insertions(+), 31 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index 465d890220d5..e24dca2b3f2f 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c @@ -9540,6 +9540,13 @@ lpfc_sli4_pci_mem_setup(struct lpfc_hba *phba) } } + /* Set up the EQ/CQ register handeling functions now */ + if (if_type <= LPFC_SLI_INTF_IF_TYPE_2) { + phba->sli4_hba.sli4_eq_clr_intr = lpfc_sli4_eq_clr_intr; + phba->sli4_hba.sli4_eq_release = lpfc_sli4_eq_release; + phba->sli4_hba.sli4_cq_release = lpfc_sli4_cq_release; + } + return 0; out_iounmap_all: diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index e97d080e9f65..f91caae6489a 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c @@ -299,7 +299,7 @@ lpfc_sli4_eq_get(struct lpfc_queue *q) * @q: The Event Queue to disable interrupts * **/ -static inline void +inline void lpfc_sli4_eq_clr_intr(struct lpfc_queue *q) { struct lpfc_register doorbell; @@ -5302,41 +5302,42 @@ static void lpfc_sli4_arm_cqeq_intr(struct lpfc_hba *phba) { int qidx; + struct lpfc_sli4_hba *sli4_hba = &phba->sli4_hba; - lpfc_sli4_cq_release(phba->sli4_hba.mbx_cq, LPFC_QUEUE_REARM); - lpfc_sli4_cq_release(phba->sli4_hba.els_cq, LPFC_QUEUE_REARM); - if (phba->sli4_hba.nvmels_cq) - lpfc_sli4_cq_release(phba->sli4_hba.nvmels_cq, + sli4_hba->sli4_cq_release(sli4_hba->mbx_cq, LPFC_QUEUE_REARM); + sli4_hba->sli4_cq_release(sli4_hba->els_cq, LPFC_QUEUE_REARM); + if (sli4_hba->nvmels_cq) + sli4_hba->sli4_cq_release(sli4_hba->nvmels_cq, LPFC_QUEUE_REARM); - if (phba->sli4_hba.fcp_cq) + if (sli4_hba->fcp_cq) for (qidx = 0; qidx < phba->cfg_fcp_io_channel; qidx++) - lpfc_sli4_cq_release(phba->sli4_hba.fcp_cq[qidx], + sli4_hba->sli4_cq_release(sli4_hba->fcp_cq[qidx], LPFC_QUEUE_REARM); - if (phba->sli4_hba.nvme_cq) + if (sli4_hba->nvme_cq) for (qidx = 0; qidx < phba->cfg_nvme_io_channel; qidx++) - lpfc_sli4_cq_release(phba->sli4_hba.nvme_cq[qidx], + sli4_hba->sli4_cq_release(sli4_hba->nvme_cq[qidx], LPFC_QUEUE_REARM); if (phba->cfg_fof) - lpfc_sli4_cq_release(phba->sli4_hba.oas_cq, LPFC_QUEUE_REARM); + sli4_hba->sli4_cq_release(sli4_hba->oas_cq, LPFC_QUEUE_REARM); - if (phba->sli4_hba.hba_eq) + if (sli4_hba->hba_eq) for (qidx = 0; qidx < phba->io_channel_irqs; qidx++) - lpfc_sli4_eq_release(phba->sli4_hba.hba_eq[qidx], - LPFC_QUEUE_REARM); + sli4_hba->sli4_eq_release(sli4_hba->hba_eq[qidx], + LPFC_QUEUE_REARM); if (phba->nvmet_support) { for (qidx = 0; qidx < phba->cfg_nvmet_mrq; qidx++) { - lpfc_sli4_cq_release( - phba->sli4_hba.nvmet_cqset[qidx], + sli4_hba->sli4_cq_release( + sli4_hba->nvmet_cqset[qidx], LPFC_QUEUE_REARM); } } if (phba->cfg_fof) - lpfc_sli4_eq_release(phba->sli4_hba.fof_eq, LPFC_QUEUE_REARM); + sli4_hba->sli4_eq_release(sli4_hba->fof_eq, LPFC_QUEUE_REARM); } /** @@ -7270,7 +7271,7 @@ lpfc_sli4_mbox_completions_pending(struct lpfc_hba *phba) bool lpfc_sli4_process_missed_mbox_completions(struct lpfc_hba *phba) { - + struct lpfc_sli4_hba *sli4_hba = &phba->sli4_hba; uint32_t eqidx; struct lpfc_queue *fpeq = NULL; struct lpfc_eqe *eqe; @@ -7281,11 +7282,11 @@ lpfc_sli4_process_missed_mbox_completions(struct lpfc_hba *phba) /* Find the eq associated with the mcq */ - if (phba->sli4_hba.hba_eq) + if (sli4_hba->hba_eq) for (eqidx = 0; eqidx < phba->io_channel_irqs; eqidx++) - if (phba->sli4_hba.hba_eq[eqidx]->queue_id == - phba
[PATCH v2 13/13] lpfc: Update 12.0.0.0 modified files for 2018 Copyright
Updated Copyright in files updated 12.0.0.0 Signed-off-by: Dick Kennedy Signed-off-by: James Smart --- drivers/scsi/lpfc/lpfc_bsg.c | 2 +- drivers/scsi/lpfc/lpfc_ct.c | 2 +- drivers/scsi/lpfc/lpfc_debugfs.c | 2 +- drivers/scsi/lpfc/lpfc_debugfs.h | 2 +- drivers/scsi/lpfc/lpfc_hw.h | 2 +- drivers/scsi/lpfc/lpfc_ids.h | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_bsg.c b/drivers/scsi/lpfc/lpfc_bsg.c index 8b33b652226b..0f174ca80f67 100644 --- a/drivers/scsi/lpfc/lpfc_bsg.c +++ b/drivers/scsi/lpfc/lpfc_bsg.c @@ -1,7 +1,7 @@ /*** * This file is part of the Emulex Linux Device Driver for * * Fibre Channel Host Bus Adapters.* - * Copyright (C) 2017 Broadcom. All Rights Reserved. The term * + * Copyright (C) 2017-2018 Broadcom. All Rights Reserved. The term * * “Broadcom” refers to Broadcom Limited and/or its subsidiaries. * * Copyright (C) 2009-2015 Emulex. All rights reserved. * * EMULEX and SLI are trademarks of Emulex.* diff --git a/drivers/scsi/lpfc/lpfc_ct.c b/drivers/scsi/lpfc/lpfc_ct.c index 03a7e13a049d..ebe8ac1b88e7 100644 --- a/drivers/scsi/lpfc/lpfc_ct.c +++ b/drivers/scsi/lpfc/lpfc_ct.c @@ -1,7 +1,7 @@ /*** * This file is part of the Emulex Linux Device Driver for * * Fibre Channel Host Bus Adapters.* - * Copyright (C) 2017 Broadcom. All Rights Reserved. The term * + * Copyright (C) 2017-2018 Broadcom. All Rights Reserved. The term * * “Broadcom” refers to Broadcom Limited and/or its subsidiaries. * * Copyright (C) 2004-2016 Emulex. All rights reserved. * * EMULEX and SLI are trademarks of Emulex.* diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c index 308303d501cf..fb0dc2aeed91 100644 --- a/drivers/scsi/lpfc/lpfc_debugfs.c +++ b/drivers/scsi/lpfc/lpfc_debugfs.c @@ -1,7 +1,7 @@ /*** * This file is part of the Emulex Linux Device Driver for * * Fibre Channel Host Bus Adapters.* - * Copyright (C) 2017 Broadcom. All Rights Reserved. The term * + * Copyright (C) 2017-2018 Broadcom. All Rights Reserved. The term * * “Broadcom” refers to Broadcom Limited and/or its subsidiaries. * * Copyright (C) 2007-2015 Emulex. All rights reserved. * * EMULEX and SLI are trademarks of Emulex.* diff --git a/drivers/scsi/lpfc/lpfc_debugfs.h b/drivers/scsi/lpfc/lpfc_debugfs.h index 12fbf498a7ce..f32eaeb2225a 100644 --- a/drivers/scsi/lpfc/lpfc_debugfs.h +++ b/drivers/scsi/lpfc/lpfc_debugfs.h @@ -1,7 +1,7 @@ /*** * This file is part of the Emulex Linux Device Driver for * * Fibre Channel Host Bus Adapters.* - * Copyright (C) 2017 Broadcom. All Rights Reserved. The term * + * Copyright (C) 2017-2018 Broadcom. All Rights Reserved. The term * * “Broadcom” refers to Broadcom Limited and/or its subsidiaries. * * Copyright (C) 2007-2011 Emulex. All rights reserved. * * EMULEX and SLI are trademarks of Emulex.* diff --git a/drivers/scsi/lpfc/lpfc_hw.h b/drivers/scsi/lpfc/lpfc_hw.h index cf83322cd4fe..08a3f1520159 100644 --- a/drivers/scsi/lpfc/lpfc_hw.h +++ b/drivers/scsi/lpfc/lpfc_hw.h @@ -1,7 +1,7 @@ /*** * This file is part of the Emulex Linux Device Driver for * * Fibre Channel Host Bus Adapters.* - * Copyright (C) 2017 Broadcom. All Rights Reserved. The term * + * Copyright (C) 2017-2018 Broadcom. All Rights Reserved. The term * * “Broadcom” refers to Broadcom Limited and/or its subsidiaries. * * Copyright (C) 2004-2016 Emulex. All rights reserved. * * EMULEX and SLI are trademarks of Emulex.* diff --git a/drivers/scsi/lpfc/lpfc_ids.h b/drivers/scsi/lpfc/lpfc_ids.h index 329c8d28869c..07ee34017d88 100644 --- a/drivers/scsi/lpfc/lpfc_ids.h +++ b/drivers/scsi/lpfc/lpfc_ids.h @@ -1,7 +1,7 @@ /*** * This file is part of the Emulex Linux Device Driver for * * Fibre Channel Host Bus Adapters.* - * Copyright (C) 2017 Broadcom. All Rights Reserved. The term * + * Copyright (C) 2017-2018 Broadcom. All Rights Reserved. The term * * “Broadcom” refers to Broadcom Limited and/or its subsidiaries. * * Copyright (C) 2004-2016 Emulex. All rights reserved. * * EMULEX and SLI are trademarks of Emulex.* -- 2.13.1
[PATCH v2 05/13] lpfc: Add PCI Ids for if_type=6 hardware
Add PCI ids for the new G7 adapter Signed-off-by: Dick Kennedy Signed-off-by: James Smart --- drivers/scsi/lpfc/lpfc_hw.h | 1 + drivers/scsi/lpfc/lpfc_ids.h | 2 ++ 2 files changed, 3 insertions(+) diff --git a/drivers/scsi/lpfc/lpfc_hw.h b/drivers/scsi/lpfc/lpfc_hw.h index bdc1f184f67a..d07d2fcbea34 100644 --- a/drivers/scsi/lpfc/lpfc_hw.h +++ b/drivers/scsi/lpfc/lpfc_hw.h @@ -1580,6 +1580,7 @@ struct lpfc_fdmi_reg_portattr { #define PCI_DEVICE_ID_LANCER_FCOE 0xe260 #define PCI_DEVICE_ID_LANCER_FCOE_VF 0xe268 #define PCI_DEVICE_ID_LANCER_G6_FC 0xe300 +#define PCI_DEVICE_ID_LANCER_G7_FC 0xf400 #define PCI_DEVICE_ID_SAT_SMB 0xf011 #define PCI_DEVICE_ID_SAT_MID 0xf015 #define PCI_DEVICE_ID_RFLY 0xf095 diff --git a/drivers/scsi/lpfc/lpfc_ids.h b/drivers/scsi/lpfc/lpfc_ids.h index 0ba3733eb36d..329c8d28869c 100644 --- a/drivers/scsi/lpfc/lpfc_ids.h +++ b/drivers/scsi/lpfc/lpfc_ids.h @@ -116,6 +116,8 @@ const struct pci_device_id lpfc_id_table[] = { PCI_ANY_ID, PCI_ANY_ID, }, {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_LANCER_G6_FC, PCI_ANY_ID, PCI_ANY_ID, }, + {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_LANCER_G7_FC, + PCI_ANY_ID, PCI_ANY_ID, }, {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_SKYHAWK, PCI_ANY_ID, PCI_ANY_ID, }, {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_SKYHAWK_VF, -- 2.13.1
[PATCH v2 00/13] lpfc new hardware patches for 12.0.0.0
This patch set adds support for Broadcom's new G7 product that supports G4G FC. The patches were cut against the Martin's 4.16/scsi-queue tree. The patches are dependent (layered on top of) the lpfc 11.4.0.7 patchset that was recently posted. See: https://www.spinics.net/lists/linux-scsi/msg116956.html v2: Address comments: patch 1, 2, 4, 7 - patch description typos patch 6 - typo on 256GBit speed define James Smart (13): lpfc: Rework lpfc to allow different sli4 cq and eq handlers lpfc: Rework sli4 doorbell infrastructure lpfc: Add SLI-4 if_type=6 support to the code base lpfc: Add push-to-adapter support to sli4 lpfc: Add PCI Ids for if_type=6 hardware lpfc: Add 64G link speed support lpfc: Add if_type=6 support for cycling valid bits lpfc: Enable fw download on if_type=6 devices lpfc: Add embedded data pointers for enhanced performance lpfc: Fix nvme embedded io length on new hardware lpfc: Work around NVME cmd iu SGL type lpfc: update driver version to 12.0.0.0 lpfc: Update 12.0.0.0 modified files for 2018 Copyright drivers/scsi/lpfc/lpfc.h | 20 +- drivers/scsi/lpfc/lpfc_attr.c| 85 +-- drivers/scsi/lpfc/lpfc_bsg.c | 6 +- drivers/scsi/lpfc/lpfc_ct.c | 7 +- drivers/scsi/lpfc/lpfc_debugfs.c | 22 +- drivers/scsi/lpfc/lpfc_debugfs.h | 13 +- drivers/scsi/lpfc/lpfc_els.c | 5 + drivers/scsi/lpfc/lpfc_hbadisc.c | 1 + drivers/scsi/lpfc/lpfc_hw.h | 15 +- drivers/scsi/lpfc/lpfc_hw4.h | 115 - drivers/scsi/lpfc/lpfc_ids.h | 4 +- drivers/scsi/lpfc/lpfc_init.c| 245 +++--- drivers/scsi/lpfc/lpfc_mbox.c| 4 + drivers/scsi/lpfc/lpfc_nvme.c| 69 +++-- drivers/scsi/lpfc/lpfc_nvmet.c | 24 ++ drivers/scsi/lpfc/lpfc_scsi.c| 8 +- drivers/scsi/lpfc/lpfc_sli.c | 535 +-- drivers/scsi/lpfc/lpfc_sli4.h| 30 ++- drivers/scsi/lpfc/lpfc_version.h | 2 +- 19 files changed, 960 insertions(+), 250 deletions(-) -- 2.13.1
[PATCH v2 06/13] lpfc: Add 64G link speed support
The G7 adapter supports 64G link speeds. Add support to the driver. In addition, a small cleanup to replace the odd bitmap logic with a switch case. Signed-off-by: Dick Kennedy Signed-off-by: James Smart --- v2: address review comment of typo in define name. Define wasn't used anywhere yet. --- drivers/scsi/lpfc/lpfc.h | 14 +++-- drivers/scsi/lpfc/lpfc_attr.c| 61 drivers/scsi/lpfc/lpfc_ct.c | 5 drivers/scsi/lpfc/lpfc_els.c | 5 drivers/scsi/lpfc/lpfc_hbadisc.c | 1 + drivers/scsi/lpfc/lpfc_hw.h | 12 drivers/scsi/lpfc/lpfc_hw4.h | 3 ++ drivers/scsi/lpfc/lpfc_init.c| 17 +-- drivers/scsi/lpfc/lpfc_mbox.c| 4 +++ 9 files changed, 92 insertions(+), 30 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h index 86ffb9756e65..7aad4a717f13 100644 --- a/drivers/scsi/lpfc/lpfc.h +++ b/drivers/scsi/lpfc/lpfc.h @@ -544,16 +544,10 @@ struct unsol_rcv_ct_ctx { #define LPFC_USER_LINK_SPEED_10G 10 /* 10 Gigabaud */ #define LPFC_USER_LINK_SPEED_16G 16 /* 16 Gigabaud */ #define LPFC_USER_LINK_SPEED_32G 32 /* 32 Gigabaud */ -#define LPFC_USER_LINK_SPEED_MAX LPFC_USER_LINK_SPEED_32G -#define LPFC_USER_LINK_SPEED_BITMAP ((1ULL << LPFC_USER_LINK_SPEED_32G) | \ -(1 << LPFC_USER_LINK_SPEED_16G) | \ -(1 << LPFC_USER_LINK_SPEED_10G) | \ -(1 << LPFC_USER_LINK_SPEED_8G) | \ -(1 << LPFC_USER_LINK_SPEED_4G) | \ -(1 << LPFC_USER_LINK_SPEED_2G) | \ -(1 << LPFC_USER_LINK_SPEED_1G) | \ -(1 << LPFC_USER_LINK_SPEED_AUTO)) -#define LPFC_LINK_SPEED_STRING "0, 1, 2, 4, 8, 10, 16, 32" +#define LPFC_USER_LINK_SPEED_64G 64 /* 64 Gigabaud */ +#define LPFC_USER_LINK_SPEED_MAX LPFC_USER_LINK_SPEED_64G + +#define LPFC_LINK_SPEED_STRING "0, 1, 2, 4, 8, 10, 16, 32, 64" enum nemb_type { nemb_mse = 1, diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c index 705c42e724c2..ec080de4e7a7 100644 --- a/drivers/scsi/lpfc/lpfc_attr.c +++ b/drivers/scsi/lpfc/lpfc_attr.c @@ -4126,23 +4126,32 @@ lpfc_link_speed_store(struct device *dev, struct device_attribute *attr, ((val == LPFC_USER_LINK_SPEED_8G) && !(phba->lmt & LMT_8Gb)) || ((val == LPFC_USER_LINK_SPEED_10G) && !(phba->lmt & LMT_10Gb)) || ((val == LPFC_USER_LINK_SPEED_16G) && !(phba->lmt & LMT_16Gb)) || - ((val == LPFC_USER_LINK_SPEED_32G) && !(phba->lmt & LMT_32Gb))) { + ((val == LPFC_USER_LINK_SPEED_32G) && !(phba->lmt & LMT_32Gb)) || + ((val == LPFC_USER_LINK_SPEED_64G) && !(phba->lmt & LMT_64Gb))) { lpfc_printf_log(phba, KERN_ERR, LOG_INIT, "2879 lpfc_link_speed attribute cannot be set " "to %d. Speed is not supported by this port.\n", val); return -EINVAL; } - if (val == LPFC_USER_LINK_SPEED_16G && -phba->fc_topology == LPFC_TOPOLOGY_LOOP) { + if (val >= LPFC_USER_LINK_SPEED_16G && + phba->fc_topology == LPFC_TOPOLOGY_LOOP) { lpfc_printf_log(phba, KERN_ERR, LOG_INIT, "3112 lpfc_link_speed attribute cannot be set " "to %d. Speed is not supported in loop mode.\n", val); return -EINVAL; } - if ((val >= 0) && (val <= LPFC_USER_LINK_SPEED_MAX) && - (LPFC_USER_LINK_SPEED_BITMAP & (1 << val))) { + + switch (val) { + case LPFC_USER_LINK_SPEED_AUTO: + case LPFC_USER_LINK_SPEED_1G: + case LPFC_USER_LINK_SPEED_2G: + case LPFC_USER_LINK_SPEED_4G: + case LPFC_USER_LINK_SPEED_8G: + case LPFC_USER_LINK_SPEED_16G: + case LPFC_USER_LINK_SPEED_32G: + case LPFC_USER_LINK_SPEED_64G: prev_val = phba->cfg_link_speed; phba->cfg_link_speed = val; if (nolip) @@ -4152,13 +4161,17 @@ lpfc_link_speed_store(struct device *dev, struct device_attribute *attr, if (err) { phba->cfg_link_speed = prev_val; return -EINVAL; - } else - return strlen(buf); + } + return strlen(buf); + default: + break; } + lpfc_printf_log(phba, KERN_ERR, LOG_INIT, - "0469 lpfc_link_speed attribute cannot be set to %d, " - "allowed values are ["LPFC_LINK_SPEED_STRING"]\n", val); + "0469 lpfc_link_speed attribute cannot be set to %d, " + "allowed value
[PATCH v2 02/13] lpfc: Rework sli4 doorbell infrastructure
Up until now, all SLI-4 devices had the same doorbells at the same bar locations. With newer hardware, there are now independent EQ and CQ doorbells and the bar locations differ. Prepare the code for new hardware by separating the eq/cq doorbell into separate components. The components can be set based on if_type. Signed-off-by: Dick Kennedy Signed-off-by: James Smart --- drivers/scsi/lpfc/lpfc_debugfs.c | 20 ++-- drivers/scsi/lpfc/lpfc_debugfs.h | 11 ++- drivers/scsi/lpfc/lpfc_init.c| 9 ++--- drivers/scsi/lpfc/lpfc_sli.c | 8 drivers/scsi/lpfc/lpfc_sli4.h| 3 ++- 5 files changed, 32 insertions(+), 19 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c index 17ea3bb04266..308303d501cf 100644 --- a/drivers/scsi/lpfc/lpfc_debugfs.c +++ b/drivers/scsi/lpfc/lpfc_debugfs.c @@ -3944,10 +3944,15 @@ lpfc_idiag_drbacc_read_reg(struct lpfc_hba *phba, char *pbuffer, return 0; switch (drbregid) { - case LPFC_DRB_EQCQ: - len += snprintf(pbuffer+len, LPFC_DRB_ACC_BUF_SIZE-len, - "EQCQ-DRB-REG: 0x%08x\n", - readl(phba->sli4_hba.EQCQDBregaddr)); + case LPFC_DRB_EQ: + len += snprintf(pbuffer + len, LPFC_DRB_ACC_BUF_SIZE-len, + "EQ-DRB-REG: 0x%08x\n", + readl(phba->sli4_hba.EQDBregaddr)); + break; + case LPFC_DRB_CQ: + len += snprintf(pbuffer + len, LPFC_DRB_ACC_BUF_SIZE - len, + "CQ-DRB-REG: 0x%08x\n", + readl(phba->sli4_hba.CQDBregaddr)); break; case LPFC_DRB_MQ: len += snprintf(pbuffer+len, LPFC_DRB_ACC_BUF_SIZE-len, @@ -4086,8 +4091,11 @@ lpfc_idiag_drbacc_write(struct file *file, const char __user *buf, idiag.cmd.opcode == LPFC_IDIAG_CMD_DRBACC_ST || idiag.cmd.opcode == LPFC_IDIAG_CMD_DRBACC_CL) { switch (drb_reg_id) { - case LPFC_DRB_EQCQ: - drb_reg = phba->sli4_hba.EQCQDBregaddr; + case LPFC_DRB_EQ: + drb_reg = phba->sli4_hba.EQDBregaddr; + break; + case LPFC_DRB_CQ: + drb_reg = phba->sli4_hba.CQDBregaddr; break; case LPFC_DRB_MQ: drb_reg = phba->sli4_hba.MQDBregaddr; diff --git a/drivers/scsi/lpfc/lpfc_debugfs.h b/drivers/scsi/lpfc/lpfc_debugfs.h index c4edd87bfc65..12fbf498a7ce 100644 --- a/drivers/scsi/lpfc/lpfc_debugfs.h +++ b/drivers/scsi/lpfc/lpfc_debugfs.h @@ -126,12 +126,13 @@ #define LPFC_DRB_ACC_WR_CMD_ARG 2 #define LPFC_DRB_ACC_BUF_SIZE 256 -#define LPFC_DRB_EQCQ 1 -#define LPFC_DRB_MQ 2 -#define LPFC_DRB_WQ 3 -#define LPFC_DRB_RQ 4 +#define LPFC_DRB_EQ 1 +#define LPFC_DRB_CQ 2 +#define LPFC_DRB_MQ 3 +#define LPFC_DRB_WQ 4 +#define LPFC_DRB_RQ 5 -#define LPFC_DRB_MAX 4 +#define LPFC_DRB_MAX 5 #define IDIAG_DRBACC_REGID_INDX 0 #define IDIAG_DRBACC_VALUE_INDX 1 diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index e24dca2b3f2f..b2cf8eb99008 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c @@ -7430,8 +7430,9 @@ lpfc_sli4_bar0_register_memmap(struct lpfc_hba *phba, uint32_t if_type) phba->sli4_hba.WQDBregaddr = phba->sli4_hba.conf_regs_memmap_p + LPFC_ULP0_WQ_DOORBELL; - phba->sli4_hba.EQCQDBregaddr = + phba->sli4_hba.CQDBregaddr = phba->sli4_hba.conf_regs_memmap_p + LPFC_EQCQ_DOORBELL; + phba->sli4_hba.EQDBregaddr = phba->sli4_hba.CQDBregaddr; phba->sli4_hba.MQDBregaddr = phba->sli4_hba.conf_regs_memmap_p + LPFC_MQ_DOORBELL; phba->sli4_hba.BMBXregaddr = @@ -7488,8 +7489,10 @@ lpfc_sli4_bar2_register_memmap(struct lpfc_hba *phba, uint32_t vf) phba->sli4_hba.WQDBregaddr = (phba->sli4_hba.drbl_regs_memmap_p + vf * LPFC_VFR_PAGE_SIZE + LPFC_ULP0_WQ_DOORBELL); - phba->sli4_hba.EQCQDBregaddr = (phba->sli4_hba.drbl_regs_memmap_p + - vf * LPFC_VFR_PAGE_SIZE + LPFC_EQCQ_DOORBELL); + phba->sli4_hba.CQDBregaddr = (phba->sli4_hba.drbl_regs_memmap_p + + vf * LPFC_VFR_PAGE_SIZE + + LPFC_EQCQ_DOORBELL); + phba->sli4_hba.EQDBregaddr = phba->sli4_hba.CQDBregaddr; phba->sli4_hba.MQDBregaddr = (phba->sli4_hba.drbl_regs_memmap_p + vf * LPFC_VFR_PAGE_SIZE + LPFC_MQ_DOORBELL); phba->sli4_hba.BMBXregaddr = (phba->sli4_hba.drbl_regs_memmap_p + diff --git a
[PATCH v2 03/13] lpfc: Add SLI-4 if_type=6 support to the code base
New hardware supports a SLI-4 interface, but with a new if_type variant of 6. If_type=6 has a different PCI BAR map, separate EQ/CQ doorbells, and some changes in doorbell formats. Add the changes for the if_type into headers, adapter initialization and control flows. Add new eq and cq handlers. Signed-off-by: Dick Kennedy Signed-off-by: James Smart --- drivers/scsi/lpfc/lpfc_bsg.c | 4 +- drivers/scsi/lpfc/lpfc_hw4.h | 54 ++- drivers/scsi/lpfc/lpfc_init.c | 120 +++--- drivers/scsi/lpfc/lpfc_sli.c | 120 -- drivers/scsi/lpfc/lpfc_sli4.h | 3 ++ 5 files changed, 275 insertions(+), 26 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_bsg.c b/drivers/scsi/lpfc/lpfc_bsg.c index d89816222b23..8b33b652226b 100644 --- a/drivers/scsi/lpfc/lpfc_bsg.c +++ b/drivers/scsi/lpfc/lpfc_bsg.c @@ -3867,7 +3867,7 @@ lpfc_bsg_sli_cfg_read_cmd_ext(struct lpfc_hba *phba, struct bsg_job *job, "ext_buf_cnt:%d\n", ext_buf_cnt); } else { /* sanity check on interface type for support */ - if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) != + if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) < LPFC_SLI_INTF_IF_TYPE_2) { rc = -ENODEV; goto job_error; @@ -4053,7 +4053,7 @@ lpfc_bsg_sli_cfg_write_cmd_ext(struct lpfc_hba *phba, struct bsg_job *job, "ext_buf_cnt:%d\n", ext_buf_cnt); } else { /* sanity check on interface type for support */ - if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) != + if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) < LPFC_SLI_INTF_IF_TYPE_2) return -ENODEV; /* nemb_tp == nemb_hbd */ diff --git a/drivers/scsi/lpfc/lpfc_hw4.h b/drivers/scsi/lpfc/lpfc_hw4.h index 8685d26e6929..93fd9fd10a0f 100644 --- a/drivers/scsi/lpfc/lpfc_hw4.h +++ b/drivers/scsi/lpfc/lpfc_hw4.h @@ -84,6 +84,7 @@ struct lpfc_sli_intf { #define LPFC_SLI_INTF_IF_TYPE_00 #define LPFC_SLI_INTF_IF_TYPE_11 #define LPFC_SLI_INTF_IF_TYPE_22 +#define LPFC_SLI_INTF_IF_TYPE_66 #define lpfc_sli_intf_sli_family_SHIFT 8 #define lpfc_sli_intf_sli_family_MASK 0x000F #define lpfc_sli_intf_sli_family_WORD word0 @@ -731,11 +732,13 @@ struct lpfc_register { * register sets depending on the UCNA Port's reported if_type * value. For UCNA ports running SLI4 and if_type 0, they reside in * BAR4. For UCNA ports running SLI4 and if_type 2, they reside in - * BAR0. The offsets are the same so the driver must account for - * any base address difference. + * BAR0. For FC ports running SLI4 and if_type 6, they reside in + * BAR2. The offsets and base address are different, so the driver + * has to compute the register addresses accordingly */ #define LPFC_ULP0_RQ_DOORBELL 0x00A0 #define LPFC_ULP1_RQ_DOORBELL 0x00C0 +#define LPFC_IF6_RQ_DOORBELL 0x0080 #define lpfc_rq_db_list_fm_num_posted_SHIFT24 #define lpfc_rq_db_list_fm_num_posted_MASK 0x00FF #define lpfc_rq_db_list_fm_num_posted_WORD word0 @@ -770,6 +773,20 @@ struct lpfc_register { #define lpfc_wq_db_ring_fm_id_MASK 0x #define lpfc_wq_db_ring_fm_id_WORD word0 +#define LPFC_IF6_WQ_DOORBELL 0x0040 +#define lpfc_if6_wq_db_list_fm_num_posted_SHIFT24 +#define lpfc_if6_wq_db_list_fm_num_posted_MASK 0x00FF +#define lpfc_if6_wq_db_list_fm_num_posted_WORD word0 +#define lpfc_if6_wq_db_list_fm_dpp_SHIFT 23 +#define lpfc_if6_wq_db_list_fm_dpp_MASK0x0001 +#define lpfc_if6_wq_db_list_fm_dpp_WORDword0 +#define lpfc_if6_wq_db_list_fm_dpp_id_SHIFT16 +#define lpfc_if6_wq_db_list_fm_dpp_id_MASK 0x001F +#define lpfc_if6_wq_db_list_fm_dpp_id_WORD word0 +#define lpfc_if6_wq_db_list_fm_id_SHIFT0 +#define lpfc_if6_wq_db_list_fm_id_MASK 0x +#define lpfc_if6_wq_db_list_fm_id_WORD word0 + #define LPFC_EQCQ_DOORBELL 0x0120 #define lpfc_eqcq_doorbell_se_SHIFT31 #define lpfc_eqcq_doorbell_se_MASK 0x0001 @@ -805,6 +822,38 @@ struct lpfc_register { #define LPFC_CQID_HI_FIELD_SHIFT 10 #define LPFC_EQID_HI_FIELD_SHIFT 9 +#define LPFC_IF6_CQ_DOORBELL 0x00C0 +#define lpfc_if6_cq_doorbell_se_SHIFT 31 +#define lpfc_if6_cq_doorbell_se_MASK 0x0001 +#define lpfc_if6_cq_doorbell_se_WORD word0 +#define LPFC_IF6_CQ_SOLICIT_ENABLE_OFF 0 +#define LPFC_IF6_CQ_SOLICIT_ENABLE_ON 1 +#define lpfc_if6_cq_doorbell_arm_SHIFT 29 +#define lpfc_if6_cq_doorbell_arm_MASK 0x0001 +#define lpfc_if6_
[PATCH v2 04/13] lpfc: Add push-to-adapter support to sli4
New if_type=6 adapters support an additional BAR that provides apertures to allow direct WQE to adapter push support - termed Direct Packet Push (DPP). WQ creation differs slightly to ask for a WQ to be DPP-ized. When submitting a WQE to a DPP WQ, it is submitted to the host memory for the WQ normally, but is also written by the host cpu directly to a BAR aperture. Write buffer coalescing in hardware is (hopefully) turned on, enabling single pci write operation support. The doorbell is thing rung to indicate the WQE is available and was pushed to the aperture. This patch: - Updates the WQ Create commands for the DPP options - Adds the bar mapping for if_type=6 DPP bar - Adds the WQE pushing to the DDP aperture received from WQ create - Adds a new module parameter to disable DPP operation if desired. Default is enabled. Signed-off-by: Dick Kennedy Signed-off-by: James Smart --- drivers/scsi/lpfc/lpfc.h | 3 +- drivers/scsi/lpfc/lpfc_attr.c | 10 ++ drivers/scsi/lpfc/lpfc_hw4.h | 31 ++ drivers/scsi/lpfc/lpfc_init.c | 18 drivers/scsi/lpfc/lpfc_sli.c | 234 +++--- drivers/scsi/lpfc/lpfc_sli4.h | 16 ++- 6 files changed, 225 insertions(+), 87 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h index 9698b9635058..86ffb9756e65 100644 --- a/drivers/scsi/lpfc/lpfc.h +++ b/drivers/scsi/lpfc/lpfc.h @@ -840,7 +840,8 @@ struct lpfc_hba { uint32_t cfg_enable_SmartSAN; uint32_t cfg_enable_mds_diags; uint32_t cfg_enable_fc4_type; - uint32_t cfg_enable_bbcr; /*Enable BB Credit Recovery*/ + uint32_t cfg_enable_bbcr; /* Enable BB Credit Recovery */ + uint32_t cfg_enable_dpp;/* Enable Direct Packet Push */ uint32_t cfg_xri_split; #define LPFC_ENABLE_FCP 1 #define LPFC_ENABLE_NVME 2 diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c index 70bd25666243..705c42e724c2 100644 --- a/drivers/scsi/lpfc/lpfc_attr.c +++ b/drivers/scsi/lpfc/lpfc_attr.c @@ -5204,6 +5204,14 @@ LPFC_ATTR_R(enable_mds_diags, 0, 0, 1, "Enable MDS Diagnostics"); */ LPFC_BBCR_ATTR_RW(enable_bbcr, 1, 0, 1, "Enable BBC Recovery"); +/* + * lpfc_enable_dpp: Enable DPP on G7 + * 0 = DPP on G7 disabled + * 1 = DPP on G7 enabled (default) + * Value range is [0,1]. Default value is 1. + */ +LPFC_ATTR_RW(enable_dpp, 1, 0, 1, "Enable Direct Packet Push"); + struct device_attribute *lpfc_hba_attrs[] = { &dev_attr_nvme_info, &dev_attr_bg_info, @@ -5312,6 +5320,7 @@ struct device_attribute *lpfc_hba_attrs[] = { &dev_attr_lpfc_xlane_supported, &dev_attr_lpfc_enable_mds_diags, &dev_attr_lpfc_enable_bbcr, + &dev_attr_lpfc_enable_dpp, NULL, }; @@ -6324,6 +6333,7 @@ lpfc_get_cfgparam(struct lpfc_hba *phba) lpfc_fcp_io_channel_init(phba, lpfc_fcp_io_channel); lpfc_nvme_io_channel_init(phba, lpfc_nvme_io_channel); lpfc_enable_bbcr_init(phba, lpfc_enable_bbcr); + lpfc_enable_dpp_init(phba, lpfc_enable_dpp); if (phba->sli_rev != LPFC_SLI_REV4) { /* NVME only supported on SLI4 */ diff --git a/drivers/scsi/lpfc/lpfc_hw4.h b/drivers/scsi/lpfc/lpfc_hw4.h index 93fd9fd10a0f..60ccff6fa8b0 100644 --- a/drivers/scsi/lpfc/lpfc_hw4.h +++ b/drivers/scsi/lpfc/lpfc_hw4.h @@ -1372,6 +1372,15 @@ struct lpfc_mbx_wq_create { #define lpfc_mbx_wq_create_page_size_MASK 0x00FF #define lpfc_mbx_wq_create_page_size_WORD word1 #define LPFC_WQ_PAGE_SIZE_4096 0x1 +#define lpfc_mbx_wq_create_dpp_req_SHIFT 15 +#define lpfc_mbx_wq_create_dpp_req_MASK0x0001 +#define lpfc_mbx_wq_create_dpp_req_WORDword1 +#define lpfc_mbx_wq_create_doe_SHIFT 14 +#define lpfc_mbx_wq_create_doe_MASK0x0001 +#define lpfc_mbx_wq_create_doe_WORDword1 +#define lpfc_mbx_wq_create_toe_SHIFT 13 +#define lpfc_mbx_wq_create_toe_MASK0x0001 +#define lpfc_mbx_wq_create_toe_WORDword1 #define lpfc_mbx_wq_create_wqe_size_SHIFT 8 #define lpfc_mbx_wq_create_wqe_size_MASK 0x000F #define lpfc_mbx_wq_create_wqe_size_WORD word1 @@ -1400,6 +1409,28 @@ struct lpfc_mbx_wq_create { #define lpfc_mbx_wq_create_db_format_MASK 0x #define lpfc_mbx_wq_create_db_format_WORD word2 } response; + struct { + uint32_t word0; +#define lpfc_mbx_wq_create_dpp_rsp_SHIFT 31 +#define lpfc_mbx_wq_create_dpp_rsp_MASK0x0001 +#define lpfc_mbx_wq_create_dpp_rsp_WORDword0 +#define lpfc_mbx_wq_create_v1_q_id_SHIFT 0 +#define lpfc_mbx_wq_create_v1_q_id_MASK0x +#define lpfc_mbx_wq_create_v1_q_id_WORDword0 + uint32_t word1; +#define lpfc_mbx_wq_create_v1_bar_set_SHIFT0 +#define lpfc_mbx_wq_create_v1_bar_set_MASK 0x000
[PATCH v2 08/13] lpfc: Enable fw download on if_type=6 devices
Current code is very explicit in what it allows to be downloaded. The driver checking prevented G7 firmware download. The driver checking is unnecessary as the device will validate what it receives. Revise the firmware download interface checking. Added a little debug support in case there is still a failure. Signed-off-by: Dick Kennedy Signed-off-by: James Smart --- drivers/scsi/lpfc/lpfc_hw4.h | 5 + drivers/scsi/lpfc/lpfc_init.c | 44 ++- drivers/scsi/lpfc/lpfc_sli.c | 1 + 3 files changed, 33 insertions(+), 17 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_hw4.h b/drivers/scsi/lpfc/lpfc_hw4.h index dba724e1f5ee..be8227dfa086 100644 --- a/drivers/scsi/lpfc/lpfc_hw4.h +++ b/drivers/scsi/lpfc/lpfc_hw4.h @@ -2241,6 +2241,7 @@ struct lpfc_mbx_redisc_fcf_tbl { * command. */ #define ADD_STATUS_OPERATION_ALREADY_ACTIVE0x67 +#define ADD_STATUS_FW_NOT_SUPPORTED0xEB struct lpfc_mbx_sli4_config { struct mbox_header header; @@ -4603,10 +4604,6 @@ union lpfc_wqe128 { struct gen_req64_wqe gen_req; }; -#define LPFC_GROUP_OJECT_MAGIC_G5 0xfeaa0001 -#define LPFC_GROUP_OJECT_MAGIC_G6 0xfeaa0003 -#define LPFC_FILE_TYPE_GROUP 0xf7 -#define LPFC_FILE_ID_GROUP 0xa2 struct lpfc_grp_hdr { uint32_t size; uint32_t magic_number; diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index 65057e33b8b7..35eb622f58f3 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c @@ -11294,6 +11294,27 @@ lpfc_sli4_get_iocb_cnt(struct lpfc_hba *phba) } +static void +lpfc_log_write_firmware_error(struct lpfc_hba *phba, uint32_t offset, + uint32_t magic_number, uint32_t ftype, uint32_t fid, uint32_t fsize, + const struct firmware *fw) +{ + if (offset == ADD_STATUS_FW_NOT_SUPPORTED) + lpfc_printf_log(phba, KERN_ERR, LOG_INIT, + "3030 This firmware version is not supported on " + "this HBA model. Device:%x Magic:%x Type:%x " + "ID:%x Size %d %zd\n", + phba->pcidev->device, magic_number, ftype, fid, + fsize, fw->size); + else + lpfc_printf_log(phba, KERN_ERR, LOG_INIT, + "3022 FW Download failed. Device:%x Magic:%x Type:%x " + "ID:%x Size %d %zd\n", + phba->pcidev->device, magic_number, ftype, fid, + fsize, fw->size); +} + + /** * lpfc_write_firmware - attempt to write a firmware image to the port * @fw: pointer to firmware image returned from request_firmware. @@ -11321,20 +11342,10 @@ lpfc_write_firmware(const struct firmware *fw, void *context) magic_number = be32_to_cpu(image->magic_number); ftype = bf_get_be32(lpfc_grp_hdr_file_type, image); - fid = bf_get_be32(lpfc_grp_hdr_id, image), + fid = bf_get_be32(lpfc_grp_hdr_id, image); fsize = be32_to_cpu(image->size); INIT_LIST_HEAD(&dma_buffer_list); - if ((magic_number != LPFC_GROUP_OJECT_MAGIC_G5 && -magic_number != LPFC_GROUP_OJECT_MAGIC_G6) || - ftype != LPFC_FILE_TYPE_GROUP || fsize != fw->size) { - lpfc_printf_log(phba, KERN_ERR, LOG_INIT, - "3022 Invalid FW image found. " - "Magic:%x Type:%x ID:%x Size %d %zd\n", - magic_number, ftype, fid, fsize, fw->size); - rc = -EINVAL; - goto release_out; - } lpfc_decode_firmware_rev(phba, fwrev, 1); if (strncmp(fwrev, image->revision, strnlen(image->revision, 16))) { lpfc_printf_log(phba, KERN_ERR, LOG_INIT, @@ -11375,11 +11386,18 @@ lpfc_write_firmware(const struct firmware *fw, void *context) } rc = lpfc_wr_object(phba, &dma_buffer_list, (fw->size - offset), &offset); - if (rc) + if (rc) { + lpfc_log_write_firmware_error(phba, offset, + magic_number, ftype, fid, fsize, fw); goto release_out; + } } rc = offset; - } + } else + lpfc_printf_log(phba, KERN_ERR, LOG_INIT, + "3029 Skipped Firmware update, Current " + "Version:%s New Version:%s\n", + fwrev, image->revision); release_out: list_for_each_entry_safe(dmabuf, next, &dma_buffer_list, list) { diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index a5d6d8eddd2b..01691a5351bd 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/
[PATCH v2 12/13] lpfc: update driver version to 12.0.0.0
Update the driver version to 12.0.0.0 Signed-off-by: Dick Kennedy Signed-off-by: James Smart --- drivers/scsi/lpfc/lpfc_version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/lpfc/lpfc_version.h b/drivers/scsi/lpfc/lpfc_version.h index 4adbf07880a2..b1ae62a44aae 100644 --- a/drivers/scsi/lpfc/lpfc_version.h +++ b/drivers/scsi/lpfc/lpfc_version.h @@ -20,7 +20,7 @@ * included with this package. * ***/ -#define LPFC_DRIVER_VERSION "11.4.0.7" +#define LPFC_DRIVER_VERSION "12.0.0.0" #define LPFC_DRIVER_NAME "lpfc" /* Used for SLI 2/3 */ -- 2.13.1
[PATCH v2 11/13] lpfc: Work around NVME cmd iu SGL type
The hardware offload for NVME commands was created when the FC-NVME standard was setting SGL Descriptor Type to SGL Data Block Descriptor (0h) and SGL Descriptor Sub Type to Address (0h). A late change in NVMe-over-Fabrics obsoleted these values, creating a transport SGL descriptor type with new values to go into these fields. For initial hardware support, in order to be compliant to the spec, use host-supplied cmd IU buffers instead of the adapter generated values. Later hardware will correct this. Add a module parameter to override this offload disablement if looking for lowest latency. This is reasonable as nothing in FC-NVME uses the SQE SGL values. Signed-off-by: Dick Kennedy Signed-off-by: James Smart --- drivers/scsi/lpfc/lpfc.h | 1 + drivers/scsi/lpfc/lpfc_attr.c | 14 drivers/scsi/lpfc/lpfc_hw4.h | 1 + drivers/scsi/lpfc/lpfc_init.c | 4 ++-- drivers/scsi/lpfc/lpfc_nvme.c | 51 ++- drivers/scsi/lpfc/lpfc_sli.c | 15 + 6 files changed, 69 insertions(+), 17 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h index 9136a59b1c5b..6c0d351c0d0d 100644 --- a/drivers/scsi/lpfc/lpfc.h +++ b/drivers/scsi/lpfc/lpfc.h @@ -782,6 +782,7 @@ struct lpfc_hba { uint32_t cfg_fcp_io_channel; uint32_t cfg_suppress_rsp; uint32_t cfg_nvme_oas; + uint32_t cfg_nvme_embed_cmd; uint32_t cfg_nvme_io_channel; uint32_t cfg_nvmet_mrq; uint32_t cfg_enable_nvmet; diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c index ec080de4e7a7..86d241642d03 100644 --- a/drivers/scsi/lpfc/lpfc_attr.c +++ b/drivers/scsi/lpfc/lpfc_attr.c @@ -5059,6 +5059,18 @@ LPFC_ATTR_RW(nvme_oas, 0, 0, 1, "Use OAS bit on NVME IOs"); /* + * lpfc_nvme_embed_cmd: Use the oas bit when sending NVME/NVMET IOs + * + * 0 = Put NVME Command in SGL + * 1 = Embed NVME Command in WQE (unless G7) + * 2 = Embed NVME Command in WQE (force) + * + * Value range is [0,2]. Default value is 1. + */ +LPFC_ATTR_RW(nvme_embed_cmd, 1, 0, 2, +"Embed NVME Command in WQE"); + +/* * lpfc_fcp_io_channel: Set the number of FCP IO channels the driver * will advertise it supports to the SCSI layer. This also will map to * the number of WQs the driver will create. @@ -5299,6 +5311,7 @@ struct device_attribute *lpfc_hba_attrs[] = { &dev_attr_lpfc_task_mgmt_tmo, &dev_attr_lpfc_use_msi, &dev_attr_lpfc_nvme_oas, + &dev_attr_lpfc_nvme_embed_cmd, &dev_attr_lpfc_auto_imax, &dev_attr_lpfc_fcp_imax, &dev_attr_lpfc_fcp_cpu_map, @@ -6323,6 +6336,7 @@ lpfc_get_cfgparam(struct lpfc_hba *phba) lpfc_enable_SmartSAN_init(phba, lpfc_enable_SmartSAN); lpfc_use_msi_init(phba, lpfc_use_msi); lpfc_nvme_oas_init(phba, lpfc_nvme_oas); + lpfc_nvme_embed_cmd_init(phba, lpfc_nvme_embed_cmd); lpfc_auto_imax_init(phba, lpfc_auto_imax); lpfc_fcp_imax_init(phba, lpfc_fcp_imax); lpfc_fcp_cpu_map_init(phba, lpfc_fcp_cpu_map); diff --git a/drivers/scsi/lpfc/lpfc_hw4.h b/drivers/scsi/lpfc/lpfc_hw4.h index ed5e870c58c3..37c547b4bc78 100644 --- a/drivers/scsi/lpfc/lpfc_hw4.h +++ b/drivers/scsi/lpfc/lpfc_hw4.h @@ -2678,6 +2678,7 @@ struct lpfc_mbx_read_rev { #define lpfc_mbx_rd_rev_vpd_MASK 0x0001 #define lpfc_mbx_rd_rev_vpd_WORD word1 uint32_t first_hw_rev; +#define LPFC_G7_ASIC_1 0xd uint32_t second_hw_rev; uint32_t word4_rsvd; uint32_t third_hw_rev; diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index f214b4ac3f9d..36b264da9e0f 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c @@ -10651,11 +10651,11 @@ lpfc_get_sli4_parameters(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq) lpfc_printf_log(phba, KERN_INFO, LOG_INIT | LOG_NVME, "6422 XIB %d: FCP %d %d " - "NVME %d %d %d\n", + "NVME %d %d %d %d\n", bf_get(cfg_xib, mbx_sli4_parameters), phba->fcp_embed_pbde, phba->fcp_embed_io, phba->nvme_support, phba->nvme_embed_pbde, - phba->cfg_suppress_rsp); + phba->cfg_nvme_embed_cmd, phba->cfg_suppress_rsp); if ((bf_get(cfg_cqpsize, mbx_sli4_parameters) & LPFC_CQ_16K_PAGE_SZ) && (bf_get(cfg_wqpsize, mbx_sli4_parameters) & LPFC_WQ_16K_PAGE_SZ) && diff --git a/drivers/scsi/lpfc/lpfc_nvme.c b/drivers/scsi/lpfc/lpfc_nvme.c index c75958daf799..6ea6cc372647 100644 --- a/drivers/scsi/lpfc/lpfc_nvme.c +++ b/drivers/scsi/lpfc/lpfc_nvme.c @@ -617,11 +617,21 @@ lpfc_nvme_adj_fcp_sgls(struct lpfc_vport *vport, struct lpfc_nvme_buf *lpfc_ncmd, struct nvmefc_fcp_req *nCmd) { + struct lpfc_hba *phba = vp
[PATCH v2 09/13] lpfc: Add embedded data pointers for enhanced performance
The current driver isn't taking advantage of a performance hint whereby the initial data buffer descriptor can be placed in the WQE as well as the SGL. Add the logic to detect support for the feature and to use it when supported. Signed-off-by: Dick Kennedy Signed-off-by: James Smart --- drivers/scsi/lpfc/lpfc.h | 2 ++ drivers/scsi/lpfc/lpfc_hw4.h | 3 +++ drivers/scsi/lpfc/lpfc_init.c | 21 + drivers/scsi/lpfc/lpfc_nvme.c | 18 ++ drivers/scsi/lpfc/lpfc_nvmet.c | 24 drivers/scsi/lpfc/lpfc_scsi.c | 8 ++-- drivers/scsi/lpfc/lpfc_sli.c | 25 + 7 files changed, 95 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h index 7aad4a717f13..9136a59b1c5b 100644 --- a/drivers/scsi/lpfc/lpfc.h +++ b/drivers/scsi/lpfc/lpfc.h @@ -840,6 +840,8 @@ struct lpfc_hba { #define LPFC_ENABLE_FCP 1 #define LPFC_ENABLE_NVME 2 #define LPFC_ENABLE_BOTH 3 + uint32_t nvme_embed_pbde; + uint32_t fcp_embed_pbde; uint32_t io_channel_irqs; /* number of irqs for io channels */ struct nvmet_fc_target_port *targetport; lpfc_vpd_t vpd; /* vital product data */ diff --git a/drivers/scsi/lpfc/lpfc_hw4.h b/drivers/scsi/lpfc/lpfc_hw4.h index be8227dfa086..ed5e870c58c3 100644 --- a/drivers/scsi/lpfc/lpfc_hw4.h +++ b/drivers/scsi/lpfc/lpfc_hw4.h @@ -4226,6 +4226,9 @@ struct wqe_common { #define wqe_irsp_SHIFT4 #define wqe_irsp_MASK 0x0001 #define wqe_irsp_WORD word11 +#define wqe_pbde_SHIFT5 +#define wqe_pbde_MASK 0x0001 +#define wqe_pbde_WORD word11 #define wqe_sup_SHIFT 6 #define wqe_sup_MASK 0x0001 #define wqe_sup_WORD word11 diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index 35eb622f58f3..f214b4ac3f9d 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c @@ -10605,6 +10605,19 @@ lpfc_get_sli4_parameters(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq) phba->cfg_enable_fc4_type = LPFC_ENABLE_FCP; } + /* Only embed PBDE for if_type 6 */ + if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) == + LPFC_SLI_INTF_IF_TYPE_6) { + phba->fcp_embed_pbde = 1; + phba->nvme_embed_pbde = 1; + } + + /* PBDE support requires xib be set */ + if (!bf_get(cfg_xib, mbx_sli4_parameters)) { + phba->fcp_embed_pbde = 0; + phba->nvme_embed_pbde = 0; + } + /* * To support Suppress Response feature we must satisfy 3 conditions. * lpfc_suppress_rsp module parameter must be set (default). @@ -10636,6 +10649,14 @@ lpfc_get_sli4_parameters(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq) else phba->fcp_embed_io = 0; + lpfc_printf_log(phba, KERN_INFO, LOG_INIT | LOG_NVME, + "6422 XIB %d: FCP %d %d " + "NVME %d %d %d\n", + bf_get(cfg_xib, mbx_sli4_parameters), + phba->fcp_embed_pbde, phba->fcp_embed_io, + phba->nvme_support, phba->nvme_embed_pbde, + phba->cfg_suppress_rsp); + if ((bf_get(cfg_cqpsize, mbx_sli4_parameters) & LPFC_CQ_16K_PAGE_SZ) && (bf_get(cfg_wqpsize, mbx_sli4_parameters) & LPFC_WQ_16K_PAGE_SZ) && (sli4_params->wqsize & LPFC_WQ_SZ128_SUPPORT)) diff --git a/drivers/scsi/lpfc/lpfc_nvme.c b/drivers/scsi/lpfc/lpfc_nvme.c index 3a103d0895a2..5a1a6e24a27f 100644 --- a/drivers/scsi/lpfc/lpfc_nvme.c +++ b/drivers/scsi/lpfc/lpfc_nvme.c @@ -1170,6 +1170,7 @@ lpfc_nvme_prep_io_dma(struct lpfc_vport *vport, struct sli4_sge *sgl = lpfc_ncmd->nvme_sgl; struct scatterlist *data_sg; struct sli4_sge *first_data_sgl; + struct ulp_bde64 *bde; dma_addr_t physaddr; uint32_t num_bde = 0; uint32_t dma_len; @@ -1237,7 +1238,24 @@ lpfc_nvme_prep_io_dma(struct lpfc_vport *vport, data_sg = sg_next(data_sg); sgl++; } + if (phba->nvme_embed_pbde) { + /* Use PBDE support for first SGL only, offset == 0 */ + /* Words 13-15 */ + bde = (struct ulp_bde64 *) + &wqe->words[13]; + bde->addrLow = first_data_sgl->addr_lo; + bde->addrHigh = first_data_sgl->addr_hi; + bde->tus.f.bdeSize = + le32_to_cpu(first_data_sgl->sge_len); + bde->tus.f.bdeFlags = BUFF_TYPE_BDE_64; + bde->tus.w = cpu_to_le32(bde->tus.w); + bf_set(wqe_pbde, &wqe->generic.wqe_com, 1); + } else + bf_set(wqe_pbde, &wqe->gene
Re: [PATCH 0/5] blk-mq/scsi-mq: support global tags & introduce force_blk_mq
Hi all, [ .. ] >> >> Could you share us your patch for enabling global_tags/MQ on > megaraid_sas >> so that I can reproduce your test? >> >>> See below perf top data. "bt_iter" is consuming 4 times more CPU. >> >> Could you share us what the IOPS/CPU utilization effect is after > applying the >> patch V2? And your test script? > Regarding CPU utilization, I need to test one more time. Currently system > is in used. > > I run below fio test on total 24 SSDs expander attached. > > numactl -N 1 fio jbod.fio --rw=randread --iodepth=64 --bs=4k > --ioengine=libaio --rw=randread > > Performance dropped from 1.6 M IOPs to 770K IOPs. > This is basically what we've seen with earlier iterations. >> >> In theory, it shouldn't, because the HBA only supports HBA wide tags, >> that means the allocation has to share a HBA wide sbitmap no matte>> if >> global tags is used or not. >> >> Anyway, I will take a look at the performance test and data. >> >> >> Thanks, >> Ming > > > Megaraid_sas version of shared tag set. > Whee; thanks for that. I've just finished a patchset moving megarai_sas_fusion to embedded commands (and cutting down the size of 'struct megasas_cmd_fusion' by half :-), so that will come in just handy. Will give it a spin. Cheers, Hannes -- Dr. Hannes ReineckeTeamlead Storage & Networking h...@suse.de +49 911 74053 688 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG Nürnberg)