mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ben Greear <greearb@candelatech.com>
To: David Rientjes <rientjes@google.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Question on kzalloc and GFP_DMA32
Date: Wed, 28 Sep 2016 16:37:38 -0700	[thread overview]
Message-ID: <b5782d23-1713-da51-7a61-9fd2d7d09d42@candelatech.com> (raw)
In-Reply-To: <alpine.DEB.2.10.1609281407430.137474@chino.kir.corp.google.com>

On 09/28/2016 02:11 PM, David Rientjes wrote:
> On Tue, 27 Sep 2016, Ben Greear wrote:
>
>>
>> I have been running this patch for a while:
>>
>>     ath10k:  Use GPF_DMA32 for firmware swap memory.
>>
>>     This fixes OS crash when using QCA 9984 NIC on x86-64 system
>>     without vt-d enabled.
>>
>>     Also tested on ea8500 with 9980, and x86-64 with 9980 and 9880.
>>
>>     All tests were with CT firmware.
>>
>>     Signed-off-by: Ben Greear <greearb@candelatech.com>
>>
>> -------------------- drivers/net/wireless/ath/ath10k/wmi.c
>> --------------------
>> index e20aa39..727b3aa 100644
>> @@ -4491,7 +4491,7 @@ static int ath10k_wmi_alloc_chunk(struct ath10k *ar, u32
>> req_id,
>>          if (!pool_size)
>>              return -EINVAL;
>>
>> -        vaddr = kzalloc(pool_size, GFP_KERNEL | __GFP_NOWARN);
>> +        vaddr = kzalloc(pool_size, GFP_KERNEL | __GFP_NOWARN | GFP_DMA32);
>>          if (!vaddr)
>>              num_units /= 2;
>>      }
>>
>>
>> It sometimes works, on some systems, but then it also often fails with the
>> splat
>> below, especially with several NICs in the system.
>>
>
> I suppose it's failing sometimes because the BUG() will trigger when
> trying to allocate new slab or CONFIG_ZONE_DMA32 isn't configured.  That
> shouldn't panic the kernel anymore since commit 72baeef0c271 ("slab: do
> not panic on invalid gfp_mask") in 4.8, but you shouldn't be doing
> kzalloc(..., ... | GFP_DMA32) anyway.

CONFIG_ZONE_DMA32 is enabled in my .config.

>> pool_size is relatively large (maybe 256k or so).
>>
>
> If it's 256k, why allocate through the slab allocator?  Why not
> alloc_pages(GFP_KERNEL | GFP_DMA32 | __GFP_ZERO | __GFP_NOWARN,
> get_order(pool_size))?

I really don't understand the (subtle?) difference between alloc_pages and kzalloc,
but I will give your suggestion a try and see if it works.  If you have time, maybe you could take
a look at drivers/net/wireless/ath/ath10k/wmi.c in the ath10k_wmi_alloc_chunk method
to see if you notice any problems with using alloc_pages there?

Thanks for the suggestion.


-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com

  reply	other threads:[~2016-09-28 23:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-27 23:07 Ben Greear
2016-09-28 21:11 ` David Rientjes
2016-09-28 23:37   ` Ben Greear [this message]
2016-10-06 16:41 Adrian Chadd

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b5782d23-1713-da51-7a61-9fd2d7d09d42@candelatech.com \
    --to=greearb@candelatech.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rientjes@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®