Re: [PATCH 1/4] ACPI: Add acpi_pr_<level>() interfaces

From: Toshi Kani
Date: Wed Jul 18 2012 - 19:37:45 EST


On Wed, 2012-07-18 at 15:49 -0700, Joe Perches wrote:
> On Wed, 2012-07-18 at 16:26 -0600, Toshi Kani wrote:
> > On Wed, 2012-07-18 at 15:59 -0600, Shuah Khan wrote:
> > > On Wed, 2012-07-18 at 14:40 -0600, Toshi Kani wrote:
> > > > This patch introduces acpi_pr_<level>(), where <level> is a message
> > > > level such as err/warn/info, to support improved logging messages
> > > > for ACPI, esp. in hotplug operations.
> []
> > > > diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c
> []
> > > > @@ -454,3 +454,35 @@ acpi_evaluate_hotplug_ost(acpi_handle handle, u32 source_event,
> []
> > > > + struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER};
> []
> > > > + ret = acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer);
> > >
> > > One big problem I see with this approach is now each acpi_printk() will
> > > result in a call to acpi_get_name() which will invoke several ACPI
> > > calls, including a call to acpi_ut_initialize_buffer() which allocates
> > > buffer. Is this really warranted? What is the performance impact of this
> > > change?
> []
> > This interface is intended to be used by acpi_pr_<level>(), which is
> > used for error, warning, debugging, etc. It is not intended to be used
> > in any performance path.
>
> While it's not performance critical, perhaps the buffer
> alloc/free could be avoided by using stack. Something like:
>
> char name[ACPI_PATH_SEGMENT_LENGTH * max_segments ? ];
> struct acpi_buffer buffer = {
> .length = ACPI_PATH_SEGMENT_LENGTH,
> .buffer = name,
> };
>

Hi Joe,

I thought about using stack initially, but I too was not sure how big
the buffer size should be, and was a bit afraid of causing kernel stack
overflow potentially. Since it is mainly used for error paths in ACPI
hotplug handlers, I do not think alloc/free can lead any performance
impact.

Thanks,
-Toshi


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/