All of lore.kernel.org
 help / color / mirror / Atom feed
From: Huang Ying <ying.huang@intel.com>
To: Seiji Aguchi <seiji.aguchi@hds.com>
Cc: "rjw@sisk.pl" <rjw@sisk.pl>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>,
	"H. Peter Anvin (hpa@zytor.com)" <hpa@zytor.com>,
	"robert.moore@intel.com" <robert.moore@intel.com>,
	"trenn@suse.de" <trenn@suse.de>,
	"myron.stowe@redhat.com" <myron.stowe@redhat.com>
Subject: Re: ERST: how to avoid a dynamic memory allocation in panic case
Date: Wed, 23 Jan 2013 08:39:54 +0800	[thread overview]
Message-ID: <1358901594.7408.85.camel@yhuang-dev> (raw)
In-Reply-To: <A5ED84D3BB3A384992CBB9C77DEDA4D414A51F3D@USINDEM103.corp.hds.com>

On Tue, 2013-01-22 at 23:30 +0000, Seiji Aguchi wrote:
> [Issue]
> 
> Current erst driver is kicked in panic case.
> On the other hand, a dynamic memory allocation seems to run in it
> with a following code path.
> 
> erst_writer -> erst_write -> __erst_write_to_storage -> many of apei_exec_run -> 
> ctx->ins_table[entry->instruction].run()
> 
> which are functions defined in erst_ins_type table i.e:
> 
> apei_exec_read_register -> apei_read -> acpi_os_read_memory64 -> acpi_os_ioremap -> ioremap_cache
> 
> which possibly involve IOMMU allocator.
> 
> I may cause a failure of  an erst driver if the panic happens in an interrupt context.
> 
> [Idea]
> 
> If we can remove ioremap_cache() from acpi_os_read_memory() as follows,
> It is easy to fix this issue.
> But I'm not sure if it is feasible because I can't see the reason of tying acpi_os_ioremap()  from a git log...
> 
> Any comment?
> 
> <snip>
> @@ -918,10 +918,7 @@ acpi_os_read_memory(acpi_physical_address phys_addr, u64 *value, u32 width)
>  	virt_addr = acpi_map_vaddr_lookup(phys_addr, size);
>  	if (!virt_addr) {
>  		rcu_read_unlock();
> -		virt_addr = acpi_os_ioremap(phys_addr, size);
> -		if (!virt_addr)
> -			return AE_BAD_ADDRESS;
> -		unmap = true;
> +		return AE_BAD_ADDRESS;

No.  We can not do that.  Because some users rely on acpi_os_read_memory
to do ioremap for them.

The correct fixing should be pre-map the io-memory that may be accessed
in erst code patch with acpi_map().

Best Regards,
Huang Ying

>  	}
>  
>  	if (!value)
> <snip>
> 
> Seiji



  reply	other threads:[~2013-01-23  0:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-22 23:30 ERST: how to avoid a dynamic memory allocation in panic case Seiji Aguchi
2013-01-23  0:39 ` Huang Ying [this message]
2013-01-23  0:44   ` Seiji Aguchi
2013-01-23  0:44     ` Seiji Aguchi

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=1358901594.7408.85.camel@yhuang-dev \
    --to=ying.huang@intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=myron.stowe@redhat.com \
    --cc=rjw@sisk.pl \
    --cc=robert.moore@intel.com \
    --cc=seiji.aguchi@hds.com \
    --cc=trenn@suse.de \
    /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.