public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: Re: [RFC patch] vsprintf: Add %pav extension for print_vma_addr
Date: Wed, 27 May 2015 14:09:31 -0700	[thread overview]
Message-ID: <1432760971.2846.180.camel@perches.com> (raw)
In-Reply-To: <20150527140406.bcc33ecc79da09ad6782b971@linux-foundation.org>

On Wed, 2015-05-27 at 14:04 -0700, Andrew Morton wrote:
> On Tue, 26 May 2015 16:05:04 -0700 Joe Perches <joe@perches.com> wrote:
> > print_vma_addr is another function to emit useful
> > data similar to print_symbol.  The print_symbol
> > functionality has been added via %p[fFsS] vsprintf
> > extensions.
> > 
> > Perhaps it's appropriate to add vma_addr address
> > decoding to vsprintf too.
[]
> >  static noinline_for_stack
> > +char *vma_addr(char *buf, char *end, const void *addr,
> > +	       struct printf_spec spec, const char *fmt)
> > +{
> > +	struct mm_struct *mm = current->mm;
> > +	struct vm_area_struct *vma;
> > +	unsigned long ip = *(unsigned long *)addr;
> > +	char *rtn;
> > +
> > +	/* if we are in atomic contexts (in exception stacks, etc.) */
> > +	if (preempt_count())
> > +		return string(buf, end, "(atomic context)", spec);
> 
> Problems when CONFIG_PREEMPT=n.
> 
> > +	down_read(&mm->mmap_sem);
> > +	vma = find_vma(mm, ip);
> > +	if (vma && vma->vm_file) {
> > +		struct file *f = vma->vm_file;
> > +		char *gfp_buf = (char *)__get_free_page(GFP_KERNEL);
> 
> We shouldn't assume we can use GFP_KERNEL here.  Even if the
> preempt_count() worked, we might be in a context which requires
> GFP_NOFS or GFP_NOIO.

This code is basically a copy of the existing print_vma_addr()
so is that true for all the existing uses too?



  reply	other threads:[~2015-05-27 21:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-26 23:05 [RFC patch] vsprintf: Add %pav extension for print_vma_addr Joe Perches
2015-05-27 21:04 ` Andrew Morton
2015-05-27 21:09   ` Joe Perches [this message]
2015-05-27 21:19     ` Andrew Morton
2015-05-31 17:51       ` Joe Perches
2015-06-01 23:36         ` Andrew Morton

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=1432760971.2846.180.camel@perches.com \
    --to=joe@perches.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox