Hi Guenter,

Thanks for your test and report!

On Tue, Jun 04, 2019 at 06:38:49AM -0700, Guenter Roeck wrote:
> On Tue, Jun 04, 2019 at 04:23:06PM +0800, Ming Lei wrote:
> > Hi,
> > 
> > Guenter reported scsi boot issue caused by commit c3288dd8c232
> > ("scsi: core: avoid pre-allocating big SGL for data").
> > 
> > Turns out there are at least two issues.
> > 
> > The 1st patch fixes issue in case that NO_SG_CHAIN on some ARCHs,
> > such as alpha, arm and parisc.
> > 
> > The 2nd patch makes esp scsi working with SG_CHAIN.
> > 
> 
> Both patches applied on top of next-20190604.
> 
> Results on alpha:
> 
> Waiting for root device /dev/sda...
> ------------[ cut here ]------------
> WARNING: CPU: 0 PID: 7 at mm/slab.h:359 kmem_cache_free+0x120/0x2a0
> virt_to_cache: Object is not a Slab page!

Please apply the following patch against the posted two:

diff --git a/lib/sg_pool.c b/lib/sg_pool.c
index 47eecbe094d8..e042a1722615 100644
--- a/lib/sg_pool.c
+++ b/lib/sg_pool.c
@@ -122,7 +122,7 @@ int sg_alloc_table_chained(struct sg_table *table, int 
nents,
        }
 
        /* User supposes that the 1st SGL includes real entry */
-       if (nents_first_chunk == 1) {
+       if (nents_first_chunk <= 1) {
                first_chunk = NULL;
                nents_first_chunk = 0;
        }

Thanks,
Ming

Reply via email to