[PATCH V3 3/3] scsi: core: avoid to pre-allocate big chunk for sg list

2019-04-25 Thread Ming Lei
Now scsi_mq_setup_tags() pre-allocates a big buffer for IO sg list, and the buffer size is scsi_mq_sgl_size() which depends on smaller value between shost->sg_tablesize and SG_CHUNK_SIZE. Modern HBA's DMA is often capable of deadling with very big segment number, so scsi_mq_sgl_size() is often big

[PATCH V3 0/2] scsi: core: avoid big pre-allocation for sg list

2019-04-25 Thread Ming Lei
Hi, Since supporting to blk-mq, big pre-allocation for sg list is introduced, this way is very unfriendly wrt. memory consumption. There were Red Hat internal reports that some scsi_debug based tests can't be run any more because of too big pre-allocation. Also lpfc users commplained that 1GB+ r

[PATCH V3 2/3] scsi: core: avoid to pre-allocate big chunk for protection meta data

2019-04-25 Thread Ming Lei
Now scsi_mq_setup_tags() pre-allocates a big buffer for protection sg entries, and the buffer size is scsi_mq_sgl_size(). This way isn't correct, scsi_mq_sgl_size() is used to pre-allocate sg entries for IO data. And the protection data buffer is much less, for example, one 512byte sector needs 8b

[PATCH V3 1/3] lib/sg_pool.c: improve APIs for allocating sg pool

2019-04-25 Thread Ming Lei
Now sg_alloc_table_chained() allows user to provide one preallocated SGL, and returns simply if the requested number isn't bigger than size of that SGL. This way is nice for inline small SGL to small IO request. However, scattergather code only allows that size of the 1st preallocated SGL is SG_CH

Re: [PATCH 00/35] qla2xxx source code cleanup and bug fixes

2019-04-25 Thread Himanshu Madhani
Hi Bart, Still reviewing it. About half way done. Will ACK if no issues found during testing. Thanks, Himanshu On 4/25/19, 3:04 PM, "linux-scsi-ow...@vger.kernel.org on behalf of Bart Van Assche" wrote: On Wed, 2019-04-17 at 14:44 -0700, Bart Van Assche wrote: > This patch serie

Re: [PATCH 00/35] qla2xxx source code cleanup and bug fixes

2019-04-25 Thread Bart Van Assche
On Wed, 2019-04-17 at 14:44 -0700, Bart Van Assche wrote: > This patch series includes source code cleanup patches and also several bug > fixes. These patches are the result of manual code inspection, static source > code analysis and testing with lockdep and KASAN enabled. Please consider this > p

Re: [PATCH v3 12/26] compat_ioctl: move more drivers to compat_ptr_ioctl

2019-04-25 Thread Johannes Berg
On Thu, 2019-04-25 at 17:55 +0200, Arnd Bergmann wrote: > On Thu, Apr 25, 2019 at 5:35 PM Al Viro wrote: > > > > On Thu, Apr 25, 2019 at 12:21:53PM -0300, Mauro Carvalho Chehab wrote: > > > > > If I understand your patch description well, using compat_ptr_ioctl > > > only works if the driver is

Re: [PATCH v3 12/26] compat_ioctl: move more drivers to compat_ptr_ioctl

2019-04-25 Thread Al Viro
On Thu, Apr 25, 2019 at 05:55:23PM +0200, Arnd Bergmann wrote: > On Thu, Apr 25, 2019 at 5:35 PM Al Viro wrote: > > > > On Thu, Apr 25, 2019 at 12:21:53PM -0300, Mauro Carvalho Chehab wrote: > > > > > If I understand your patch description well, using compat_ptr_ioctl > > > only works if the drive

Re: [PATCH v3 12/26] compat_ioctl: move more drivers to compat_ptr_ioctl

