public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Joonsoo Kim <iamjoonsoo.kim@lge.com>
To: Rob Herring <robherring2@gmail.com>
Cc: Nicolas Pitre <nicolas.pitre@linaro.org>,
	Rob Herring <rob.herring@calxeda.com>,
	Russell King <linux@arm.linux.org.uk>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will.deacon@arm.com>,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v5 3/3] ARM: mm: use static_vm for managing static mapped areas
Date: Wed, 6 Feb 2013 14:05:27 +0900	[thread overview]
Message-ID: <20130206050527.GA8249@lge.com> (raw)
In-Reply-To: <20130206020707.GB4325@lge.com>

On Wed, Feb 06, 2013 at 11:07:07AM +0900, Joonsoo Kim wrote:
> Hello, Rob.
> 
> On Tue, Feb 05, 2013 at 01:12:51PM -0600, Rob Herring wrote:
> > On 02/05/2013 12:13 PM, Nicolas Pitre wrote:
> > > On Tue, 5 Feb 2013, Rob Herring wrote:
> > > 
> > >> On 02/04/2013 10:44 PM, Nicolas Pitre wrote:
> > >>> On Tue, 5 Feb 2013, Joonsoo Kim wrote:
> > >>>
> > >>>> A static mapped area is ARM-specific, so it is better not to use
> > >>>> generic vmalloc data structure, that is, vmlist and vmlist_lock
> > >>>> for managing static mapped area. And it causes some needless overhead and
> > >>>> reducing this overhead is better idea.
> > >>>>
> > >>>> Now, we have newly introduced static_vm infrastructure.
> > >>>> With it, we don't need to iterate all mapped areas. Instead, we just
> > >>>> iterate static mapped areas. It helps to reduce an overhead of finding
> > >>>> matched area. And architecture dependency on vmalloc layer is removed,
> > >>>> so it will help to maintainability for vmalloc layer.
> > >>>>
> > >>>> Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
> > >>
> > >> [snip]
> > >>
> > >>>> @@ -859,17 +864,12 @@ static void __init pci_reserve_io(void)
> > >>>>  {
> > >>>>  	struct vm_struct *vm;
> > >>>>  	unsigned long addr;
> > >>>> +	struct static_vm *svm;
> > >>>>  
> > >>>> -	/* we're still single threaded hence no lock needed here */
> > >>>> -	for (vm = vmlist; vm; vm = vm->next) {
> > >>>> -		if (!(vm->flags & VM_ARM_STATIC_MAPPING))
> > >>>> -			continue;
> > >>>> -		addr = (unsigned long)vm->addr;
> > >>>> -		addr &= ~(SZ_2M - 1);
> > >>>> -		if (addr == PCI_IO_VIRT_BASE)
> > >>>> -			return;
> > >>>> +	svm = find_static_vm_vaddr((void *)PCI_IO_VIRT_BASE);
> > >>>> +	if (svm)
> > >>>> +		return;
> > >>>>
> > >>>> -	}
> > >>>>  
> > >>>>  	vm_reserve_area_early(PCI_IO_VIRT_BASE, SZ_2M, pci_reserve_io);
> > >>>>  }
> > >>>
> > >>> The replacement code is not equivalent.  I can't recall why the original 
> > >>> is as it is, but it doesn't look right to me.  The 2MB round down 
> > >>> certainly looks suspicious.
> > >>
> > >> The PCI mapping is at a fixed, aligned 2MB mapping. If we find any
> > >> virtual address within that region already mapped, it is an error.
> > > Ah, OK.  This wasn't clear looking at the code.
> > >> We probably should have had a WARN here.
> > > 
> > > Indeed.
> > > 
> 
> Okay.
> I should fix it to find any mapping within PCI reserved region.

Ah...
Above comment is my mistake.

If there is a region already mapped within PCI reserved region and
it is not found by find_static_vm_vaddr(), vm_area_add_early() hit BUG_ON().
So, to leave find_static_vm_vaddr() is safe.

> But, I think that it is not an error.
> Now, I see your original commit 'c2794437091a4fda72c4a4f3567dd728dcc0c3c9'
> and find below message.
> 
> "Platforms which need early i/o mapping (e.g. for vga console) can call
> pci_map_io_early in their .map_io function."
> 
> Therfore, for some platform, it is possible that there is a mapping within
> PCI reserved range.
> 
> So, I will not add WARN here.
> 
> I will fix and re-send v6 with your ACK.
> 
> Thanks for review.
> 
> > >>>
> > >>> The replacement code should be better.  However I'd like you to get an 
> > >>> ACK from Rob Herring as well for this patch.
> > >>
> > >> It doesn't appear to me the above case is handled. The virt addr is
> > >> checked whether it is within an existing mapping, but not whether the
> > >> new mapping would overlap an existing mapping. It would be good to check
> > >> for this generically rather than specifically for the PCI i/o mapping.
> > > 
> > > Agreed.  However that is checked already in vm_area_add_early().  
> > > Therefore the overlap test here is redundant.
> > 
> > Ah, right. In that case:
> > 
> > Acked-by: Rob Herring <rob.herring@calxeda.com>
> > 
> > Rob
> > 
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> > Please read the FAQ at  http://www.tux.org/lkml/
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

  reply	other threads:[~2013-02-06  5:05 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-05  0:31 [PATCH v5 0/3] introduce static_vm for ARM-specific static mapped area Joonsoo Kim
2013-02-05  0:31 ` [PATCH v5 1/3] ARM: vmregion: remove vmregion code entirely Joonsoo Kim
2013-02-05  8:52   ` Santosh Shilimkar
2013-02-06  2:08     ` Joonsoo Kim
2013-02-05  0:31 ` [PATCH v5 2/3] ARM: ioremap: introduce an infrastructure for static mapped area Joonsoo Kim
2013-02-05  4:08   ` Nicolas Pitre
2013-02-05  0:31 ` [PATCH v5 3/3] ARM: mm: use static_vm for managing static mapped areas Joonsoo Kim
2013-02-05  4:44   ` Nicolas Pitre
2013-02-05 17:28     ` Rob Herring
2013-02-05 18:13       ` Nicolas Pitre
2013-02-05 19:12         ` Rob Herring
2013-02-06  2:07           ` Joonsoo Kim
2013-02-06  5:05             ` Joonsoo Kim [this message]
2013-02-06  6:19               ` Nicolas Pitre
2013-02-06  1:41     ` Joonsoo Kim
2013-02-05  9:02 ` [PATCH v5 0/3] introduce static_vm for ARM-specific static mapped area Santosh Shilimkar
2013-02-06  2:09   ` Joonsoo Kim

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=20130206050527.GA8249@lge.com \
    --to=iamjoonsoo.kim@lge.com \
    --cc=catalin.marinas@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=nicolas.pitre@linaro.org \
    --cc=rob.herring@calxeda.com \
    --cc=robherring2@gmail.com \
    --cc=will.deacon@arm.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