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

Joe Perches
2012-07-18T22:49:44Z

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,
};