2019-04-25 Thread Arnd Bergmann
On Thu, Apr 25, 2019 at 5:35 PM Al Viro wrote: > > On Thu, Apr 25, 2019 at 12:21:53PM -0300, Mauro Carvalho Chehab wrote: > > > If I understand your patch description well, using compat_ptr_ioctl > > only works if the driver is not for s390, right? > > No; s390 is where "oh, just set ->compat_ioct

Re: [PATCH v3 12/26] compat_ioctl: move more drivers to compat_ptr_ioctl

2019-04-25 Thread Mauro Carvalho Chehab
Em Thu, 25 Apr 2019 16:35:34 +0100 Al Viro escreveu: > On Thu, Apr 25, 2019 at 12:21:53PM -0300, Mauro Carvalho Chehab wrote: > > > If I understand your patch description well, using compat_ptr_ioctl > > only works if the driver is not for s390, right? > > No; s390 is where "oh, just set ->co

Re: [PATCH v3 12/26] compat_ioctl: move more drivers to compat_ptr_ioctl

2019-04-25 Thread Al Viro
On Thu, Apr 25, 2019 at 12:21:53PM -0300, Mauro Carvalho Chehab wrote: > If I understand your patch description well, using compat_ptr_ioctl > only works if the driver is not for s390, right? No; s390 is where "oh, just set ->compat_ioctl same as ->unlocked_ioctl and be done with that; compat_ptr

Re: [PATCH v3 12/26] compat_ioctl: move more drivers to compat_ptr_ioctl

2019-04-25 Thread Arnd Bergmann
On Thu, Apr 25, 2019 at 5:22 PM Mauro Carvalho Chehab wrote: > Em Tue, 16 Apr 2019 22:25:33 +0200 Arnd Bergmann escreveu: > > If I understand your patch description well, using compat_ptr_ioctl > only works if the driver is not for s390, right? No, the purpose of compat_ptr_ioctl() is to make su

Re: [PATCH v3 12/26] compat_ioctl: move more drivers to compat_ptr_ioctl

2019-04-25 Thread Mauro Carvalho Chehab
Em Tue, 16 Apr 2019 22:25:33 +0200 Arnd Bergmann escreveu: > The .ioctl and .compat_ioctl file operations have the same prototype so > they can both point to the same function, which works great almost all > the time when all the commands are compatible. > > One exception is the s390 architectur

Re: [PATCH V2 1/2] scsi: core: avoid to pre-allocate big chunk for protection meta data

2019-04-25 Thread Ming Lei
On Thu, Apr 25, 2019 at 05:37:29PM +0800, Ming Lei wrote: > On Wed, Apr 24, 2019 at 04:37:04PM +0200, Christoph Hellwig wrote: > > > - if (scsi_prot_sg_count(cmd)) > > > - sg_free_table_chained(&cmd->prot_sdb->table, true); > > > + if (scsi_prot_sg_count(cmd) && cmd->prot_sdb->table.sgl !=

Re: [PATCH V2 1/2] scsi: core: avoid to pre-allocate big chunk for protection meta data

2019-04-25 Thread Ming Lei
On Wed, Apr 24, 2019 at 04:37:04PM +0200, Christoph Hellwig wrote: > > - if (scsi_prot_sg_count(cmd)) > > - sg_free_table_chained(&cmd->prot_sdb->table, true); > > + if (scsi_prot_sg_count(cmd) && cmd->prot_sdb->table.sgl != > > + scsi_prot_inline_sg(cmd)) > > +

Re: [PATCH V7 1/9] blk-mq: grab .q_usage_counter when queuing request from plug code path

2019-04-25 Thread Ming Lei
On Thu, Apr 25, 2019 at 07:32:34AM +0200, Christoph Hellwig wrote: > On Thu, Apr 25, 2019 at 08:53:34AM +0800, Ming Lei wrote: > > It isn't in other callers of blk_mq_sched_insert_requests(), it is just > > needed in some corner case like flush plug context. > > > > For other callers of blk_mq_sch