mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Huang Ying <ying.huang@intel.com>
To: Jin Dongming <jin.dongming@np.css.fujitsu.com>
Cc: Randy Dunlap <randy.dunlap@oracle.com>,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	Andi Kleen <andi@firstfloor.org>,
	Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>,
	ACPI <linux-acpi@vger.kernel.org>,
	LKLM <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 3/4] [Patch-next] ACPI, APEI Fix the return value(==NULL) of acpi_pre_map always.
Date: Tue, 17 Aug 2010 09:37:43 +0800	[thread overview]
Message-ID: <1282009063.2744.1495.camel@yhuang-dev> (raw)
In-Reply-To: <4C69DE57.9070608@np.css.fujitsu.com>

On Tue, 2010-08-17 at 08:56 +0800, Jin Dongming wrote:
> acpi_pre_map() is used for remapping the physical address of I/O, so
> it should be return NULL or remapped virtual address. The problem
> is whether I/O remapping is successful or not, the function returns
> NULL always.

No. NULL is returned for error path only. Please check the code again.

> In acpi_pre_map(), after the physical address is remapped sucessfully,
> it will check whether the physical address has been added into acpi_iomaps
> list again. If the physical address has beed added into acpi_iomaps,
> the virtual address will be saved in vaddr. Otherwise, NULL be saved in
> vaddr.
> 
> So if the physical address has never been remapped, the return value of
> acpi_pre_map will be NULL always.
> 
> This patch fixed it and I confirmed it on x86_64 next-tree.
> 
> Signed-off-by: Jin Dongming <jin.dongming@np.css.fujitsu.com>
> ---
>  drivers/acpi/atomicio.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/acpi/atomicio.c b/drivers/acpi/atomicio.c
> index 8f8bd73..1bc2614 100644
> --- a/drivers/acpi/atomicio.c
> +++ b/drivers/acpi/atomicio.c
> @@ -133,7 +133,7 @@ static void __iomem *acpi_pre_map(phys_addr_t paddr,
>  
>  	spin_lock_irqsave(&acpi_iomaps_lock, flags);
>  	vaddr = __acpi_try_ioremap(paddr, size);
> -	if (vaddr) {
> +	if (unlikely(vaddr)) {

pre_map is not performance critical, so "unlikely" here helps little.

>  		spin_unlock_irqrestore(&acpi_iomaps_lock, flags);
>  		iounmap(map->vaddr);
>  		kfree(map);
> @@ -142,7 +142,7 @@ static void __iomem *acpi_pre_map(phys_addr_t paddr,
>  	list_add_tail_rcu(&map->list, &acpi_iomaps);
>  	spin_unlock_irqrestore(&acpi_iomaps_lock, flags);
>  
> -	return vaddr + (paddr - pg_off);
> +	return map->vaddr + (paddr - pg_off);
>  err_unmap:
>  	iounmap(vaddr);
>  	return NULL;

When will vaddr != map->vaddr?

Best Regards,
Huang Ying



  reply	other threads:[~2010-08-17  1:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-17  0:56 Jin Dongming
2010-08-17  1:37 ` Huang Ying [this message]
2010-08-17  2:43   ` Jin Dongming
2010-08-17  4:15     ` Huang Ying
2010-08-17  4:47       ` Jin Dongming

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=1282009063.2744.1495.camel@yhuang-dev \
    --to=ying.huang@intel.com \
    --cc=andi@firstfloor.org \
    --cc=jin.dongming@np.css.fujitsu.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=randy.dunlap@oracle.com \
    --cc=seto.hidetoshi@jp.fujitsu.com \
    --cc=sfr@canb.auug.org.au \
    /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®