All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] dynamic table unload fixes
@ 2015-04-03 16:07 Bob Paauwe
  2015-04-03 16:07 ` [PATCH 1/2] Remove extra release mutex call Bob Paauwe
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Bob Paauwe @ 2015-04-03 16:07 UTC (permalink / raw)
  To: linux-acpi; +Cc: Bob Paauwe

While trying to make use of dynamic tables as a way to provide driver
initialization properties, I've encountered a couple of issues with the
way dynamic tables are being handled.

The first patch appears to be a bug. There is a mutex release without
a corresponding aquire. This extra release causes a mutex error message
when a table is re-loaded after being unloaded.

The second patch actually unloads a table when table unload is called. 
When a table is being dynamically loaded by a driver module and that
driver module is unloaded, the memory for the table would typically be
freed resulting in a table that is marked as unloaded but still pointing
to that freed memory.  If the driver module is then re-loaded, the
ACPI table reload function will attempt to access that freed memory when
it does a table compare and results in a oops.

These patches solve the problems I've encountered but may not be the 
proper way to solve.

Bob Paauwe (2):
  Remove extra release mutex call.
  Acutally unload a table.

 drivers/acpi/acpica/tbinstal.c | 1 -
 drivers/acpi/acpica/tbxfload.c | 1 +
 2 files changed, 1 insertion(+), 1 deletion(-)

-- 
2.1.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] Remove extra release mutex call.
  2015-04-03 16:07 [PATCH 0/2] dynamic table unload fixes Bob Paauwe
@ 2015-04-03 16:07 ` Bob Paauwe
  2015-04-03 16:07 ` [PATCH 2/2] Acutally unload a table Bob Paauwe
  2015-04-07 11:58 ` [PATCH 0/2] dynamic table unload fixes Rafael J. Wysocki
  2 siblings, 0 replies; 4+ messages in thread
From: Bob Paauwe @ 2015-04-03 16:07 UTC (permalink / raw)
  To: linux-acpi; +Cc: Bob Paauwe

Remove the release mutex call when a table is re-loaded. This seems to
be here to release a mutex that was aquired at one time in table verify
function.  That aquire is no longer present, so remove the release.

Signed-off-by: Bob Paauwe <bob.j.paauwe@intel.com>
---
 drivers/acpi/acpica/tbinstal.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/acpi/acpica/tbinstal.c b/drivers/acpi/acpica/tbinstal.c
index 9bad45e..7fbc2b9 100644
--- a/drivers/acpi/acpica/tbinstal.c
+++ b/drivers/acpi/acpica/tbinstal.c
@@ -346,7 +346,6 @@ acpi_tb_install_standard_table(acpi_physical_address address,
 				 */
 				acpi_tb_uninstall_table(&new_table_desc);
 				*table_index = i;
-				(void)acpi_ut_release_mutex(ACPI_MTX_TABLES);
 				return_ACPI_STATUS(AE_OK);
 			}
 		}
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] Acutally unload a table.
  2015-04-03 16:07 [PATCH 0/2] dynamic table unload fixes Bob Paauwe
  2015-04-03 16:07 ` [PATCH 1/2] Remove extra release mutex call Bob Paauwe
@ 2015-04-03 16:07 ` Bob Paauwe
  2015-04-07 11:58 ` [PATCH 0/2] dynamic table unload fixes Rafael J. Wysocki
  2 siblings, 0 replies; 4+ messages in thread
From: Bob Paauwe @ 2015-04-03 16:07 UTC (permalink / raw)
  To: linux-acpi; +Cc: Bob Paauwe

Instead of simply marking it as unloaded.  If a table is dynamically
loaded by a module and the module is then unloaded, the table is no
longer valid so it's best to make sure it is unloaded.

Signed-off-by: Bob Paauwe <bob.j.paauwe@intel.com>
---
 drivers/acpi/acpica/tbxfload.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/acpi/acpica/tbxfload.c b/drivers/acpi/acpica/tbxfload.c
index aadb300..ce75ca2 100644
--- a/drivers/acpi/acpica/tbxfload.c
+++ b/drivers/acpi/acpica/tbxfload.c
@@ -408,6 +408,7 @@ acpi_status acpi_unload_parent_table(acpi_handle object)
 
 		status = acpi_tb_release_owner_id(i);
 		acpi_tb_set_table_loaded_flag(i, FALSE);
+		acpi_tb_uninstall_table(&acpi_gbl_root_table_list.tables[i]);
 		break;
 	}
 
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] dynamic table unload fixes
  2015-04-03 16:07 [PATCH 0/2] dynamic table unload fixes Bob Paauwe
  2015-04-03 16:07 ` [PATCH 1/2] Remove extra release mutex call Bob Paauwe
  2015-04-03 16:07 ` [PATCH 2/2] Acutally unload a table Bob Paauwe
@ 2015-04-07 11:58 ` Rafael J. Wysocki
  2 siblings, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2015-04-07 11:58 UTC (permalink / raw)
  To: Bob Paauwe; +Cc: linux-acpi

On Friday, April 03, 2015 09:07:47 AM Bob Paauwe wrote:
> While trying to make use of dynamic tables as a way to provide driver
> initialization properties, I've encountered a couple of issues with the
> way dynamic tables are being handled.
> 
> The first patch appears to be a bug. There is a mutex release without
> a corresponding aquire. This extra release causes a mutex error message
> when a table is re-loaded after being unloaded.
> 
> The second patch actually unloads a table when table unload is called. 
> When a table is being dynamically loaded by a driver module and that
> driver module is unloaded, the memory for the table would typically be
> freed resulting in a table that is marked as unloaded but still pointing
> to that freed memory.  If the driver module is then re-loaded, the
> ACPI table reload function will attempt to access that freed memory when
> it does a table compare and results in a oops.
> 
> These patches solve the problems I've encountered but may not be the 
> proper way to solve.
> 
> Bob Paauwe (2):
>   Remove extra release mutex call.
>   Acutally unload a table.
> 
>  drivers/acpi/acpica/tbinstal.c | 1 -
>  drivers/acpi/acpica/tbxfload.c | 1 +
>  2 files changed, 1 insertion(+), 1 deletion(-)

This is ACPICA material.  Please *at* *least* CC it to the ACPICA maintainers
as per MAINTAINERS, but it really should be sent to the ACPICA list (and you
can CC linux-acpi if that is useful too).


-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-04-07 11:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-03 16:07 [PATCH 0/2] dynamic table unload fixes Bob Paauwe
2015-04-03 16:07 ` [PATCH 1/2] Remove extra release mutex call Bob Paauwe
2015-04-03 16:07 ` [PATCH 2/2] Acutally unload a table Bob Paauwe
2015-04-07 11:58 ` [PATCH 0/2] dynamic table unload fixes Rafael J. Wysocki

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.