All of lore.kernel.org
 help / color / mirror / Atom feed
From: pauldaviesc@gmail.com (Paul Davies C)
To: kernelnewbies@lists.kernelnewbies.org
Subject: large frame size warning when compiling
Date: Fri, 09 May 2014 18:06:43 +0530	[thread overview]
Message-ID: <536CCBDB.7080302@gmail.com> (raw)
In-Reply-To: <20140509121303.GB6218@gmail.com>

On Friday 09 May 2014 05:43 PM, Jay Aurabind wrote:
> On Thu, May 08, 2014 at 02:38:24PM +0200, Martin Kepplinger wrote:
>> Am 2014-05-07 18:36, schrieb Jay Aurabind:
>>> Hello list, Time for a noob discussion,
>>>
>>> When I was building the kernel, I found a warning from drivers/mfd/abx500-core.c, that the Frame size is larger than 1024 bytes. Apparently the stack frame size can be changed from the config, but my question is, whether 1024 bytes low ? I am on an x86_64 (core i3).
>>>
>>> abx500-core.c had an object of struct device being allocated on stack. So
>>> dynamically allocating it makes the warning go away. Are there any
>>> implications on using dynamic allocation on this particular code? I
>>> mean, could there be some reason why the original developer went with static option ?
>> kmalloc may sleep and is therefore sometimes not recommended to be used.
>>
> Sure, but this code doesnt appear to be holding any locks. So it should
> be okay to call kmalloc here I guess.
You can use kmalloc even if you are holding a lock. Care must be taken 
to pass GFP_ATOMIC flag to the kmalloc, so that it does not sleep.
>>>
>>> ---
>>>   drivers/mfd/abx500-core.c | 8 +++++---
>>>   1 file changed, 5 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/drivers/mfd/abx500-core.c b/drivers/mfd/abx500-core.c
>>> index f3a15aa..709a84f 100644
>>> --- a/drivers/mfd/abx500-core.c
>>> +++ b/drivers/mfd/abx500-core.c
>>> @@ -154,15 +154,17 @@ EXPORT_SYMBOL(abx500_startup_irq_enabled);
>>>   void abx500_dump_all_banks(void)
>>>   {
>>>   	struct abx500_ops *ops;
>>> -	struct device dummy_child = {NULL};
>>> +	struct device *dummy_child;
>>>   	struct abx500_device_entry *dev_entry;
>>>   
>>> +	dummy_child = kzalloc(sizeof(struct device),GFP_KERNEL);
>>> +
>>>   	list_for_each_entry(dev_entry, &abx500_list, list) {
>>> -		dummy_child.parent = dev_entry->dev;
>>> +		dummy_child->parent = dev_entry->dev;
>>>   		ops = &dev_entry->ops;
>>>   
>>>   		if ((ops != NULL) && (ops->dump_all_banks != NULL))
>>> -			ops->dump_all_banks(&dummy_child);
>>> +			ops->dump_all_banks(dummy_child);
>>>   	}
>>>   }
>>>   EXPORT_SYMBOL(abx500_dump_all_banks);
>>>
>>>
>>>
>>> _______________________________________________
>>> Kernelnewbies mailing list
>>> Kernelnewbies at kernelnewbies.org
>>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>>>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


-- 
Paul Davies C,
CSE B.Tech. student,
Govt. Engineering College, Thrissur.

      reply	other threads:[~2014-05-09 12:36 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-07 16:36 large frame size warning when compiling Jay Aurabind
2014-05-07 16:51 ` Valdis.Kletnieks at vt.edu
2014-05-08  3:54   ` Jay Aurabind
2014-05-08 15:46     ` Valdis.Kletnieks at vt.edu
2014-05-09 12:09       ` Jay Aurabind
2014-05-09 15:30         ` Valdis.Kletnieks at vt.edu
2014-05-10  6:43           ` Jay Aurabind
2014-05-09 15:56       ` Frank Ch. Eigler
2014-05-08 12:38 ` Martin Kepplinger
2014-05-09 12:13   ` Jay Aurabind
2014-05-09 12:36     ` Paul Davies C [this message]

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=536CCBDB.7080302@gmail.com \
    --to=pauldaviesc@gmail.com \
    --cc=kernelnewbies@lists.kernelnewbies.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.