* Re: [PATCH] radeonfb: Add quirk for the graphics adapter in some JSxx
From: Olaf Hering @ 2012-07-19 5:20 UTC (permalink / raw)
To: Jingoo Han, 'Tony Breeds'; +Cc: linux-fbdev, linuxppc-dev
In-Reply-To: <001201cd656b$b2794350$176bc9f0$%han@samsung.com>
On Thu, Jul 19, Jingoo Han wrote:
> On Thursday, July 19, 2012 1:49 AM, olaf@aepfle.de wrote:
> > From: Tony Breeds <tony@bakeyournoodle.com>
> >
> > These devices are set to 640x480 by firmware, switch them to 800x600@60
> > so that the graphical installer can run on remote console.
> >
> > Reported by IBM during SLES10 SP2 beta testing:
> >
> > https://bugzilla.novell.com/show_bug.cgi?id=461002
> > LTC50817
> >
> > Signed-off-by: Olaf Hering <olaf@aepfle.de>
>
> If the author is Tony Breeds, please add 'Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>'.
He provided the initial version of the change, but did not add his tag
back in 2009. Tony, perhaps you can do that now?
Olaf
^ permalink raw reply
* RE: [PATCH] radeonfb: Add quirk for the graphics adapter in some JSxx
From: Jingoo Han @ 2012-07-19 5:02 UTC (permalink / raw)
To: olaf, 'Benjamin Herrenschmidt'; +Cc: linuxppc-dev, linux-fbdev
In-Reply-To: <1342630144-16350-1-git-send-email-olaf@aepfle.de>
On Thursday, July 19, 2012 1:49 AM, olaf@aepfle.de wrote:
> From: Tony Breeds <tony@bakeyournoodle.com>
>
> These devices are set to 640x480 by firmware, switch them to 800x600@60
> so that the graphical installer can run on remote console.
>
> Reported by IBM during SLES10 SP2 beta testing:
>
> https://bugzilla.novell.com/show_bug.cgi?id=461002
> LTC50817
>
> Signed-off-by: Olaf Hering <olaf@aepfle.de>
If the author is Tony Breeds, please add 'Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>'.
Best regards,
Jingoo Han
>
> diff --git a/drivers/video/aty/radeon_monitor.c b/drivers/video/aty/radeon_monitor.c
> index 9261c91..5c23eac 100644
> --- a/drivers/video/aty/radeon_monitor.c
> +++ b/drivers/video/aty/radeon_monitor.c
> @@ -730,6 +730,25 @@ static void radeon_videomode_to_var(struct fb_var_screeninfo *var,
> var->vmode = mode->vmode;
> }
>
> +#ifdef CONFIG_PPC_PSERIES
> +static int is_powerblade(const char *model)
> +{
> + struct device_node *root;
> + const char* cp;
> + int len, l, rc = 0;
> +
> + root = of_find_node_by_path("/");
> + if (root && model) {
> + l = strlen(model);
> + cp = of_get_property(root, "model", &len);
> + if (cp)
> + rc = memcmp(model, cp, min(len, l)) == 0;
> + of_node_put(root);
> + }
> + return rc;
> +}
> +#endif
> +
> /*
> * Build the modedb for head 1 (head 2 will come later), check panel infos
> * from either BIOS or EDID, and pick up the default mode
> @@ -865,6 +884,22 @@ void __devinit radeon_check_modes(struct radeonfb_info *rinfo, const char *mode_
> has_default_mode = 1;
> }
>
> +#ifdef CONFIG_PPC_PSERIES
> + if (!has_default_mode && (
> + is_powerblade("IBM,8842") || /* JS20 */
> + is_powerblade("IBM,8844") || /* JS21 */
> + is_powerblade("IBM,7998") || /* JS12/JS21/JS22 */
> + is_powerblade("IBM,0792") || /* QS21 */
> + is_powerblade("IBM,0793") /* QS22 */
> + )) {
> + printk("Falling back to 800x600 on JSxx hardware\n");
> + if (fb_find_mode(&info->var, info, "800x600@60",
> + info->monspecs.modedb,
> + info->monspecs.modedb_len, NULL, 8) != 0)
> + has_default_mode = 1;
> + }
> +#endif
> +
> /*
> * Still no mode, let's pick up a default from the db
> */
> --
> 1.7.10.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* [PATCH] powerpc/ftrace: Trace function graph entry before updating index
From: Steven Rostedt @ 2012-07-18 22:35 UTC (permalink / raw)
To: LKML, linuxppc-dev; +Cc: Paul Mackerras, Colin Cross
As Colin Cross ported my x86 change to ARM, he also pointed out that
powerpc is also behind in this fix.
The commit 722b3c746953 "ftrace/graph: Trace function entry before
updating index" fixes an issue with function graph tracing for x86,
where if the called entry function decides not to trace interrupts, it
can fail the check if an interrupt comes in just after the
curr_ret_stack is updated.
The solution is to call the entry function first, then update the
curr_ret_stack if the entry function wants to be traced.
Cc: Colin Cross <ccross@android.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
diff --git a/arch/powerpc/kernel/ftrace.c b/arch/powerpc/kernel/ftrace.c
index 91b46b7..1fb7856 100644
--- a/arch/powerpc/kernel/ftrace.c
+++ b/arch/powerpc/kernel/ftrace.c
@@ -630,18 +630,17 @@ void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr)
return;
}
- if (ftrace_push_return_trace(old, self_addr, &trace.depth, 0) == -EBUSY) {
- *parent = old;
- return;
- }
-
trace.func = self_addr;
+ trace.depth = current->curr_ret_stack + 1;
/* Only trace if the calling function expects to */
if (!ftrace_graph_entry(&trace)) {
- current->curr_ret_stack--;
*parent = old;
+ return;
}
+
+ if (ftrace_push_return_trace(old, self_addr, &trace.depth, 0) == -EBUSY)
+ *parent = old;
}
#endif /* CONFIG_FUNCTION_GRAPH_TRACER */
^ permalink raw reply related
* Re: [PATCH] MIPS: fix bug.h MIPS build regression
From: Andrew Morton @ 2012-07-18 21:07 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Linux MIPS Mailing List, Linux-sh list, linux-kernel,
Ralf Baechle, David Daney, Linuxppc-dev, Paul Mundt, Chris Zankel,
Yoichi Yuasa
In-Reply-To: <CAMuHMdWW=sAff-iw0EiHaejr34Z4u_X7w3nHf6Tfo-c2f=Qijg@mail.gmail.com>
On Wed, 18 Jul 2012 10:35:46 +0200
Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> On Mon, Jul 16, 2012 at 9:27 PM, Geert Uytterhoeven
> <geert@linux-m68k.org> wrote:
> > On Fri, Jun 22, 2012 at 7:54 PM, David Daney <ddaney@caviumnetworks.com> wrote:
> >> On 06/20/2012 09:12 AM, Ralf Baechle wrote:
> >>>
> >>> On Wed, Jun 20, 2012 at 03:27:59PM +0900, Yoichi Yuasa wrote:
> >>>
> >>>> Commit: 3777808873b0c49c5cf27e44c948dfb02675d578 breaks all MIPS builds.
> >>>
> >>>
> >>> Thanks, fix applied.
> >>>
> >>
> >> Where was it applied?
> >>
> >> It doesn't show up in linux-next for 20120622, which is where it is needed.
> >
> > It's also desperately needed in mainline for 3.5.
> >
> > Ralf?
>
> Andrew? This prevents any green MIPS builds.
>
The patch is already in linux-next via Ralf's tree.
Perhaps he nodded off - I'll send it at Linus right now.
^ permalink raw reply
* [PATCH] scsi/ibmvscsi: add module alias for ibmvscsic
From: olaf @ 2012-07-18 16:49 UTC (permalink / raw)
To: Benjamin Herrenschmidt, James E.J. Bottomley
Cc: linuxppc-dev, Olaf Hering, linux-scsi
From: Olaf Hering <olaf@aepfle.de>
The driver is named ibmvscsic, at runtime it its name is advertised as
ibmvscsi. For this reason mkinitrd wont pickup the driver properly.
Reported by IBM during SLES11 beta testing:
https://bugzilla.novell.com/show_bug.cgi?id=459933
LTC50724
Signed-off-by: Olaf Hering <olaf@aepfle.de>
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c
index 3a6c474..e580aa4 100644
--- a/drivers/scsi/ibmvscsi/ibmvscsi.c
+++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
@@ -100,6 +100,9 @@ static struct scsi_transport_template *ibmvscsi_transport_template;
static struct ibmvscsi_ops *ibmvscsi_ops;
+/* The driver is named ibmvscsic, map ibmvscsi to module name */
+#define IBMVSCSI_NAME "ibmvscsi"
+MODULE_ALIAS(IBMVSCSI_NAME);
MODULE_DESCRIPTION("IBM Virtual SCSI");
MODULE_AUTHOR("Dave Boutcher");
MODULE_LICENSE("GPL");
@@ -1796,7 +1799,7 @@ static struct device_attribute *ibmvscsi_attrs[] = {
static struct scsi_host_template driver_template = {
.module = THIS_MODULE,
.name = "IBM POWER Virtual SCSI Adapter " IBMVSCSI_VERSION,
- .proc_name = "ibmvscsi",
+ .proc_name = IBMVSCSI_NAME,
.queuecommand = ibmvscsi_queuecommand,
.eh_abort_handler = ibmvscsi_eh_abort_handler,
.eh_device_reset_handler = ibmvscsi_eh_device_reset_handler,
@@ -1936,7 +1939,7 @@ static int ibmvscsi_probe(struct vio_dev *vdev, const struct vio_device_id *id)
}
hostdata->work_thread = kthread_run(ibmvscsi_work, hostdata, "%s_%d",
- "ibmvscsi", host->host_no);
+ IBMVSCSI_NAME, host->host_no);
if (IS_ERR(hostdata->work_thread)) {
dev_err(&vdev->dev, "couldn't initialize kthread. rc=%ld\n",
@@ -2061,7 +2064,7 @@ static struct vio_driver ibmvscsi_driver = {
.probe = ibmvscsi_probe,
.remove = ibmvscsi_remove,
.get_desired_dma = ibmvscsi_get_desired_dma,
- .name = "ibmvscsi",
+ .name = IBMVSCSI_NAME,
.pm = &ibmvscsi_pm_ops,
};
--
1.7.10.4
^ permalink raw reply related
* [PATCH] scsi/ibmvscsi: /sys/class/scsi_host/hostX/config doesn't show any information
From: olaf @ 2012-07-18 16:49 UTC (permalink / raw)
To: Benjamin Herrenschmidt, James E.J. Bottomley
Cc: linuxppc-dev, Olaf Hering, Linda Xie, linux-scsi
From: Linda Xie <lxiep@us.ibm.com>
Expected result:
It should show something like this:
x1521p4:~ # cat /sys/class/scsi_host/host1/config
PARTITIONNAME='x1521p4'
NWSDNAME='X1521P4'
HOSTNAME='X1521P4'
DOMAINNAME='RCHLAND.IBM.COM'
NAMESERVERS='9.10.244.100 9.10.244.200'
Actual result:
x1521p4:~ # cat /sys/class/scsi_host/host0/config
x1521p4:~ #
This patch changes the size of the buffer used for transfering config
data to 4K. It was tested against 2.6.19-rc2 tree.
Reported by IBM during SLES11 beta testing:
https://bugzilla.novell.com/show_bug.cgi?id=439970
LTC49349
Signed-off-by: Olaf Hering <olaf@aepfle.de>
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c
index e580aa4..1513ca8 100644
--- a/drivers/scsi/ibmvscsi/ibmvscsi.c
+++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
@@ -93,6 +93,8 @@ static int max_requests = IBMVSCSI_MAX_REQUESTS_DEFAULT;
static int max_events = IBMVSCSI_MAX_REQUESTS_DEFAULT + 2;
static int fast_fail = 1;
static int client_reserve = 1;
+/* host data buffer size */
+#define HOST_BUFFER_SIZE 4096
static struct scsi_transport_template *ibmvscsi_transport_template;
@@ -1666,7 +1668,7 @@ static ssize_t show_host_srp_version(struct device *dev,
struct ibmvscsi_host_data *hostdata = shost_priv(shost);
int len;
- len = snprintf(buf, PAGE_SIZE, "%s\n",
+ len = snprintf(buf, HOST_BUFFER_SIZE, "%s\n",
hostdata->madapter_info.srp_version);
return len;
}
@@ -1687,7 +1689,7 @@ static ssize_t show_host_partition_name(struct device *dev,
struct ibmvscsi_host_data *hostdata = shost_priv(shost);
int len;
- len = snprintf(buf, PAGE_SIZE, "%s\n",
+ len = snprintf(buf, HOST_BUFFER_SIZE, "%s\n",
hostdata->madapter_info.partition_name);
return len;
}
@@ -1708,7 +1710,7 @@ static ssize_t show_host_partition_number(struct device *dev,
struct ibmvscsi_host_data *hostdata = shost_priv(shost);
int len;
- len = snprintf(buf, PAGE_SIZE, "%d\n",
+ len = snprintf(buf, HOST_BUFFER_SIZE, "%d\n",
hostdata->madapter_info.partition_number);
return len;
}
@@ -1728,7 +1730,7 @@ static ssize_t show_host_mad_version(struct device *dev,
struct ibmvscsi_host_data *hostdata = shost_priv(shost);
int len;
- len = snprintf(buf, PAGE_SIZE, "%d\n",
+ len = snprintf(buf, HOST_BUFFER_SIZE, "%d\n",
hostdata->madapter_info.mad_version);
return len;
}
@@ -1748,7 +1750,7 @@ static ssize_t show_host_os_type(struct device *dev,
struct ibmvscsi_host_data *hostdata = shost_priv(shost);
int len;
- len = snprintf(buf, PAGE_SIZE, "%d\n", hostdata->madapter_info.os_type);
+ len = snprintf(buf, HOST_BUFFER_SIZE, "%d\n", hostdata->madapter_info.os_type);
return len;
}
@@ -1767,7 +1769,7 @@ static ssize_t show_host_config(struct device *dev,
struct ibmvscsi_host_data *hostdata = shost_priv(shost);
/* returns null-terminated host config data */
- if (ibmvscsi_do_host_config(hostdata, buf, PAGE_SIZE) == 0)
+ if (ibmvscsi_do_host_config(hostdata, buf, HOST_BUFFER_SIZE) == 0)
return strlen(buf);
else
return 0;
--
1.7.10.4
^ permalink raw reply related
* [PATCH] radeonfb: Add quirk for the graphics adapter in some JSxx
From: olaf @ 2012-07-18 16:49 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc-dev, linux-fbdev, Olaf Hering
From: Tony Breeds <tony@bakeyournoodle.com>
These devices are set to 640x480 by firmware, switch them to 800x600@60
so that the graphical installer can run on remote console.
Reported by IBM during SLES10 SP2 beta testing:
https://bugzilla.novell.com/show_bug.cgi?id=461002
LTC50817
Signed-off-by: Olaf Hering <olaf@aepfle.de>
diff --git a/drivers/video/aty/radeon_monitor.c b/drivers/video/aty/radeon_monitor.c
index 9261c91..5c23eac 100644
--- a/drivers/video/aty/radeon_monitor.c
+++ b/drivers/video/aty/radeon_monitor.c
@@ -730,6 +730,25 @@ static void radeon_videomode_to_var(struct fb_var_screeninfo *var,
var->vmode = mode->vmode;
}
+#ifdef CONFIG_PPC_PSERIES
+static int is_powerblade(const char *model)
+{
+ struct device_node *root;
+ const char* cp;
+ int len, l, rc = 0;
+
+ root = of_find_node_by_path("/");
+ if (root && model) {
+ l = strlen(model);
+ cp = of_get_property(root, "model", &len);
+ if (cp)
+ rc = memcmp(model, cp, min(len, l)) == 0;
+ of_node_put(root);
+ }
+ return rc;
+}
+#endif
+
/*
* Build the modedb for head 1 (head 2 will come later), check panel infos
* from either BIOS or EDID, and pick up the default mode
@@ -865,6 +884,22 @@ void __devinit radeon_check_modes(struct radeonfb_info *rinfo, const char *mode_
has_default_mode = 1;
}
+#ifdef CONFIG_PPC_PSERIES
+ if (!has_default_mode && (
+ is_powerblade("IBM,8842") || /* JS20 */
+ is_powerblade("IBM,8844") || /* JS21 */
+ is_powerblade("IBM,7998") || /* JS12/JS21/JS22 */
+ is_powerblade("IBM,0792") || /* QS21 */
+ is_powerblade("IBM,0793") /* QS22 */
+ )) {
+ printk("Falling back to 800x600 on JSxx hardware\n");
+ if (fb_find_mode(&info->var, info, "800x600@60",
+ info->monspecs.modedb,
+ info->monspecs.modedb_len, NULL, 8) != 0)
+ has_default_mode = 1;
+ }
+#endif
+
/*
* Still no mode, let's pick up a default from the db
*/
--
1.7.10.4
^ permalink raw reply related
* Re: [PATCH 05/15] pci: resource assignment based on p2p alignment
From: Bjorn Helgaas @ 2012-07-18 16:59 UTC (permalink / raw)
To: Ram Pai; +Cc: linuxppc-dev, yinghai, Gavin Shan, linux-pci
In-Reply-To: <20120718042512.GA2375@ram-ThinkPad-T61>
On Tue, Jul 17, 2012 at 10:25 PM, Ram Pai <linuxram@us.ibm.com> wrote:
> On Tue, Jul 17, 2012 at 11:14:51AM -0600, Bjorn Helgaas wrote:
>> On Tue, Jul 17, 2012 at 4:38 AM, Benjamin Herrenschmidt
>> <benh@kernel.crashing.org> wrote:
>> > On Tue, 2012-07-17 at 18:03 +0800, Ram Pai wrote:
>> >> Lets say we passed that 'type' flag to size the minimum
>> >> alignment constraints for that b_res. And window_alignment(bus,
>> >> type) of your platform used that 'type' information to
>> >> determine whether to use the alignment constraints of 32-bit
>> >> window or 64-bit window.
>> >>
>> >> However, later when the b_res is actually allocated a resource,
>> >> the pci_assign_resource() has no idea whether to allocate 32-bit
>> >> window resource or 64-bit window resource, because the 'type'
>> >> information is not captured anywhere in b_res.
>> >>
>> >> You would basically have a disconnect between what is sized and
>> >> what is allocated. Unless offcourse you pass that 'type' to
>> >> the b_res->flags, which is currently not the case.
>> >
>> > Right, we ideally would need the core to query the alignment once per
>> > "apertures" it tries as a candidate to allocate a given resource... but
>> > that's for later.
>> >
>> > For now we can probably live with giving out the max of the minimum
>> > alignment we support for M64 and our M32 segment size.
>>
>> We already know the aperture we're proposing to allocate from (the
>> result of find_free_bus_resource()), don't we? What if we passed it
>> to pcibios_window_alignment() along with the struct pci_bus *, e.g.:
>>
>> resource_size_t pcibios_window_alignment(struct pci_bus *bus, struct
>> resource *window)
>
> Hmm..'struct resource *window' may not yet know which aperature it is
> allocated from. Will it? We are still in the sizing process, the allocation will
> be done much later.
Of course, you're absolutely right; I had this backwards. In
pbus_size_io/mem(), we do "b_res = find_free_bus_resource()", so b_res
is a bus resource that matches the desired type (IO/MEM). This
resource represents an aperture of the upstream bridge leading to the
bus. I was thinking that b_res->start would contain address
information that the arch could use to decide alignment.
But at this point, in pbus_size_io/mem(), we set "b_res->start =
min_align", so obviously b_res contains no information about the
window base that will eventually be assigned. I think b_res is
basically the *container* into which we'll eventually put the P2P
aperture start/end, but here, we're using that container to hold the
information about the size and alignment we need for that aperture.
The fact that we deal with alignment in pbus_size_mem() and again in
__pci_assign_resource() (via pcibios_align_resource) is confusing to
me -- I don't have a clear idea of what sorts of alignment are done in
each place. Could this powerpc alignment be done in
pcibios_align_resource()? We do have the actual proposed address
there, as well as the pci_dev.
Bjorn
^ permalink raw reply
* Re: [PATCH] of: require a match on all fields of of_device_id
From: Scott Wood @ 2012-07-18 16:04 UTC (permalink / raw)
To: Rob Herring; +Cc: devicetree-discuss, Thierry Reding, linuxppc-dev
In-Reply-To: <50062199.7090904@gmail.com>
On 07/17/2012 09:38 PM, Rob Herring wrote:
> On 07/17/2012 08:11 PM, Scott Wood wrote:
>> Commit 107a84e61cdd3406c842a0e4be7efffd3a05dba6 ("of: match by compatible
>> property first") breaks the gianfar ethernet driver found on various
>> Freescale PPC chips.
>
> You do know this is reverted, right?
No, I didn't. I got it via Kumar's next branch, and saw that it was
still in your fixes-for-grant branch, and didn't see any revert-related
e-mail activity on the devicetree-discuss list about it. I now see that
it was reverted directly in Linus's tree (I didn't see either the
original or the revert in Linus's tree when I checked, but apparently I
hadn't fetched that as recently as I thought).
> Here's my fix (untested) which is a bit simpler. I'm assuming if we care
> about which compatible string we are matching to, then we require name
> and type are blank and we only care about compatible strings.
Any particular reason for making that assumption? We should be avoiding
the need for .name or .type matching in new bindings, but this seems
like unnecessarily inconsistent behavior.
-Scott
^ permalink raw reply
* Re: [PATCH] mlx4_en: map entire pages to increase throughput
From: Or Gerlitz @ 2012-07-18 14:59 UTC (permalink / raw)
To: Thadeu Lima de Souza Cascardo, Yevgeny Petrilin
Cc: Or Gerlitz, netdev@vger.kernel.org, Rick Jones,
amirv@mellanox.com, leitao@linux.vnet.ibm.com,
klebers@linux.vnet.ibm.com, anton@samba.org,
brking@linux.vnet.ibm.com, linuxppc-dev@lists.ozlabs.org,
davem@davemloft.net
In-Reply-To: <20120716205708.GB16137@oc1711230544.ibm.com>
On 7/16/2012 11:57 PM, Thadeu Lima de Souza Cascardo wrote:
> On Mon, Jul 16, 2012 at 11:43:33PM +0300, Or Gerlitz wrote:
>>
>>
>> TCP_STREAM from this setup before the patch would be good to know as well
>>
>
> Does the stream test that I did with uperf using messages of 64000 bytes fit?
netperf/TCP_STREAM is very common and it would help to better compare
the numbers
you get on your systems before/after the patch which runs done here. As
for review for
the patch itself and the related discussion, Yevgeny Petrilin should be
looking on your
patch, he'll be in by early next week.
Or.
^ permalink raw reply
* Re: [PATCH v4 3/13] memory-hotplug : check whether memory is present or not
From: Wen Congyang @ 2012-07-18 10:56 UTC (permalink / raw)
To: Yasuaki Ishimatsu
Cc: len.brown, linux-acpi, linux-kernel, linux-mm, paulus,
minchan.kim, kosaki.motohiro, rientjes, cl, linuxppc-dev, akpm,
liuj97
In-Reply-To: <50068AE9.3050804@jp.fujitsu.com>
At 07/18/2012 06:07 PM, Yasuaki Ishimatsu Wrote:
> If system supports memory hot-remove, online_pages() may online removed pages.
> So online_pages() need to check whether onlining pages are present or not.
>
> CC: David Rientjes <rientjes@google.com>
> CC: Jiang Liu <liuj97@gmail.com>
> CC: Len Brown <len.brown@intel.com>
> CC: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> CC: Paul Mackerras <paulus@samba.org>
> CC: Christoph Lameter <cl@linux.com>
> Cc: Minchan Kim <minchan.kim@gmail.com>
> CC: Andrew Morton <akpm@linux-foundation.org>
> CC: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
> CC: Wen Congyang <wency@cn.fujitsu.com>
> Signed-off-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
>
> ---
> include/linux/mmzone.h | 21 +++++++++++++++++++++
> mm/memory_hotplug.c | 13 +++++++++++++
> 2 files changed, 34 insertions(+)
>
> Index: linux-3.5-rc6/include/linux/mmzone.h
> ===================================================================
> --- linux-3.5-rc6.orig/include/linux/mmzone.h 2012-07-08 09:23:56.000000000 +0900
> +++ linux-3.5-rc6/include/linux/mmzone.h 2012-07-17 16:10:21.588186145 +0900
> @@ -1168,6 +1168,27 @@ void sparse_init(void);
> #define sparse_index_init(_sec, _nid) do {} while (0)
> #endif /* CONFIG_SPARSEMEM */
>
> +#ifdef CONFIG_SPARSEMEM
> +static inline int pfns_present(unsigned long pfn, unsigned long nr_pages)
> +{
> + int i;
> + for (i = 0; i < nr_pages; i++) {
> + if (pfn_present(pfn + 1))
> + continue;
> + else {
> + unlock_memory_hotplug();
> + return -EINVAL;
> + }
> + }
> + return 0;
> +}
> +#else
> +static inline int pfns_present(unsigned long pfn, unsigned long nr_pages)
> +{
> + return 0;
> +}
> +#endif /* CONFIG_SPARSEMEM*/
> +
> #ifdef CONFIG_NODES_SPAN_OTHER_NODES
> bool early_pfn_in_nid(unsigned long pfn, int nid);
> #else
> Index: linux-3.5-rc6/mm/memory_hotplug.c
> ===================================================================
> --- linux-3.5-rc6.orig/mm/memory_hotplug.c 2012-07-17 14:26:40.000000000 +0900
> +++ linux-3.5-rc6/mm/memory_hotplug.c 2012-07-17 16:09:50.070580170 +0900
> @@ -467,6 +467,19 @@ int __ref online_pages(unsigned long pfn
> struct memory_notify arg;
>
> lock_memory_hotplug();
> + /*
> + * If system supports memory hot-remove, the memory may have been
> + * removed. So we check whether the memory has been removed or not.
> + *
> + * Note: When CONFIG_SPARSEMEM is defined, pfns_present() become
> + * effective. If CONFIG_SPARSEMEM is not defined, pfns_present()
> + * always returns 0.
> + */
There is one space before tab in the comment.
Thanks
Wen Congyang
> + ret = pfns_present(pfn, nr_pages);
> + if (ret) {
> + unlock_memory_hotplug();
> + return ret;
> + }
> arg.start_pfn = pfn;
> arg.nr_pages = nr_pages;
> arg.status_change_nid = -1;
>
>
^ permalink raw reply
* Re: [RFC PATCH v4 4/13] memory-hotplug : remove /sys/firmware/memmap/X sysfs
From: Yasuaki Ishimatsu @ 2012-07-18 10:51 UTC (permalink / raw)
To: Wen Congyang
Cc: len.brown, linux-acpi, linux-kernel, linux-mm, paulus,
minchan.kim, kosaki.motohiro, rientjes, cl, linuxppc-dev, akpm,
liuj97
In-Reply-To: <500690E0.40204@cn.fujitsu.com>
Hi Wen,
2012/07/18 19:33, Wen Congyang wrote:
> At 07/18/2012 06:09 PM, Yasuaki Ishimatsu Wrote:
>> When (hot)adding memory into system, /sys/firmware/memmap/X/{end, start, type}
>> sysfs files are created. But there is no code to remove these files. The patch
>> implements the function to remove them.
>>
>> Note : The code does not free firmware_map_entry since there is no way to free
>> memory which is allocated by bootmem.
>>
>> CC: David Rientjes <rientjes@google.com>
>> CC: Jiang Liu <liuj97@gmail.com>
>> CC: Len Brown <len.brown@intel.com>
>> CC: Benjamin Herrenschmidt <benh@kernel.crashing.org>
>> CC: Paul Mackerras <paulus@samba.org>
>> CC: Christoph Lameter <cl@linux.com>
>> Cc: Minchan Kim <minchan.kim@gmail.com>
>> CC: Andrew Morton <akpm@linux-foundation.org>
>> CC: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
>> CC: Wen Congyang <wency@cn.fujitsu.com>
>> Signed-off-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
>>
>> ---
>> drivers/firmware/memmap.c | 78 ++++++++++++++++++++++++++++++++++++++++++-
>> include/linux/firmware-map.h | 6 +++
>> mm/memory_hotplug.c | 9 +++-
>> 3 files changed, 90 insertions(+), 3 deletions(-)
>>
>> Index: linux-3.5-rc6/mm/memory_hotplug.c
>> ===================================================================
>> --- linux-3.5-rc6.orig/mm/memory_hotplug.c 2012-07-18 17:20:05.670024283 +0900
>> +++ linux-3.5-rc6/mm/memory_hotplug.c 2012-07-18 17:51:03.933189930 +0900
>> @@ -1012,9 +1012,9 @@ int offline_memory(u64 start, u64 size)
>> return offline_pages(start_pfn, end_pfn, 120 * HZ);
>> }
>>
>> -int remove_memory(int nid, u64 start, u64 size)
>> +int __ref remove_memory(int nid, u64 start, u64 size)
>> {
>> - int ret = -EBUSY;
>> + int ret = 0;
>> lock_memory_hotplug();
>> /*
>> * The memory might become online by other task, even if you offine it.
>> @@ -1025,8 +1025,13 @@ int remove_memory(int nid, u64 start, u6
>> "because the memmory range is online\n",
>> start, start + size);
>> ret = -EAGAIN;
>> + goto out;
>> }
>>
>> + /* remove memmap entry */
>> + firmware_map_remove(start, start + size, "System RAM");
>> +
>> +out:
>> unlock_memory_hotplug();
>> return ret;
>>
>> Index: linux-3.5-rc6/include/linux/firmware-map.h
>> ===================================================================
>> --- linux-3.5-rc6.orig/include/linux/firmware-map.h 2012-07-18 17:19:37.007382563 +0900
>> +++ linux-3.5-rc6/include/linux/firmware-map.h 2012-07-18 17:42:20.804730245 +0900
>> @@ -25,6 +25,7 @@
>>
>> int firmware_map_add_early(u64 start, u64 end, const char *type);
>> int firmware_map_add_hotplug(u64 start, u64 end, const char *type);
>> +int firmware_map_remove(u64 start, u64 end, const char *type);
>>
>> #else /* CONFIG_FIRMWARE_MEMMAP */
>>
>> @@ -38,6 +39,11 @@ static inline int firmware_map_add_hotpl
>> return 0;
>> }
>>
>> +static inline int firmware_map_remove(u64 start, u64 end, const char *type)
>> +{
>> + return 0;
>> +}
>> +
>> #endif /* CONFIG_FIRMWARE_MEMMAP */
>>
>> #endif /* _LINUX_FIRMWARE_MAP_H */
>> Index: linux-3.5-rc6/drivers/firmware/memmap.c
>> ===================================================================
>> --- linux-3.5-rc6.orig/drivers/firmware/memmap.c 2012-07-18 17:19:43.618300182 +0900
>> +++ linux-3.5-rc6/drivers/firmware/memmap.c 2012-07-18 17:42:20.846729721 +0900
>> @@ -21,6 +21,7 @@
>> #include <linux/types.h>
>> #include <linux/bootmem.h>
>> #include <linux/slab.h>
>> +#include <linux/mm.h>
>>
>> /*
>> * Data types ------------------------------------------------------------------
>> @@ -79,7 +80,22 @@ static const struct sysfs_ops memmap_att
>> .show = memmap_attr_show,
>> };
>>
>> +#define to_memmap_entry(obj) container_of(obj, struct firmware_map_entry, kobj)
>> +
>> +static void release_firmware_map_entry(struct kobject *kobj)
>> +{
>> + struct firmware_map_entry *entry = to_memmap_entry(kobj);
>> + struct page *page;
>> +
>> + page = virt_to_page(entry);
>> + if (PageSlab(page) || PageCompound(page))
>> + kfree(entry);
>
> IIRC, this function's implementation is changed. Why do you do it?
> If PageCompound(page), should we check page->first_page's flags?
I forgot to write the change to change log. Jiang and Christoph discussed
how to find the slab page:
- https://lkml.org/lkml/2012/7/6/333
Then, Christoph proposed this method. So I changed it.
Thanks,
Yasuaki Ishimatsu
>
> Thanks
> Wen Congyang
>
>> +
>> + /* There is no way to free memory allocated from bootmem*/
>> +}
>> +
>> static struct kobj_type memmap_ktype = {
>> + .release = release_firmware_map_entry,
>> .sysfs_ops = &memmap_attr_ops,
>> .default_attrs = def_attrs,
>> };
>> @@ -123,6 +139,16 @@ static int firmware_map_add_entry(u64 st
>> return 0;
>> }
>>
>> +/**
>> + * firmware_map_remove_entry() - Does the real work to remove a firmware
>> + * memmap entry.
>> + * @entry: removed entry.
>> + **/
>> +static inline void firmware_map_remove_entry(struct firmware_map_entry *entry)
>> +{
>> + list_del(&entry->list);
>> +}
>> +
>> /*
>> * Add memmap entry on sysfs
>> */
>> @@ -144,6 +170,31 @@ static int add_sysfs_fw_map_entry(struct
>> return 0;
>> }
>>
>> +/*
>> + * Remove memmap entry on sysfs
>> + */
>> +static inline void remove_sysfs_fw_map_entry(struct firmware_map_entry *entry)
>> +{
>> + kobject_put(&entry->kobj);
>> +}
>> +
>> +/*
>> + * Search memmap entry
>> + */
>> +
>> +struct firmware_map_entry * __meminit
>> +find_firmware_map_entry(u64 start, u64 end, const char *type)
>> +{
>> + struct firmware_map_entry *entry;
>> +
>> + list_for_each_entry(entry, &map_entries, list)
>> + if ((entry->start == start) && (entry->end == end) &&
>> + (!strcmp(entry->type, type)))
>> + return entry;
>> +
>> + return NULL;
>> +}
>> +
>> /**
>> * firmware_map_add_hotplug() - Adds a firmware mapping entry when we do
>> * memory hotplug.
>> @@ -196,6 +247,32 @@ int __init firmware_map_add_early(u64 st
>> return firmware_map_add_entry(start, end, type, entry);
>> }
>>
>> +/**
>> + * firmware_map_remove() - remove a firmware mapping entry
>> + * @start: Start of the memory range.
>> + * @end: End of the memory range.
>> + * @type: Type of the memory range.
>> + *
>> + * removes a firmware mapping entry.
>> + *
>> + * Returns 0 on success, or -EINVAL if no entry.
>> + **/
>> +int __meminit firmware_map_remove(u64 start, u64 end, const char *type)
>> +{
>> + struct firmware_map_entry *entry;
>> +
>> + entry = find_firmware_map_entry(start, end - 1, type);
>> + if (!entry)
>> + return -EINVAL;
>> +
>> + firmware_map_remove_entry(entry);
>> +
>> + /* remove the memmap entry */
>> + remove_sysfs_fw_map_entry(entry);
>> +
>> + return 0;
>> +}
>> +
>> /*
>> * Sysfs functions -------------------------------------------------------------
>> */
>> @@ -218,7 +295,6 @@ static ssize_t type_show(struct firmware
>> }
>>
>> #define to_memmap_attr(_attr) container_of(_attr, struct memmap_attribute, attr)
>> -#define to_memmap_entry(obj) container_of(obj, struct firmware_map_entry, kobj)
>>
>> static ssize_t memmap_attr_show(struct kobject *kobj,
>> struct attribute *attr, char *buf)
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>
>
^ permalink raw reply
* [PATCH RESEND] PPC Hardware Breakpoints: Fix incorrect pointer access
From: Naveen N. Rao @ 2012-07-18 10:38 UTC (permalink / raw)
To: fweisbec, benh, paulus, prasad.krishnan
Cc: linuxppc-dev, linux-kernel, emachado
In-Reply-To: <20120706113058.8600.30142.stgit@localhost.localdomain>
If arch_validate_hwbkpt_settings() fails, bp->ctx won't be valid and the
kernel panics. Add a check to fix this.
Reported-by: Edjunior Barbosa Machado <emachado@linux.vnet.ibm.com>
Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
---
arch/powerpc/kernel/hw_breakpoint.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/powerpc/kernel/hw_breakpoint.c b/arch/powerpc/kernel/hw_breakpoint.c
index 2bc0584..f3a82dd 100644
--- a/arch/powerpc/kernel/hw_breakpoint.c
+++ b/arch/powerpc/kernel/hw_breakpoint.c
@@ -111,7 +111,7 @@ void arch_unregister_hw_breakpoint(struct perf_event *bp)
* and the single_step_dabr_instruction(), then cleanup the breakpoint
* restoration variables to prevent dangling pointers.
*/
- if (bp->ctx->task)
+ if (bp->ctx && bp->ctx->task)
bp->ctx->task->thread.last_hit_ubp = NULL;
}
^ permalink raw reply related
* Re: [RFC PATCH v4 4/13] memory-hotplug : remove /sys/firmware/memmap/X sysfs
From: Wen Congyang @ 2012-07-18 10:33 UTC (permalink / raw)
To: Yasuaki Ishimatsu
Cc: len.brown, linux-acpi, linux-kernel, linux-mm, paulus,
minchan.kim, kosaki.motohiro, rientjes, cl, linuxppc-dev, akpm,
liuj97
In-Reply-To: <50068B54.5070907@jp.fujitsu.com>
At 07/18/2012 06:09 PM, Yasuaki Ishimatsu Wrote:
> When (hot)adding memory into system, /sys/firmware/memmap/X/{end, start, type}
> sysfs files are created. But there is no code to remove these files. The patch
> implements the function to remove them.
>
> Note : The code does not free firmware_map_entry since there is no way to free
> memory which is allocated by bootmem.
>
> CC: David Rientjes <rientjes@google.com>
> CC: Jiang Liu <liuj97@gmail.com>
> CC: Len Brown <len.brown@intel.com>
> CC: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> CC: Paul Mackerras <paulus@samba.org>
> CC: Christoph Lameter <cl@linux.com>
> Cc: Minchan Kim <minchan.kim@gmail.com>
> CC: Andrew Morton <akpm@linux-foundation.org>
> CC: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
> CC: Wen Congyang <wency@cn.fujitsu.com>
> Signed-off-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
>
> ---
> drivers/firmware/memmap.c | 78 ++++++++++++++++++++++++++++++++++++++++++-
> include/linux/firmware-map.h | 6 +++
> mm/memory_hotplug.c | 9 +++-
> 3 files changed, 90 insertions(+), 3 deletions(-)
>
> Index: linux-3.5-rc6/mm/memory_hotplug.c
> ===================================================================
> --- linux-3.5-rc6.orig/mm/memory_hotplug.c 2012-07-18 17:20:05.670024283 +0900
> +++ linux-3.5-rc6/mm/memory_hotplug.c 2012-07-18 17:51:03.933189930 +0900
> @@ -1012,9 +1012,9 @@ int offline_memory(u64 start, u64 size)
> return offline_pages(start_pfn, end_pfn, 120 * HZ);
> }
>
> -int remove_memory(int nid, u64 start, u64 size)
> +int __ref remove_memory(int nid, u64 start, u64 size)
> {
> - int ret = -EBUSY;
> + int ret = 0;
> lock_memory_hotplug();
> /*
> * The memory might become online by other task, even if you offine it.
> @@ -1025,8 +1025,13 @@ int remove_memory(int nid, u64 start, u6
> "because the memmory range is online\n",
> start, start + size);
> ret = -EAGAIN;
> + goto out;
> }
>
> + /* remove memmap entry */
> + firmware_map_remove(start, start + size, "System RAM");
> +
> +out:
> unlock_memory_hotplug();
> return ret;
>
> Index: linux-3.5-rc6/include/linux/firmware-map.h
> ===================================================================
> --- linux-3.5-rc6.orig/include/linux/firmware-map.h 2012-07-18 17:19:37.007382563 +0900
> +++ linux-3.5-rc6/include/linux/firmware-map.h 2012-07-18 17:42:20.804730245 +0900
> @@ -25,6 +25,7 @@
>
> int firmware_map_add_early(u64 start, u64 end, const char *type);
> int firmware_map_add_hotplug(u64 start, u64 end, const char *type);
> +int firmware_map_remove(u64 start, u64 end, const char *type);
>
> #else /* CONFIG_FIRMWARE_MEMMAP */
>
> @@ -38,6 +39,11 @@ static inline int firmware_map_add_hotpl
> return 0;
> }
>
> +static inline int firmware_map_remove(u64 start, u64 end, const char *type)
> +{
> + return 0;
> +}
> +
> #endif /* CONFIG_FIRMWARE_MEMMAP */
>
> #endif /* _LINUX_FIRMWARE_MAP_H */
> Index: linux-3.5-rc6/drivers/firmware/memmap.c
> ===================================================================
> --- linux-3.5-rc6.orig/drivers/firmware/memmap.c 2012-07-18 17:19:43.618300182 +0900
> +++ linux-3.5-rc6/drivers/firmware/memmap.c 2012-07-18 17:42:20.846729721 +0900
> @@ -21,6 +21,7 @@
> #include <linux/types.h>
> #include <linux/bootmem.h>
> #include <linux/slab.h>
> +#include <linux/mm.h>
>
> /*
> * Data types ------------------------------------------------------------------
> @@ -79,7 +80,22 @@ static const struct sysfs_ops memmap_att
> .show = memmap_attr_show,
> };
>
> +#define to_memmap_entry(obj) container_of(obj, struct firmware_map_entry, kobj)
> +
> +static void release_firmware_map_entry(struct kobject *kobj)
> +{
> + struct firmware_map_entry *entry = to_memmap_entry(kobj);
> + struct page *page;
> +
> + page = virt_to_page(entry);
> + if (PageSlab(page) || PageCompound(page))
> + kfree(entry);
IIRC, this function's implementation is changed. Why do you do it?
If PageCompound(page), should we check page->first_page's flags?
Thanks
Wen Congyang
> +
> + /* There is no way to free memory allocated from bootmem*/
> +}
> +
> static struct kobj_type memmap_ktype = {
> + .release = release_firmware_map_entry,
> .sysfs_ops = &memmap_attr_ops,
> .default_attrs = def_attrs,
> };
> @@ -123,6 +139,16 @@ static int firmware_map_add_entry(u64 st
> return 0;
> }
>
> +/**
> + * firmware_map_remove_entry() - Does the real work to remove a firmware
> + * memmap entry.
> + * @entry: removed entry.
> + **/
> +static inline void firmware_map_remove_entry(struct firmware_map_entry *entry)
> +{
> + list_del(&entry->list);
> +}
> +
> /*
> * Add memmap entry on sysfs
> */
> @@ -144,6 +170,31 @@ static int add_sysfs_fw_map_entry(struct
> return 0;
> }
>
> +/*
> + * Remove memmap entry on sysfs
> + */
> +static inline void remove_sysfs_fw_map_entry(struct firmware_map_entry *entry)
> +{
> + kobject_put(&entry->kobj);
> +}
> +
> +/*
> + * Search memmap entry
> + */
> +
> +struct firmware_map_entry * __meminit
> +find_firmware_map_entry(u64 start, u64 end, const char *type)
> +{
> + struct firmware_map_entry *entry;
> +
> + list_for_each_entry(entry, &map_entries, list)
> + if ((entry->start == start) && (entry->end == end) &&
> + (!strcmp(entry->type, type)))
> + return entry;
> +
> + return NULL;
> +}
> +
> /**
> * firmware_map_add_hotplug() - Adds a firmware mapping entry when we do
> * memory hotplug.
> @@ -196,6 +247,32 @@ int __init firmware_map_add_early(u64 st
> return firmware_map_add_entry(start, end, type, entry);
> }
>
> +/**
> + * firmware_map_remove() - remove a firmware mapping entry
> + * @start: Start of the memory range.
> + * @end: End of the memory range.
> + * @type: Type of the memory range.
> + *
> + * removes a firmware mapping entry.
> + *
> + * Returns 0 on success, or -EINVAL if no entry.
> + **/
> +int __meminit firmware_map_remove(u64 start, u64 end, const char *type)
> +{
> + struct firmware_map_entry *entry;
> +
> + entry = find_firmware_map_entry(start, end - 1, type);
> + if (!entry)
> + return -EINVAL;
> +
> + firmware_map_remove_entry(entry);
> +
> + /* remove the memmap entry */
> + remove_sysfs_fw_map_entry(entry);
> +
> + return 0;
> +}
> +
> /*
> * Sysfs functions -------------------------------------------------------------
> */
> @@ -218,7 +295,6 @@ static ssize_t type_show(struct firmware
> }
>
> #define to_memmap_attr(_attr) container_of(_attr, struct memmap_attribute, attr)
> -#define to_memmap_entry(obj) container_of(obj, struct firmware_map_entry, kobj)
>
> static ssize_t memmap_attr_show(struct kobject *kobj,
> struct attribute *attr, char *buf)
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply
* Re: [PATCH v4 3/13] memory-hotplug : check whether memory is present or not
From: Yasuaki Ishimatsu @ 2012-07-18 10:25 UTC (permalink / raw)
To: Wen Congyang
Cc: len.brown, linux-acpi, linux-kernel, linux-mm, paulus,
minchan.kim, kosaki.motohiro, rientjes, cl, linuxppc-dev, akpm,
liuj97
In-Reply-To: <50068F0A.20100@cn.fujitsu.com>
Hi Wen,
2012/07/18 19:25, Wen Congyang wrote:
> At 07/18/2012 06:07 PM, Yasuaki Ishimatsu Wrote:
>> If system supports memory hot-remove, online_pages() may online removed pages.
>> So online_pages() need to check whether onlining pages are present or not.
>>
>> CC: David Rientjes <rientjes@google.com>
>> CC: Jiang Liu <liuj97@gmail.com>
>> CC: Len Brown <len.brown@intel.com>
>> CC: Benjamin Herrenschmidt <benh@kernel.crashing.org>
>> CC: Paul Mackerras <paulus@samba.org>
>> CC: Christoph Lameter <cl@linux.com>
>> Cc: Minchan Kim <minchan.kim@gmail.com>
>> CC: Andrew Morton <akpm@linux-foundation.org>
>> CC: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
>> CC: Wen Congyang <wency@cn.fujitsu.com>
>> Signed-off-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
>>
>> ---
>> include/linux/mmzone.h | 21 +++++++++++++++++++++
>> mm/memory_hotplug.c | 13 +++++++++++++
>> 2 files changed, 34 insertions(+)
>>
>> Index: linux-3.5-rc6/include/linux/mmzone.h
>> ===================================================================
>> --- linux-3.5-rc6.orig/include/linux/mmzone.h 2012-07-08 09:23:56.000000000 +0900
>> +++ linux-3.5-rc6/include/linux/mmzone.h 2012-07-17 16:10:21.588186145 +0900
>> @@ -1168,6 +1168,27 @@ void sparse_init(void);
>> #define sparse_index_init(_sec, _nid) do {} while (0)
>> #endif /* CONFIG_SPARSEMEM */
>>
>> +#ifdef CONFIG_SPARSEMEM
>> +static inline int pfns_present(unsigned long pfn, unsigned long nr_pages)
>> +{
>> + int i;
>> + for (i = 0; i < nr_pages; i++) {
>> + if (pfn_present(pfn + 1))
>> + continue;
>> + else {
>> + unlock_memory_hotplug();
>
> Why do you unlock memory hotplug here? The caller will do it.
Ah, you are right. In this case, the function should only return -EINVAL.
Thansks,
Yasuaki Ishimatsu
>
> Thanks
> Wen Congyang
>
>> + return -EINVAL;
>> + }
>> + }
>> + return 0;
>> +}
>> +#else
>> +static inline int pfns_present(unsigned long pfn, unsigned long nr_pages)
>> +{
>> + return 0;
>> +}
>> +#endif /* CONFIG_SPARSEMEM*/
>> +
>> #ifdef CONFIG_NODES_SPAN_OTHER_NODES
>> bool early_pfn_in_nid(unsigned long pfn, int nid);
>> #else
>> Index: linux-3.5-rc6/mm/memory_hotplug.c
>> ===================================================================
>> --- linux-3.5-rc6.orig/mm/memory_hotplug.c 2012-07-17 14:26:40.000000000 +0900
>> +++ linux-3.5-rc6/mm/memory_hotplug.c 2012-07-17 16:09:50.070580170 +0900
>> @@ -467,6 +467,19 @@ int __ref online_pages(unsigned long pfn
>> struct memory_notify arg;
>>
>> lock_memory_hotplug();
>> + /*
>> + * If system supports memory hot-remove, the memory may have been
>> + * removed. So we check whether the memory has been removed or not.
>> + *
>> + * Note: When CONFIG_SPARSEMEM is defined, pfns_present() become
>> + * effective. If CONFIG_SPARSEMEM is not defined, pfns_present()
>> + * always returns 0.
>> + */
>> + ret = pfns_present(pfn, nr_pages);
>> + if (ret) {
>> + unlock_memory_hotplug();
>> + return ret;
>> + }
>> arg.start_pfn = pfn;
>> arg.nr_pages = nr_pages;
>> arg.status_change_nid = -1;
>>
>>
>
^ permalink raw reply
* Re: [PATCH v4 3/13] memory-hotplug : check whether memory is present or not
From: Wen Congyang @ 2012-07-18 10:25 UTC (permalink / raw)
To: Yasuaki Ishimatsu
Cc: len.brown, linux-acpi, linux-kernel, linux-mm, paulus,
minchan.kim, kosaki.motohiro, rientjes, cl, linuxppc-dev, akpm,
liuj97
In-Reply-To: <50068AE9.3050804@jp.fujitsu.com>
At 07/18/2012 06:07 PM, Yasuaki Ishimatsu Wrote:
> If system supports memory hot-remove, online_pages() may online removed pages.
> So online_pages() need to check whether onlining pages are present or not.
>
> CC: David Rientjes <rientjes@google.com>
> CC: Jiang Liu <liuj97@gmail.com>
> CC: Len Brown <len.brown@intel.com>
> CC: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> CC: Paul Mackerras <paulus@samba.org>
> CC: Christoph Lameter <cl@linux.com>
> Cc: Minchan Kim <minchan.kim@gmail.com>
> CC: Andrew Morton <akpm@linux-foundation.org>
> CC: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
> CC: Wen Congyang <wency@cn.fujitsu.com>
> Signed-off-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
>
> ---
> include/linux/mmzone.h | 21 +++++++++++++++++++++
> mm/memory_hotplug.c | 13 +++++++++++++
> 2 files changed, 34 insertions(+)
>
> Index: linux-3.5-rc6/include/linux/mmzone.h
> ===================================================================
> --- linux-3.5-rc6.orig/include/linux/mmzone.h 2012-07-08 09:23:56.000000000 +0900
> +++ linux-3.5-rc6/include/linux/mmzone.h 2012-07-17 16:10:21.588186145 +0900
> @@ -1168,6 +1168,27 @@ void sparse_init(void);
> #define sparse_index_init(_sec, _nid) do {} while (0)
> #endif /* CONFIG_SPARSEMEM */
>
> +#ifdef CONFIG_SPARSEMEM
> +static inline int pfns_present(unsigned long pfn, unsigned long nr_pages)
> +{
> + int i;
> + for (i = 0; i < nr_pages; i++) {
> + if (pfn_present(pfn + 1))
> + continue;
> + else {
> + unlock_memory_hotplug();
Why do you unlock memory hotplug here? The caller will do it.
Thanks
Wen Congyang
> + return -EINVAL;
> + }
> + }
> + return 0;
> +}
> +#else
> +static inline int pfns_present(unsigned long pfn, unsigned long nr_pages)
> +{
> + return 0;
> +}
> +#endif /* CONFIG_SPARSEMEM*/
> +
> #ifdef CONFIG_NODES_SPAN_OTHER_NODES
> bool early_pfn_in_nid(unsigned long pfn, int nid);
> #else
> Index: linux-3.5-rc6/mm/memory_hotplug.c
> ===================================================================
> --- linux-3.5-rc6.orig/mm/memory_hotplug.c 2012-07-17 14:26:40.000000000 +0900
> +++ linux-3.5-rc6/mm/memory_hotplug.c 2012-07-17 16:09:50.070580170 +0900
> @@ -467,6 +467,19 @@ int __ref online_pages(unsigned long pfn
> struct memory_notify arg;
>
> lock_memory_hotplug();
> + /*
> + * If system supports memory hot-remove, the memory may have been
> + * removed. So we check whether the memory has been removed or not.
> + *
> + * Note: When CONFIG_SPARSEMEM is defined, pfns_present() become
> + * effective. If CONFIG_SPARSEMEM is not defined, pfns_present()
> + * always returns 0.
> + */
> + ret = pfns_present(pfn, nr_pages);
> + if (ret) {
> + unlock_memory_hotplug();
> + return ret;
> + }
> arg.start_pfn = pfn;
> arg.nr_pages = nr_pages;
> arg.status_change_nid = -1;
>
>
^ permalink raw reply
* [RFC PATCH v4 13/13] memory-hotplug : remove sysfs file of node
From: Yasuaki Ishimatsu @ 2012-07-18 10:18 UTC (permalink / raw)
To: linux-mm, linux-kernel, linuxppc-dev, linux-acpi
Cc: len.brown, wency, paulus, minchan.kim, kosaki.motohiro, rientjes,
cl, akpm, liuj97
In-Reply-To: <50068974.1070409@jp.fujitsu.com>
The patch adds node_set_offline() and unregister_one_node() to remove_memory()
for removing sysfs file of node.
CC: David Rientjes <rientjes@google.com>
CC: Jiang Liu <liuj97@gmail.com>
CC: Len Brown <len.brown@intel.com>
CC: Benjamin Herrenschmidt <benh@kernel.crashing.org>
CC: Paul Mackerras <paulus@samba.org>
CC: Christoph Lameter <cl@linux.com>
Cc: Minchan Kim <minchan.kim@gmail.com>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
CC: Wen Congyang <wency@cn.fujitsu.com>
Signed-off-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
---
mm/memory_hotplug.c | 5 +++++
1 file changed, 5 insertions(+)
Index: linux-3.5-rc6/mm/memory_hotplug.c
===================================================================
--- linux-3.5-rc6.orig/mm/memory_hotplug.c 2012-07-18 18:25:11.036597977 +0900
+++ linux-3.5-rc6/mm/memory_hotplug.c 2012-07-18 18:25:54.860050109 +0900
@@ -1048,6 +1048,11 @@ int __ref remove_memory(int nid, u64 sta
/* remove memmap entry */
firmware_map_remove(start, start + size, "System RAM");
+ if (!node_present_pages(nid)) {
+ node_set_offline(nid);
+ unregister_one_node(nid);
+ }
+
__remove_pages(start >> PAGE_SHIFT, size >> PAGE_SHIFT);
out:
unlock_memory_hotplug();
^ permalink raw reply
* [RFC PATCH v4 12/13] memory-hotplug : add node_device_release
From: Yasuaki Ishimatsu @ 2012-07-18 10:17 UTC (permalink / raw)
To: linux-mm, linux-kernel, linuxppc-dev, linux-acpi
Cc: len.brown, wency, paulus, minchan.kim, kosaki.motohiro, rientjes,
cl, akpm, liuj97
In-Reply-To: <50068974.1070409@jp.fujitsu.com>
When calling unregister_node(), the function shows following message at
device_release().
Device 'node2' does not have a release() function, it is broken and must be
fixed.
So the patch implements node_device_release()
CC: David Rientjes <rientjes@google.com>
CC: Jiang Liu <liuj97@gmail.com>
CC: Len Brown <len.brown@intel.com>
CC: Benjamin Herrenschmidt <benh@kernel.crashing.org>
CC: Paul Mackerras <paulus@samba.org>
CC: Christoph Lameter <cl@linux.com>
Cc: Minchan Kim <minchan.kim@gmail.com>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
CC: Wen Congyang <wency@cn.fujitsu.com>
Signed-off-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
---
drivers/base/node.c | 7 +++++++
1 file changed, 7 insertions(+)
Index: linux-3.5-rc6/drivers/base/node.c
===================================================================
--- linux-3.5-rc6.orig/drivers/base/node.c 2012-07-18 18:24:29.191121066 +0900
+++ linux-3.5-rc6/drivers/base/node.c 2012-07-18 18:25:47.111146983 +0900
@@ -252,6 +252,12 @@ static inline void hugetlb_register_node
static inline void hugetlb_unregister_node(struct node *node) {}
#endif
+static void node_device_release(struct device *dev)
+{
+ struct node *node_dev = to_node(dev);
+
+ memset(node_dev, 0, sizeof(struct node));
+}
/*
* register_node - Setup a sysfs device for a node.
@@ -265,6 +271,7 @@ int register_node(struct node *node, int
node->dev.id = num;
node->dev.bus = &node_subsys;
+ node->dev.release = node_device_release;
error = device_register(&node->dev);
if (!error){
^ permalink raw reply
* [RFC PATCH v4 11/13] memory-hotplug : free memmap of sparse-vmemmap
From: Yasuaki Ishimatsu @ 2012-07-18 10:16 UTC (permalink / raw)
To: linux-mm, linux-kernel, linuxppc-dev, linux-acpi
Cc: len.brown, wency, paulus, minchan.kim, kosaki.motohiro, rientjes,
cl, akpm, liuj97
In-Reply-To: <50068974.1070409@jp.fujitsu.com>
All pages of virtual mapping in removed memory cannot be freed, since some pages
used as PGD/PUD includes not only removed memory but also other memory. So the
patch checks whether page can be freed or not.
How to check whether page can be freed or not?
1. When removing memory, the page structs of the revmoved memory are filled
with 0FD.
2. All page structs are filled with 0xFD on PT/PMD, PT/PMD can be cleared.
In this case, the page used as PT/PMD can be freed.
Applying patch, __remove_section() of CONFIG_SPARSEMEM_VMEMMAP is integrated
into one. So __remove_section() of CONFIG_SPARSEMEM_VMEMMAP is deleted.
CC: David Rientjes <rientjes@google.com>
CC: Jiang Liu <liuj97@gmail.com>
CC: Len Brown <len.brown@intel.com>
CC: Benjamin Herrenschmidt <benh@kernel.crashing.org>
CC: Paul Mackerras <paulus@samba.org>
CC: Christoph Lameter <cl@linux.com>
Cc: Minchan Kim <minchan.kim@gmail.com>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
CC: Wen Congyang <wency@cn.fujitsu.com>
Signed-off-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
---
arch/x86/mm/init_64.c | 121 ++++++++++++++++++++++++++++++++++++++++++++++++++
include/linux/mm.h | 2
mm/memory_hotplug.c | 19 -------
mm/sparse.c | 5 +-
4 files changed, 128 insertions(+), 19 deletions(-)
Index: linux-3.5-rc6/include/linux/mm.h
===================================================================
--- linux-3.5-rc6.orig/include/linux/mm.h 2012-07-18 18:01:28.000000000 +0900
+++ linux-3.5-rc6/include/linux/mm.h 2012-07-18 18:03:05.551168773 +0900
@@ -1588,6 +1588,8 @@ int vmemmap_populate(struct page *start_
void vmemmap_populate_print_last(void);
void register_page_bootmem_memmap(unsigned long section_nr, struct page *map,
unsigned long size);
+void vmemmap_kfree(struct page *memmpa, unsigned long nr_pages);
+void vmemmap_free_bootmem(struct page *memmpa, unsigned long nr_pages);
enum mf_flags {
MF_COUNT_INCREASED = 1 << 0,
Index: linux-3.5-rc6/mm/sparse.c
===================================================================
--- linux-3.5-rc6.orig/mm/sparse.c 2012-07-18 17:59:25.000000000 +0900
+++ linux-3.5-rc6/mm/sparse.c 2012-07-18 18:03:05.553168749 +0900
@@ -614,12 +614,13 @@ static inline struct page *kmalloc_secti
/* This will make the necessary allocations eventually. */
return sparse_mem_map_populate(pnum, nid);
}
-static void __kfree_section_memmap(struct page *memmap, unsigned long nr_pages)
+static void __kfree_section_memmap(struct page *page, unsigned long nr_pages)
{
- return; /* XXX: Not implemented yet */
+ vmemmap_kfree(page, nr_pages);
}
static void free_map_bootmem(struct page *page, unsigned long nr_pages)
{
+ vmemmap_free_bootmem(page, nr_pages);
}
#else
static struct page *__kmalloc_section_memmap(unsigned long nr_pages)
Index: linux-3.5-rc6/arch/x86/mm/init_64.c
===================================================================
--- linux-3.5-rc6.orig/arch/x86/mm/init_64.c 2012-07-18 18:01:28.000000000 +0900
+++ linux-3.5-rc6/arch/x86/mm/init_64.c 2012-07-18 18:03:05.564168611 +0900
@@ -978,6 +978,127 @@ vmemmap_populate(struct page *start_page
return 0;
}
+#define PAGE_INUSE 0xFD
+
+unsigned long find_and_clear_pte_page(unsigned long addr, unsigned long end,
+ struct page **pp, int *page_size)
+{
+ pgd_t *pgd;
+ pud_t *pud;
+ pmd_t *pmd;
+ pte_t *pte;
+ void *page_addr;
+ unsigned long next;
+
+ *pp = NULL;
+
+ pgd = pgd_offset_k(addr);
+ if (pgd_none(*pgd))
+ return pgd_addr_end(addr, end);
+
+ pud = pud_offset(pgd, addr);
+ if (pud_none(*pud))
+ return pud_addr_end(addr,end);
+
+ if (!cpu_has_pse) {
+ next = (addr + PAGE_SIZE) & PAGE_MASK;
+ pmd = pmd_offset(pud, addr);
+ if (pmd_none(*pmd))
+ return next;
+
+ pte = pte_offset_kernel(pmd, addr);
+ if (pte_none(*pte))
+ return next;
+
+ *page_size = PAGE_SIZE;
+ *pp = pte_page(*pte);
+ } else {
+ next = pmd_addr_end(addr, end);
+
+ pmd = pmd_offset(pud, addr);
+ if (pmd_none(*pmd))
+ return next;
+
+ *page_size = PMD_SIZE;
+ *pp = pmd_page(*pmd);
+ }
+
+ /*
+ * Removed page structs are filled with 0xFD.
+ */
+ memset((void *)addr, PAGE_INUSE, next - addr);
+
+ page_addr = page_address(*pp);
+
+ /*
+ * Check the page is filled with 0xFD or not.
+ * memchr_inv() returns the address. In this case, we cannot
+ * clear PTE/PUD entry, since the page is used by other.
+ * So we cannot also free the page.
+ *
+ * memchr_inv() returns NULL. In this case, we can clear
+ * PTE/PUD entry, since the page is not used by other.
+ * So we can also free the page.
+ */
+ if (memchr_inv(page_addr, PAGE_INUSE, *page_size)) {
+ *pp = NULL;
+ return next;
+ }
+
+ if (!cpu_has_pse)
+ pte_clear(&init_mm, addr, pte);
+ else
+ pmd_clear(pmd);
+
+ return next;
+}
+
+void vmemmap_kfree(struct page *memmap, unsigned long nr_pages)
+{
+ unsigned long addr = (unsigned long)memmap;
+ unsigned long end = (unsigned long)(memmap + nr_pages);
+ unsigned long next;
+ struct page *page;
+ int page_size;
+
+ for (; addr < end; addr = next) {
+ page = NULL;
+ page_size = 0;
+ next = find_and_clear_pte_page(addr, end, &page, &page_size);
+ if (!page)
+ continue;
+
+ free_pages((unsigned long)page_address(page),
+ get_order(page_size));
+ __flush_tlb_one((unsigned long)page_address(page));
+ }
+
+}
+
+void vmemmap_free_bootmem(struct page *memmap, unsigned long nr_pages)
+{
+ unsigned long addr = (unsigned long)memmap;
+ unsigned long end = (unsigned long)(memmap + nr_pages);
+ unsigned long next;
+ struct page *page;
+ int page_size;
+ unsigned long magic;
+
+ for (; addr < end; addr = next) {
+ page = NULL;
+ page_size = 0;
+ next = find_and_clear_pte_page(addr, end, &page, &page_size);
+ if (!page)
+ continue;
+
+ magic = (unsigned long) page->lru.next;
+ if (magic == SECTION_INFO)
+ put_page_bootmem(page);
+ flush_tlb_kernel_range(addr, end);
+ }
+
+}
+
void register_page_bootmem_memmap(unsigned long section_nr,
struct page *start_page, unsigned long size)
{
Index: linux-3.5-rc6/mm/memory_hotplug.c
===================================================================
--- linux-3.5-rc6.orig/mm/memory_hotplug.c 2012-07-18 18:01:28.000000000 +0900
+++ linux-3.5-rc6/mm/memory_hotplug.c 2012-07-18 18:25:11.036597977 +0900
@@ -300,7 +300,6 @@ static int __meminit __add_section(int n
return register_new_memory(nid, __pfn_to_section(phys_start_pfn));
}
-#ifdef CONFIG_SPARSEMEM_VMEMMAP
static int __remove_section(struct zone *zone, struct mem_section *ms)
{
int ret = -EINVAL;
@@ -309,29 +308,15 @@ static int __remove_section(struct zone
return ret;
ret = unregister_memory_section(ms);
-
- return ret;
-}
-#else
-static int __remove_section(struct zone *zone, struct mem_section *ms)
-{
- unsigned long flags;
- struct pglist_data *pgdat = zone->zone_pgdat;
- int ret = -EINVAL;
-
- if (!valid_section(ms))
- return ret;
-
- ret = unregister_memory_section(ms);
if (ret)
return ret;
pgdat_resize_lock(pgdat, &flags);
sparse_remove_one_section(zone, ms);
pgdat_resize_unlock(pgdat, &flags);
- return 0;
+
+ return ret;
}
-#endif
/*
* Reasonably generic function for adding memory. It is
^ permalink raw reply
* [RFC PATCH v4 10/13] memory-hotplug : implement register_page_bootmem_info_section of sparse-vmemmap
From: Yasuaki Ishimatsu @ 2012-07-18 10:15 UTC (permalink / raw)
To: linux-mm, linux-kernel, linuxppc-dev, linux-acpi
Cc: len.brown, wency, paulus, minchan.kim, kosaki.motohiro, rientjes,
cl, akpm, liuj97
For removing memmap region of sparse-vmemmap which is allocated bootmem,
memmap region of sparse-vmemmap needs to be registered by get_page_bootmem().
So the patch searches pages of virtual mapping and registers the pages by
get_page_bootmem().
CC: David Rientjes <rientjes@google.com>
CC: Jiang Liu <liuj97@gmail.com>
CC: Len Brown <len.brown@intel.com>
CC: Benjamin Herrenschmidt <benh@kernel.crashing.org>
CC: Paul Mackerras <paulus@samba.org>
CC: Christoph Lameter <cl@linux.com>
Cc: Minchan Kim <minchan.kim@gmail.com>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
CC: Wen Congyang <wency@cn.fujitsu.com>
Signed-off-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
---
arch/x86/mm/init_64.c | 52 +++++++++++++++++++++++++++++++++++++++++
include/linux/memory_hotplug.h | 2 +
include/linux/mm.h | 3 +-
mm/memory_hotplug.c | 23 +++++++++++++++---
4 files changed, 76 insertions(+), 4 deletions(-)
Index: linux-3.5-rc6/mm/memory_hotplug.c
===================================================================
--- linux-3.5-rc6.orig/mm/memory_hotplug.c 2012-07-18 18:01:24.221435622 +0900
+++ linux-3.5-rc6/mm/memory_hotplug.c 2012-07-18 18:01:28.156386427 +0900
@@ -91,8 +91,8 @@ static void release_memory_resource(stru
}
#ifdef CONFIG_MEMORY_HOTPLUG_SPARSE
-static void get_page_bootmem(unsigned long info, struct page *page,
- unsigned long type)
+void get_page_bootmem(unsigned long info, struct page *page,
+ unsigned long type)
{
unsigned long page_type;
@@ -164,8 +164,25 @@ static void register_page_bootmem_info_s
}
#else
-static inline void register_page_bootmem_info_section(unsigned long start_pfn)
+static void register_page_bootmem_info_section(unsigned long start_pfn)
{
+ unsigned long mapsize, section_nr;
+ struct mem_section *ms;
+ struct page *page, *memmap;
+
+ if (!pfn_valid(start_pfn))
+ return;
+
+ section_nr = pfn_to_section_nr(start_pfn);
+ ms = __nr_to_section(section_nr);
+
+ memmap = sparse_decode_mem_map(ms->section_mem_map, section_nr);
+
+ page = virt_to_page(memmap);
+ mapsize = sizeof(struct page) * PAGES_PER_SECTION;
+ mapsize = PAGE_ALIGN(mapsize) >> PAGE_SHIFT;
+
+ register_page_bootmem_memmap(section_nr, memmap, PAGES_PER_SECTION);
}
#endif
Index: linux-3.5-rc6/include/linux/mm.h
===================================================================
--- linux-3.5-rc6.orig/include/linux/mm.h 2012-07-18 17:59:51.225598230 +0900
+++ linux-3.5-rc6/include/linux/mm.h 2012-07-18 18:01:28.161386365 +0900
@@ -1586,7 +1586,8 @@ int vmemmap_populate_basepages(struct pa
unsigned long pages, int node);
int vmemmap_populate(struct page *start_page, unsigned long pages, int node);
void vmemmap_populate_print_last(void);
-
+void register_page_bootmem_memmap(unsigned long section_nr, struct page *map,
+ unsigned long size);
enum mf_flags {
MF_COUNT_INCREASED = 1 << 0,
Index: linux-3.5-rc6/arch/x86/mm/init_64.c
===================================================================
--- linux-3.5-rc6.orig/arch/x86/mm/init_64.c 2012-07-18 17:59:51.221598278 +0900
+++ linux-3.5-rc6/arch/x86/mm/init_64.c 2012-07-18 18:01:28.169386264 +0900
@@ -978,6 +978,58 @@ vmemmap_populate(struct page *start_page
return 0;
}
+void register_page_bootmem_memmap(unsigned long section_nr,
+ struct page *start_page, unsigned long size)
+{
+ unsigned long addr = (unsigned long)start_page;
+ unsigned long end = (unsigned long)(start_page + size);
+ unsigned long next;
+ pgd_t *pgd;
+ pud_t *pud;
+ pmd_t *pmd;
+
+ for (; addr < end; addr = next) {
+ pte_t *pte = NULL;
+
+ pgd = pgd_offset_k(addr);
+ if (pgd_none(*pgd)) {
+ next = (addr + PAGE_SIZE) & PAGE_MASK;
+ continue;
+ }
+ get_page_bootmem(section_nr, pgd_page(*pgd), MIX_SECTION_INFO);
+
+ pud = pud_offset(pgd, addr);
+ if (pud_none(*pud)) {
+ next = (addr + PAGE_SIZE) & PAGE_MASK;
+ continue;
+ }
+ get_page_bootmem(section_nr, pud_page(*pud), MIX_SECTION_INFO);
+
+ if (!cpu_has_pse) {
+ next = (addr + PAGE_SIZE) & PAGE_MASK;
+ pmd = pmd_offset(pud, addr);
+ if (pmd_none(*pmd))
+ continue;
+ get_page_bootmem(section_nr, pmd_page(*pmd),
+ MIX_SECTION_INFO);
+
+ pte = pte_offset_kernel(pmd, addr);
+ if (pte_none(*pte))
+ continue;
+ get_page_bootmem(section_nr, pte_page(*pte),
+ SECTION_INFO);
+ } else {
+ next = pmd_addr_end(addr, end);
+
+ pmd = pmd_offset(pud, addr);
+ if (pmd_none(*pmd))
+ continue;
+ get_page_bootmem(section_nr, pmd_page(*pmd),
+ SECTION_INFO);
+ }
+ }
+}
+
void __meminit vmemmap_populate_print_last(void)
{
if (p_start) {
Index: linux-3.5-rc6/include/linux/memory_hotplug.h
===================================================================
--- linux-3.5-rc6.orig/include/linux/memory_hotplug.h 2012-07-18 18:01:24.217435670 +0900
+++ linux-3.5-rc6/include/linux/memory_hotplug.h 2012-07-18 18:01:28.173386216 +0900
@@ -162,6 +162,8 @@ static inline void arch_refresh_nodedata
extern void register_page_bootmem_info_node(struct pglist_data *pgdat);
extern void put_page_bootmem(struct page *page);
+extern void get_page_bootmem(unsigned long ingo, struct page *page,
+ unsigned long type);
/*
* Lock for memory hotplug guarantees 1) all callbacks for memory hotplug
^ permalink raw reply
* [RFC PATCH v4 9/13] memory-hotplug : move register_page_bootmem_info_node and put_page_bootmem for sparse-vmemmap
From: Yasuaki Ishimatsu @ 2012-07-18 10:14 UTC (permalink / raw)
To: linux-mm, linux-kernel, linuxppc-dev, linux-acpi
Cc: len.brown, wency, paulus, minchan.kim, kosaki.motohiro, rientjes,
cl, akpm, liuj97
In-Reply-To: <50068974.1070409@jp.fujitsu.com>
For implementing register_page_bootmem_info_node of sparse-vmemmap,
register_page_bootmem_info_node and put_page_bootmem are moved to
memory_hotplug.c
CC: David Rientjes <rientjes@google.com>
CC: Jiang Liu <liuj97@gmail.com>
CC: Len Brown <len.brown@intel.com>
CC: Benjamin Herrenschmidt <benh@kernel.crashing.org>
CC: Paul Mackerras <paulus@samba.org>
CC: Christoph Lameter <cl@linux.com>
Cc: Minchan Kim <minchan.kim@gmail.com>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
CC: Wen Congyang <wency@cn.fujitsu.com>
Signed-off-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
---
include/linux/memory_hotplug.h | 9 ---------
mm/memory_hotplug.c | 8 ++++++--
2 files changed, 6 insertions(+), 11 deletions(-)
Index: linux-3.5-rc6/include/linux/memory_hotplug.h
===================================================================
--- linux-3.5-rc6.orig/include/linux/memory_hotplug.h 2012-07-18 18:00:40.461982690 +0900
+++ linux-3.5-rc6/include/linux/memory_hotplug.h 2012-07-18 18:01:24.217435670 +0900
@@ -160,17 +160,8 @@ static inline void arch_refresh_nodedata
#endif /* CONFIG_NUMA */
#endif /* CONFIG_HAVE_ARCH_NODEDATA_EXTENSION */
-#ifdef CONFIG_SPARSEMEM_VMEMMAP
-static inline void register_page_bootmem_info_node(struct pglist_data *pgdat)
-{
-}
-static inline void put_page_bootmem(struct page *page)
-{
-}
-#else
extern void register_page_bootmem_info_node(struct pglist_data *pgdat);
extern void put_page_bootmem(struct page *page);
-#endif
/*
* Lock for memory hotplug guarantees 1) all callbacks for memory hotplug
Index: linux-3.5-rc6/mm/memory_hotplug.c
===================================================================
--- linux-3.5-rc6.orig/mm/memory_hotplug.c 2012-07-18 18:01:12.586581077 +0900
+++ linux-3.5-rc6/mm/memory_hotplug.c 2012-07-18 18:01:24.221435622 +0900
@@ -91,7 +91,6 @@ static void release_memory_resource(stru
}
#ifdef CONFIG_MEMORY_HOTPLUG_SPARSE
-#ifndef CONFIG_SPARSEMEM_VMEMMAP
static void get_page_bootmem(unsigned long info, struct page *page,
unsigned long type)
{
@@ -127,6 +126,7 @@ void __ref put_page_bootmem(struct page
}
+#ifndef CONFIG_SPARSEMEM_VMEMMAP
static void register_page_bootmem_info_section(unsigned long start_pfn)
{
unsigned long *usemap, mapsize, section_nr, i;
@@ -163,6 +163,11 @@ static void register_page_bootmem_info_s
get_page_bootmem(section_nr, page, MIX_SECTION_INFO);
}
+#else
+static inline void register_page_bootmem_info_section(unsigned long start_pfn)
+{
+}
+#endif
void register_page_bootmem_info_node(struct pglist_data *pgdat)
{
@@ -198,7 +203,6 @@ void register_page_bootmem_info_node(str
register_page_bootmem_info_section(pfn);
}
-#endif /* !CONFIG_SPARSEMEM_VMEMMAP */
static void grow_zone_span(struct zone *zone, unsigned long start_pfn,
unsigned long end_pfn)
^ permalink raw reply
* [RFC PATCH v4 8/13] memory-hotplug : check page type in get_page_bootmem
From: Yasuaki Ishimatsu @ 2012-07-18 10:12 UTC (permalink / raw)
To: linux-mm, linux-kernel, linuxppc-dev, linux-acpi
Cc: len.brown, wency, paulus, minchan.kim, kosaki.motohiro, rientjes,
cl, akpm, liuj97
In-Reply-To: <50068974.1070409@jp.fujitsu.com>
There is a possibility that get_page_bootmem() is called to the same page many
times. So when get_page_bootmem is called to the same page, the function only
increments page->_count.
CC: David Rientjes <rientjes@google.com>
CC: Jiang Liu <liuj97@gmail.com>
CC: Len Brown <len.brown@intel.com>
CC: Benjamin Herrenschmidt <benh@kernel.crashing.org>
CC: Paul Mackerras <paulus@samba.org>
CC: Christoph Lameter <cl@linux.com>
Cc: Minchan Kim <minchan.kim@gmail.com>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
CC: Wen Congyang <wency@cn.fujitsu.com>
Signed-off-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
---
mm/memory_hotplug.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
Index: linux-3.5-rc6/mm/memory_hotplug.c
===================================================================
--- linux-3.5-rc6.orig/mm/memory_hotplug.c 2012-07-18 18:01:02.070712487 +0900
+++ linux-3.5-rc6/mm/memory_hotplug.c 2012-07-18 18:01:12.586581077 +0900
@@ -95,10 +95,17 @@ static void release_memory_resource(stru
static void get_page_bootmem(unsigned long info, struct page *page,
unsigned long type)
{
- page->lru.next = (struct list_head *) type;
- SetPagePrivate(page);
- set_page_private(page, info);
- atomic_inc(&page->_count);
+ unsigned long page_type;
+
+ page_type = (unsigned long) page->lru.next;
+ if (type < MEMORY_HOTPLUG_MIN_BOOTMEM_TYPE ||
+ type > MEMORY_HOTPLUG_MAX_BOOTMEM_TYPE){
+ page->lru.next = (struct list_head *) type;
+ SetPagePrivate(page);
+ set_page_private(page, info);
+ atomic_inc(&page->_count);
+ } else
+ atomic_inc(&page->_count);
}
/* reference to __meminit __free_pages_bootmem is valid
^ permalink raw reply
* [RFC PATCH v4 6/13] memory-hotplug : add memory_block_release
From: Yasuaki Ishimatsu @ 2012-07-18 10:11 UTC (permalink / raw)
To: linux-mm, linux-kernel, linuxppc-dev, linux-acpi
Cc: len.brown, wency, paulus, minchan.kim, kosaki.motohiro, rientjes,
cl, akpm, liuj97
In-Reply-To: <50068974.1070409@jp.fujitsu.com>
When calling remove_memory_block(), the function shows following message at
device_release().
Device 'memory528' does not have a release() function, it is broken and must
be fixed.
remove_memory_block() calls kfree(mem). I think it shouled be called from
device_release(). So the patch implements memory_block_release()
CC: David Rientjes <rientjes@google.com>
CC: Jiang Liu <liuj97@gmail.com>
CC: Len Brown <len.brown@intel.com>
CC: Benjamin Herrenschmidt <benh@kernel.crashing.org>
CC: Paul Mackerras <paulus@samba.org>
CC: Christoph Lameter <cl@linux.com>
Cc: Minchan Kim <minchan.kim@gmail.com>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
CC: Wen Congyang <wency@cn.fujitsu.com>
Signed-off-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
---
drivers/base/memory.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
Index: linux-3.5-rc6/drivers/base/memory.c
===================================================================
--- linux-3.5-rc6.orig/drivers/base/memory.c 2012-07-18 17:50:49.659368740 +0900
+++ linux-3.5-rc6/drivers/base/memory.c 2012-07-18 17:51:28.655881214 +0900
@@ -109,6 +109,15 @@ bool is_memblk_offline(unsigned long sta
}
EXPORT_SYMBOL(is_memblk_offline);
+#define to_memory_block(device) container_of(device, struct memory_block, dev)
+
+static void release_memory_block(struct device *dev)
+{
+ struct memory_block *mem = to_memory_block(dev);
+
+ kfree(mem);
+}
+
/*
* register_memory - Setup a sysfs device for a memory block
*/
@@ -119,6 +128,7 @@ int register_memory(struct memory_block
memory->dev.bus = &memory_subsys;
memory->dev.id = memory->start_section_nr / sections_per_block;
+ memory->dev.release = release_memory_block;
error = device_register(&memory->dev);
return error;
@@ -669,7 +679,6 @@ int remove_memory_block(unsigned long no
mem_remove_simple_file(mem, phys_device);
mem_remove_simple_file(mem, removable);
unregister_memory(mem);
- kfree(mem);
} else
kobject_put(&mem->dev.kobj);
^ permalink raw reply
* [RFC PATCH v4 7/13] memory-hotplug : remove_memory calls __remove_pages
From: Yasuaki Ishimatsu @ 2012-07-18 10:12 UTC (permalink / raw)
To: linux-mm, linux-kernel, linuxppc-dev, linux-acpi
Cc: len.brown, wency, paulus, minchan.kim, kosaki.motohiro, rientjes,
cl, akpm, liuj97
In-Reply-To: <50068974.1070409@jp.fujitsu.com>
The patch adds __remove_pages() to remove_memory(). Then the range of
phys_start_pfn argument and nr_pages argument in __remove_pagse() may
have different zone. So zone argument is removed from __remove_pages()
and __remove_pages() caluculates zone in each section.
When CONFIG_SPARSEMEM_VMEMMAP is defined, there is no way to remove a memmap.
So __remove_section only calls unregister_memory_section().
CC: David Rientjes <rientjes@google.com>
CC: Jiang Liu <liuj97@gmail.com>
CC: Len Brown <len.brown@intel.com>
CC: Benjamin Herrenschmidt <benh@kernel.crashing.org>
CC: Paul Mackerras <paulus@samba.org>
CC: Christoph Lameter <cl@linux.com>
Cc: Minchan Kim <minchan.kim@gmail.com>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
CC: Wen Congyang <wency@cn.fujitsu.com>
Signed-off-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
---
arch/powerpc/platforms/pseries/hotplug-memory.c | 5 +----
include/linux/memory_hotplug.h | 3 +--
mm/memory_hotplug.c | 19 ++++++++++++-------
3 files changed, 14 insertions(+), 13 deletions(-)
Index: linux-3.5-rc6/mm/memory_hotplug.c
===================================================================
--- linux-3.5-rc6.orig/mm/memory_hotplug.c 2012-07-18 18:00:27.440145432 +0900
+++ linux-3.5-rc6/mm/memory_hotplug.c 2012-07-18 18:01:02.070712487 +0900
@@ -275,11 +275,14 @@ static int __meminit __add_section(int n
#ifdef CONFIG_SPARSEMEM_VMEMMAP
static int __remove_section(struct zone *zone, struct mem_section *ms)
{
- /*
- * XXX: Freeing memmap with vmemmap is not implement yet.
- * This should be removed later.
- */
- return -EBUSY;
+ int ret = -EINVAL;
+
+ if (!valid_section(ms))
+ return ret;
+
+ ret = unregister_memory_section(ms);
+
+ return ret;
}
#else
static int __remove_section(struct zone *zone, struct mem_section *ms)
@@ -346,11 +349,11 @@ EXPORT_SYMBOL_GPL(__add_pages);
* sure that pages are marked reserved and zones are adjust properly by
* calling offline_pages().
*/
-int __remove_pages(struct zone *zone, unsigned long phys_start_pfn,
- unsigned long nr_pages)
+int __remove_pages(unsigned long phys_start_pfn, unsigned long nr_pages)
{
unsigned long i, ret = 0;
int sections_to_remove;
+ struct zone *zone;
/*
* We can only remove entire sections
@@ -363,6 +366,7 @@ int __remove_pages(struct zone *zone, un
sections_to_remove = nr_pages / PAGES_PER_SECTION;
for (i = 0; i < sections_to_remove; i++) {
unsigned long pfn = phys_start_pfn + i*PAGES_PER_SECTION;
+ zone = page_zone(pfn_to_page(pfn));
ret = __remove_section(zone, __pfn_to_section(pfn));
if (ret)
break;
@@ -1031,6 +1035,7 @@ int __ref remove_memory(int nid, u64 sta
/* remove memmap entry */
firmware_map_remove(start, start + size, "System RAM");
+ __remove_pages(start >> PAGE_SHIFT, size >> PAGE_SHIFT);
out:
unlock_memory_hotplug();
return ret;
Index: linux-3.5-rc6/include/linux/memory_hotplug.h
===================================================================
--- linux-3.5-rc6.orig/include/linux/memory_hotplug.h 2012-07-18 18:00:27.445145371 +0900
+++ linux-3.5-rc6/include/linux/memory_hotplug.h 2012-07-18 18:00:40.461982690 +0900
@@ -89,8 +89,7 @@ extern bool is_pageblock_removable_noloc
/* reasonably generic interface to expand the physical pages in a zone */
extern int __add_pages(int nid, struct zone *zone, unsigned long start_pfn,
unsigned long nr_pages);
-extern int __remove_pages(struct zone *zone, unsigned long start_pfn,
- unsigned long nr_pages);
+extern int __remove_pages(unsigned long start_pfn, unsigned long nr_pages);
#ifdef CONFIG_NUMA
extern int memory_add_physaddr_to_nid(u64 start);
Index: linux-3.5-rc6/arch/powerpc/platforms/pseries/hotplug-memory.c
===================================================================
--- linux-3.5-rc6.orig/arch/powerpc/platforms/pseries/hotplug-memory.c 2012-07-18 18:00:27.442145407 +0900
+++ linux-3.5-rc6/arch/powerpc/platforms/pseries/hotplug-memory.c 2012-07-18 18:00:40.470982578 +0900
@@ -76,7 +76,6 @@ unsigned long memory_block_size_bytes(vo
static int pseries_remove_memblock(unsigned long base, unsigned int memblock_size)
{
unsigned long start, start_pfn;
- struct zone *zone;
int i, ret;
int sections_to_remove;
@@ -87,8 +86,6 @@ static int pseries_remove_memblock(unsig
return 0;
}
- zone = page_zone(pfn_to_page(start_pfn));
-
/*
* Remove section mappings and sysfs entries for the
* section of the memory we are removing.
@@ -101,7 +98,7 @@ static int pseries_remove_memblock(unsig
sections_to_remove = (memblock_size >> PAGE_SHIFT) / PAGES_PER_SECTION;
for (i = 0; i < sections_to_remove; i++) {
unsigned long pfn = start_pfn + i * PAGES_PER_SECTION;
- ret = __remove_pages(zone, start_pfn, PAGES_PER_SECTION);
+ ret = __remove_pages(start_pfn, PAGES_PER_SECTION);
if (ret)
return ret;
}
^ permalink raw reply
* [RFC PATCH v4 5/13] memory-hotplug : does not release memory region in PAGES_PER_SECTION chunks
From: Yasuaki Ishimatsu @ 2012-07-18 10:10 UTC (permalink / raw)
To: linux-mm, linux-kernel, linuxppc-dev, linux-acpi
Cc: len.brown, wency, paulus, minchan.kim, kosaki.motohiro, rientjes,
cl, akpm, liuj97
In-Reply-To: <50068974.1070409@jp.fujitsu.com>
Since applying a patch(de7f0cba96786c), release_mem_region() has been changed
as called in PAGES_PER_SECTION chunks because register_memory_resource() is
called in PAGES_PER_SECTION chunks by add_memory(). But it seems firmware
dependency. If CRS are written in the PAGES_PER_SECTION chunks in ACPI DSDT
Table, register_memory_resource() is called in PAGES_PER_SECTION chunks.
But if CRS are written in the DIMM unit in ACPI DSDT Table,
register_memory_resource() is called in DIMM unit. So release_mem_region()
should not be called in PAGES_PER_SECTION chunks. The patch fixes it.
CC: David Rientjes <rientjes@google.com>
CC: Jiang Liu <liuj97@gmail.com>
CC: Len Brown <len.brown@intel.com>
CC: Benjamin Herrenschmidt <benh@kernel.crashing.org>
CC: Paul Mackerras <paulus@samba.org>
CC: Christoph Lameter <cl@linux.com>
Cc: Minchan Kim <minchan.kim@gmail.com>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
CC: Wen Congyang <wency@cn.fujitsu.com>
Signed-off-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
---
arch/powerpc/platforms/pseries/hotplug-memory.c | 13 +++++++++----
mm/memory_hotplug.c | 4 ++--
2 files changed, 11 insertions(+), 6 deletions(-)
Index: linux-3.5-rc6/mm/memory_hotplug.c
===================================================================
--- linux-3.5-rc6.orig/mm/memory_hotplug.c 2012-07-18 17:51:03.933189930 +0900
+++ linux-3.5-rc6/mm/memory_hotplug.c 2012-07-18 17:51:17.550020005 +0900
@@ -358,11 +358,11 @@ int __remove_pages(struct zone *zone, un
BUG_ON(phys_start_pfn & ~PAGE_SECTION_MASK);
BUG_ON(nr_pages % PAGES_PER_SECTION);
+ release_mem_region(phys_start_pfn << PAGE_SHIFT, nr_pages * PAGE_SIZE);
+
sections_to_remove = nr_pages / PAGES_PER_SECTION;
for (i = 0; i < sections_to_remove; i++) {
unsigned long pfn = phys_start_pfn + i*PAGES_PER_SECTION;
- release_mem_region(pfn << PAGE_SHIFT,
- PAGES_PER_SECTION << PAGE_SHIFT);
ret = __remove_section(zone, __pfn_to_section(pfn));
if (ret)
break;
Index: linux-3.5-rc6/arch/powerpc/platforms/pseries/hotplug-memory.c
===================================================================
--- linux-3.5-rc6.orig/arch/powerpc/platforms/pseries/hotplug-memory.c 2012-07-18 17:50:49.893365814 +0900
+++ linux-3.5-rc6/arch/powerpc/platforms/pseries/hotplug-memory.c 2012-07-18 17:51:17.553019968 +0900
@@ -77,7 +77,8 @@ static int pseries_remove_memblock(unsig
{
unsigned long start, start_pfn;
struct zone *zone;
- int ret;
+ int i, ret;
+ int sections_to_remove;
start_pfn = base >> PAGE_SHIFT;
@@ -97,9 +98,13 @@ static int pseries_remove_memblock(unsig
* to sysfs "state" file and we can't remove sysfs entries
* while writing to it. So we have to defer it to here.
*/
- ret = __remove_pages(zone, start_pfn, memblock_size >> PAGE_SHIFT);
- if (ret)
- return ret;
+ sections_to_remove = (memblock_size >> PAGE_SHIFT) / PAGES_PER_SECTION;
+ for (i = 0; i < sections_to_remove; i++) {
+ unsigned long pfn = start_pfn + i * PAGES_PER_SECTION;
+ ret = __remove_pages(zone, start_pfn, PAGES_PER_SECTION);
+ if (ret)
+ return ret;
+ }
/*
* Update memory regions for memory remove
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox