public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Hansen <haveblue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
To: "S, Naveen B" <naveen.b.s-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	lhms
	<lhms-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>,
	Matthew E Tolentino
	<matthew.e.tolentino-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Subject: Re: [Lhms-devel] [PATCH] ACPI based Memory Hotplug Driver Patch
Date: Thu, 09 Sep 2004 08:50:47 -0700	[thread overview]
Message-ID: <1094745047.29990.62.camel@nighthawk> (raw)
In-Reply-To: <FEB6C4E97F6CAF41978FB2059D5454180F37E8-OkeUvhg1trkFyVwBAnZdSLfspsVTdybXVpNB7YpNyf8@public.gmane.org>

On Thu, 2004-09-09 at 03:54, S, Naveen B wrote:
> Attached is an ACPI based hot plug driver patch to support physical
> memory hotplug. This driver supports physical hotplug operation on
> memory, fields notifications from firmware and notifies the VM of the
> affected memory ranges.  The following patch is against kernel
> 2.6.8.1-mm3, and works with the current memory hotplug VM patches
> posted at: http://sprucegoose.sr71.net/patches.  This patch has been
> tested on real prototype hardware in the hot-add memory case. Hot
> remove feature is tested in an emulated environment (by overriding
> ACPI DSDT). 
> 
> Please review and consider for inclusion. 

Very cool!  A few comments below.

> +config ACPI_HOTPLUG_MEMORY
> +	tristate "Memory Hotplug"
> +	depends on ACPI
> +	depends on MEMORY_HOTPLUG
> +	default m
> +	help
> +	  This driver adds supports for ACPI Memory Hotplug.
>  endmenu
...
> +obj-$(CONFIG_ACPI_HOTPLUG_MEMORY)	+= memory.o

What does this end up naming the module?  If it ends up being memory.o,
you might want to think about making it something a bit more
descriptive.  Does it even need to be allowed to be a module, or is that
standard ACPI practice?

> +static int 
> +acpi_memory_disable_device(struct acpi_memory_device *mem_device) 
> +{
> +	int result;
> +
> +	ACPI_FUNCTION_TRACE("acpi_memory_disable_device");
> +
> +	/* 
> +	 * Ask the VM to offline this memory range.
> +	 * Note: Assume that this function returns zero on success 
> +	 */
> +	if (remove_memory(mem_device->start_addr,
> +		(mem_device->end_addr - mem_device->start_addr) + 1,
> +		mem_device->read_write_attribute)) {
> +		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Hot-Remove failed.\n"));
> +		return_VALUE(-EINVAL);	
> +	}
> +

How about actually passing up the value that remove_memory() gave back? 
Also, what's with the +1 on the size?

If it ends up that all of the callers of remove_memory() prefer to give
start and end addresses, we'll probably change the calling convention at
some point.  Whatever is most natural.

I think I'd slightly prefer something that looks more like this (same
thing goes for the add function): 

acpi_memory_disable_device(struct acpi_memory_device *mem_device) 
{
	int err;
	u64 start = mem_device->start_addr;
	u64 len = mem_device->end_addr - start + 1;
	unsigned long attr = mem_device->read_write_attribute;

	ACPI_FUNCTION_TRACE("acpi_memory_disable_device");

	/* 
	 * Ask the VM to offline this memory range.
	 */
	err = remove_memory(start, len, attr);

	if (err) {
		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Hot-Remove failed.\n"));
		return_VALUE(err);	
	}
...

Otherwise, this looks very self-contained which, since we've given up on
ACPI code looking nice, is all we can ask for. :)

Other than the add/remove_memory() calls does this have any real
interaction with any non-ACPI code that I overlooked?

-- Dave



-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM. 
Deadline: Sept. 13. Go here: http://sf.net/ppc_contest.php

  parent reply	other threads:[~2004-09-09 15:50 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-09 10:54 [PATCH] ACPI based Memory Hotplug Driver Patch S, Naveen B
     [not found] ` <FEB6C4E97F6CAF41978FB2059D5454180F37E8-OkeUvhg1trkFyVwBAnZdSLfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2004-09-09 13:11   ` Dmitry Torokhov
2004-09-09 15:50   ` Dave Hansen [this message]
2004-09-09 15:52   ` Bjorn Helgaas
2004-09-10 13:45   ` Keiichiro Tokunaga
     [not found]     ` <20040910224510.7f78b1b5.tokunaga.keiich-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2004-09-11  6:08       ` [Lhms-devel] " Hirokazu Takahashi
     [not found]         ` <20040911.150854.71102255.taka-jCdQPDEk3idL9jVzuh4AOg@public.gmane.org>
2004-09-11  7:14           ` Dave Hansen
2004-09-10 14:02   ` Keiichiro Tokunaga
     [not found]     ` <20040910230200.73eb0374.tokunaga.keiich-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2004-09-10 17:32       ` [Lhms-devel] " Dave Hansen
2004-09-13  8:23         ` Keiichiro Tokunaga
     [not found]           ` <20040913172318.791db349.tokunaga.keiich-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2004-09-13  8:41             ` Dave Hansen
2004-09-14  2:58               ` Keiichiro Tokunaga
     [not found]                 ` <20040914115844.1e12203d.tokunaga.keiich-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2004-09-14  4:11                   ` Dave Hansen
2004-09-14  9:29                     ` Keiichiro Tokunaga
     [not found]                       ` <20040914182956.49c9381d.tokunaga.keiich-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2004-09-14 17:12                         ` Dave Hansen
2004-09-15  0:08                           ` Keiichiro Tokunaga
     [not found]                             ` <20040915090827.7f86a54f.tokunaga.keiich-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2004-09-15  0:17                               ` Dave Hansen
2004-09-16  2:51                                 ` Keiichiro Tokunaga
2004-09-14 16:21                     ` Joel Schopp
2004-09-16 10:47       ` [PATCH] /sys/firmware/acpi/memory/ for showing info of ACPI memory object Keiichiro Tokunaga
     [not found]         ` <20040916194725.562b50f0.tokunaga.keiich-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2004-09-24  8:46           ` Keiichiro Tokunaga

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=1094745047.29990.62.camel@nighthawk \
    --to=haveblue-r/jw6+rmf7hqt0dzr+alfa@public.gmane.org \
    --cc=acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=lhms-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=matthew.e.tolentino-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=naveen.b.s-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox