lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 21 May 2013 12:59:13 +0200
From:	"Rafael J. Wysocki" <rjw@...k.pl>
To:	Xishi Qiu <qiuxishi@...wei.com>
Cc:	ACPI Devel Maling List <linux-acpi@...r.kernel.org>,
	LKML <linux-kernel@...r.kernel.org>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Toshi Kani <toshi.kani@...com>,
	Wen Congyang <wency@...fujitsu.com>,
	Tang Chen <tangchen@...fujitsu.com>,
	Yasuaki Ishimatsu <isimatu.yasuaki@...fujitsu.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Jiang Liu <liuj97@...il.com>,
	Vasilis Liaskovitis <vasilis.liaskovitis@...fitbricks.com>,
	linux-mm@...ck.org
Subject: Re: [PATCH 4/5] ACPI / scan: Add second pass of companion offlining to hot-remove code

On Tuesday, May 21, 2013 03:34:37 PM Xishi Qiu wrote:
> On 2013/5/19 7:34, Rafael J. Wysocki wrote:
> 
> > From: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
> > 
> > As indicated by comments in mm/memory_hotplug.c:remove_memory(),
> > if CONFIG_MEMCG is set, it may not be possible to offline all of the
> > memory blocks held by one module (FRU) in one pass (because one of
> > them may be used by the others to store page cgroup in that case
> > and that block has to be offlined before the other ones).
> > 
> > To handle that arguably corner case, add a second pass of companion
> > device offlining to acpi_scan_hot_remove() and make it ignore errors
> > returned in the first pass (and make it skip the second pass if the
> > first one is successful).
> > 
> > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
> > ---
> >  drivers/acpi/scan.c |   67 ++++++++++++++++++++++++++++++++++++++--------------
> >  1 file changed, 50 insertions(+), 17 deletions(-)
> > 
> > Index: linux-pm/drivers/acpi/scan.c
> > ===================================================================
> > --- linux-pm.orig/drivers/acpi/scan.c
> > +++ linux-pm/drivers/acpi/scan.c
> > @@ -131,6 +131,7 @@ static acpi_status acpi_bus_offline_comp
> >  {
> >  	struct acpi_device *device = NULL;
> >  	struct acpi_device_physical_node *pn;
> > +	bool second_pass = (bool)data;
> >  	acpi_status status = AE_OK;
> >  
> >  	if (acpi_bus_get_device(handle, &device))
> > @@ -141,15 +142,26 @@ static acpi_status acpi_bus_offline_comp
> >  	list_for_each_entry(pn, &device->physical_node_list, node) {
> >  		int ret;
> >  
> > +		if (second_pass) {
> > +			/* Skip devices offlined by the first pass. */
> > +			if (pn->put_online)
> 
> should it be "if (!pn->put_online)" ?

No, I don't think so.

pn->put_online set means that the device has been offlined by the first pass,
so we don't need to try it in the second one.

Thanks,
Rafael


> > +				continue;
> > +		} else {
> > +			pn->put_online = false;
> > +		}
> >  		ret = device_offline(pn->dev);
> >  		if (acpi_force_hot_remove)
> >  			continue;
> >  
> > -		if (ret < 0) {
> > -			status = AE_ERROR;
> > -			break;
> > +		if (ret >= 0) {
> > +			pn->put_online = !ret;
> > +		} else {
> > +			*ret_p = pn->dev;
> > +			if (second_pass) {
> > +				status = AE_ERROR;
> > +				break;
> > +			}
> >  		}
> > -		pn->put_online = !ret;
> >  	}
> >  
> >  	mutex_unlock(&device->physical_node_lock);
> 
> 
> 
-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