From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752182AbbE0VJg (ORCPT ); Wed, 27 May 2015 17:09:36 -0400 Received: from smtprelay0238.hostedemail.com ([216.40.44.238]:38095 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751575AbbE0VJd (ORCPT ); Wed, 27 May 2015 17:09:33 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::,RULES_HIT:41:355:379:541:599:800:960:966:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2196:2199:2393:2553:2559:2562:2828:3138:3139:3140:3141:3142:3353:3622:3865:3866:3867:3870:3871:3872:3874:4321:4385:4605:5007:6120:6261:10004:10400:10481:10848:10967:11026:11232:11658:11914:12043:12296:12517:12519:12740:13069:13311:13357:14096:14097:19900:21080,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0 X-HE-Tag: book27_8d7a424d95d53 X-Filterd-Recvd-Size: 2245 Message-ID: <1432760971.2846.180.camel@perches.com> Subject: Re: [RFC patch] vsprintf: Add %pav extension for print_vma_addr From: Joe Perches To: Andrew Morton Cc: LKML Date: Wed, 27 May 2015 14:09:31 -0700 In-Reply-To: <20150527140406.bcc33ecc79da09ad6782b971@linux-foundation.org> References: <1432681504.2846.116.camel@perches.com> <20150527140406.bcc33ecc79da09ad6782b971@linux-foundation.org> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.12.11-0ubuntu3 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2015-05-27 at 14:04 -0700, Andrew Morton wrote: > On Tue, 26 May 2015 16:05:04 -0700 Joe Perches 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?