Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/410/?format=api
{ "id": 410, "url": "http://patchwork.ozlabs.org/api/patches/410/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/200809171619.46741.hannes.hering@linux.vnet.ibm.com/", "project": { "id": 2, "url": "http://patchwork.ozlabs.org/api/projects/2/?format=api", "name": "Linux PPC development", "link_name": "linuxppc-dev", "list_id": "linuxppc-dev.lists.ozlabs.org", "list_email": "linuxppc-dev@lists.ozlabs.org", "web_url": "https://github.com/linuxppc/wiki/wiki", "scm_url": "https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git", "webscm_url": "https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/", "list_archive_url": "https://lore.kernel.org/linuxppc-dev/", "list_archive_url_format": "https://lore.kernel.org/linuxppc-dev/{}/", "commit_url_format": "https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/commit/?id={}" }, "msgid": "<200809171619.46741.hannes.hering@linux.vnet.ibm.com>", "list_archive_url": "https://lore.kernel.org/linuxppc-dev/200809171619.46741.hannes.hering@linux.vnet.ibm.com/", "date": "2008-09-17T14:19:46", "name": "[2.6.27] ehea: Fix memory hotplug support", "commit_ref": null, "pull_url": null, "state": "not-applicable", "archived": true, "hash": "3da82aa6034bc60c5144ef1f031e041d32e1bf2b", "submitter": { "id": 218, "url": "http://patchwork.ozlabs.org/api/people/218/?format=api", "name": "Hannes Hering", "email": "hannes.hering@linux.vnet.ibm.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/200809171619.46741.hannes.hering@linux.vnet.ibm.com/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/410/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/410/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org>", "X-Original-To": [ "patchwork-incoming@ozlabs.org", "linuxppc-dev@ozlabs.org" ], "Delivered-To": [ "patchwork-incoming@ozlabs.org", "linuxppc-dev@ozlabs.org" ], "Received": [ "from ozlabs.org (localhost [127.0.0.1])\n\tby ozlabs.org (Postfix) with ESMTP id 1E259DE031\n\tfor <patchwork-incoming@ozlabs.org>;\n\tThu, 18 Sep 2008 00:21:42 +1000 (EST)", "from mtagate6.de.ibm.com (mtagate6.de.ibm.com [195.212.29.155])\n\t(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\n\t(Client CN \"mtagate6.de.ibm.com\", Issuer \"Equifax\" (verified OK))\n\tby ozlabs.org (Postfix) with ESMTPS id 98840DDF04\n\tfor <linuxppc-dev@ozlabs.org>; Thu, 18 Sep 2008 00:21:27 +1000 (EST)", "from d12nrmr1607.megacenter.de.ibm.com\n\t(d12nrmr1607.megacenter.de.ibm.com [9.149.167.49])\n\tby mtagate6.de.ibm.com (8.13.8/8.13.8) with ESMTP id m8HEKLER303890\n\tfor <linuxppc-dev@ozlabs.org>; Wed, 17 Sep 2008 14:20:21 GMT", "from d12av04.megacenter.de.ibm.com (d12av04.megacenter.de.ibm.com\n\t[9.149.165.229])\n\tby d12nrmr1607.megacenter.de.ibm.com (8.13.8/8.13.8/NCO v9.1) with\n\tESMTP id m8HEKLMS3584112\n\tfor <linuxppc-dev@ozlabs.org>; Wed, 17 Sep 2008 16:20:21 +0200", "from d12av04.megacenter.de.ibm.com (loopback [127.0.0.1])\n\tby d12av04.megacenter.de.ibm.com (8.12.11.20060308/8.13.3) with ESMTP\n\tid m8HEKHC3000721\n\tfor <linuxppc-dev@ozlabs.org>; Wed, 17 Sep 2008 16:20:17 +0200", "from dyn-9-152-217-94.boeblingen.de.ibm.com\n\t(dyn-9-152-217-94.boeblingen.de.ibm.com [9.152.217.94])\n\tby d12av04.megacenter.de.ibm.com (8.12.11.20060308/8.12.11) with\n\tESMTP id m8HEKH5Q032219; Wed, 17 Sep 2008 16:20:17 +0200" ], "From": "Hannes Hering <hannes.hering@linux.vnet.ibm.com>", "To": "jeff@garzik.org", "Subject": "[PATCH] [2.6.27] ehea: Fix memory hotplug support", "Date": "Wed, 17 Sep 2008 16:19:46 +0200", "User-Agent": "KMail/1.9.9", "Organization": "IBM", "MIME-Version": "1.0", "Content-Disposition": "inline", "Message-Id": "<200809171619.46741.hannes.hering@linux.vnet.ibm.com>", "Cc": "themann@de.ibm.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org,\n\traisch@de.ibm.com, ossrosch@linux.vnet.ibm.com,\n\tlinuxppc-dev@ozlabs.org, ossthema@de.ibm.com, osstklei@de.ibm.com", "X-BeenThere": "linuxppc-dev@ozlabs.org", "X-Mailman-Version": "2.1.11", "Precedence": "list", "List-Id": "Linux on PowerPC Developers Mail List <linuxppc-dev.ozlabs.org>", "List-Unsubscribe": "<https://ozlabs.org/mailman/options/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@ozlabs.org?subject=unsubscribe>", "List-Archive": "<http://ozlabs.org/pipermail/linuxppc-dev>", "List-Post": "<mailto:linuxppc-dev@ozlabs.org>", "List-Help": "<mailto:linuxppc-dev-request@ozlabs.org?subject=help>", "List-Subscribe": "<https://ozlabs.org/mailman/listinfo/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@ozlabs.org?subject=subscribe>", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Sender": "linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org", "Errors-To": "linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org" }, "content": "This patch implements the memory notifier to update the busmap instantly\ninstead of rebuilding the whole map. This is necessary because\nwalk_memory_resource provides different information than required during memory\nhotplug.\n\nSigned-off-by: Hannes Hering <hering2@de.ibm.com>", "diff": "diff -Nurp -X dontdiff linux-netdev-2.6/drivers/net/ehea/ehea.h patched_kernel/drivers/net/ehea/ehea.h\n--- linux-netdev-2.6/drivers/net/ehea/ehea.h\t2008-09-17 16:09:25.729017931 +0200\n+++ patched_kernel/drivers/net/ehea/ehea.h\t2008-09-17 16:11:26.481026217 +0200\n@@ -40,13 +40,13 @@\n #include <asm/io.h>\n \n #define DRV_NAME\t\"ehea\"\n-#define DRV_VERSION\t\"EHEA_0092\"\n+#define DRV_VERSION\t\"EHEA_0094\"\n \n /* eHEA capability flags */\n #define DLPAR_PORT_ADD_REM 1\n #define DLPAR_MEM_ADD 2\n #define DLPAR_MEM_REM 4\n-#define EHEA_CAPABILITIES (DLPAR_PORT_ADD_REM | DLPAR_MEM_ADD)\n+#define EHEA_CAPABILITIES (DLPAR_PORT_ADD_REM | DLPAR_MEM_ADD | DLPAR_MEM_REM)\n \n #define EHEA_MSG_DEFAULT (NETIF_MSG_LINK | NETIF_MSG_TIMER \\\n \t| NETIF_MSG_RX_ERR | NETIF_MSG_TX_ERR)\ndiff -Nurp -X dontdiff linux-netdev-2.6/drivers/net/ehea/ehea_main.c patched_kernel/drivers/net/ehea/ehea_main.c\n--- linux-netdev-2.6/drivers/net/ehea/ehea_main.c\t2008-09-17 16:09:25.729017931 +0200\n+++ patched_kernel/drivers/net/ehea/ehea_main.c\t2008-09-17 16:11:26.481026217 +0200\n@@ -2863,7 +2863,7 @@ static void ehea_rereg_mrs(struct work_s\n \tstruct ehea_adapter *adapter;\n \n \tmutex_lock(&dlpar_mem_lock);\n-\tehea_info(\"LPAR memory enlarged - re-initializing driver\");\n+\tehea_info(\"LPAR memory changed - re-initializing driver\");\n \n \tlist_for_each_entry(adapter, &adapter_list, list)\n \t\tif (adapter->active_ports) {\n@@ -2900,13 +2900,6 @@ static void ehea_rereg_mrs(struct work_s\n \t\t\t}\n \t\t}\n \n-\tehea_destroy_busmap();\n-\tret = ehea_create_busmap();\n-\tif (ret) {\n-\t\tehea_error(\"creating ehea busmap failed\");\n-\t\tgoto out;\n-\t}\n-\n \tclear_bit(__EHEA_STOP_XFER, &ehea_driver_flags);\n \n \tlist_for_each_entry(adapter, &adapter_list, list)\n@@ -3519,9 +3512,20 @@ void ehea_crash_handler(void)\n static int ehea_mem_notifier(struct notifier_block *nb,\n unsigned long action, void *data)\n {\n+\tstruct memory_notify *arg = data;\n \tswitch (action) {\n-\tcase MEM_OFFLINE:\n-\t\tehea_info(\"memory has been removed\");\n+\tcase MEM_CANCEL_OFFLINE:\n+\t\tehea_info(\"memory offlining canceled\");\n+\tcase MEM_ONLINE:\n+\t\tehea_info(\"memory is going online\");\n+\t\tif (ehea_add_sect_bmap(arg->start_pfn, arg->nr_pages))\n+\t\t\treturn NOTIFY_BAD;\n+\t\tehea_rereg_mrs(NULL);\n+\t\tbreak;\n+\tcase MEM_GOING_OFFLINE:\n+\t\tehea_info(\"memory is going offline\");\n+\t\tif (ehea_rem_sect_bmap(arg->start_pfn, arg->nr_pages))\n+\t\t\treturn NOTIFY_BAD;\n \t\tehea_rereg_mrs(NULL);\n \t\tbreak;\n \tdefault:\ndiff -Nurp -X dontdiff linux-netdev-2.6/drivers/net/ehea/ehea_qmr.c patched_kernel/drivers/net/ehea/ehea_qmr.c\n--- linux-netdev-2.6/drivers/net/ehea/ehea_qmr.c\t2008-09-17 16:09:25.729017931 +0200\n+++ patched_kernel/drivers/net/ehea/ehea_qmr.c\t2008-09-17 16:11:26.481026217 +0200\n@@ -587,53 +587,81 @@ static inline int ehea_init_bmap(struct \n \treturn ehea_init_top_bmap(ehea_bmap->top[top], dir);\n }\n \n-static int ehea_create_busmap_callback(unsigned long pfn,\n-\t\t\t\t unsigned long nr_pages, void *arg)\n+static DEFINE_MUTEX(ehea_busmap_mutex);\n+static unsigned long ehea_mr_len;\n+\n+#define EHEA_BUSMAP_ADD_SECT 1\n+#define EHEA_BUSMAP_REM_SECT 0\n+\n+static int ehea_update_busmap(unsigned long pfn, unsigned long pgnum, int add)\n {\n-\tunsigned long i, mr_len, start_section, end_section;\n-\tstart_section = (pfn * PAGE_SIZE) / EHEA_SECTSIZE;\n-\tend_section = start_section + ((nr_pages * PAGE_SIZE) / EHEA_SECTSIZE);\n-\tmr_len = *(unsigned long *)arg;\n+\tunsigned long i, start_section, end_section;\n \n \tif (!ehea_bmap)\n \t\tehea_bmap = kzalloc(sizeof(struct ehea_bmap), GFP_KERNEL);\n \tif (!ehea_bmap)\n \t\treturn -ENOMEM;\n \n+\tstart_section = (pfn * PAGE_SIZE) / EHEA_SECTSIZE;\n+\tend_section = start_section + ((pgnum * PAGE_SIZE) / EHEA_SECTSIZE);\n+\n \tfor (i = start_section; i < end_section; i++) {\n-\t\tint ret;\n-\t\tint top, dir, idx;\n \t\tu64 vaddr;\n+\t\tint top = ehea_calc_index(i, EHEA_TOP_INDEX_SHIFT);\n+\t\tint dir = ehea_calc_index(i, EHEA_DIR_INDEX_SHIFT);\n+\t\tint idx = i & EHEA_INDEX_MASK;\n+\n+\t\tint ret = ehea_init_bmap(ehea_bmap, top, dir);\n+\t\tif (ret) {\n+\t\t\tif(add) {\n+\t\t\t\treturn ret;\n+\t\t\t} else {\n+\t\t\t\tcontinue;\n+\t\t\t}\n+\t\t}\n \n-\t\ttop = ehea_calc_index(i, EHEA_TOP_INDEX_SHIFT);\n-\t\tdir = ehea_calc_index(i, EHEA_DIR_INDEX_SHIFT);\n-\n-\t\tret = ehea_init_bmap(ehea_bmap, top, dir);\n-\t\tif(ret)\n-\t\t\treturn ret;\n-\n-\t\tidx = i & EHEA_INDEX_MASK;\n-\t\tvaddr = EHEA_BUSMAP_START + mr_len + i * EHEA_SECTSIZE;\n-\n+\t\tif (add) {\n+\t\t\tvaddr = EHEA_BUSMAP_START + ehea_mr_len;\n+\t\t\tehea_mr_len += EHEA_SECTSIZE;\n+\t\t} else { /* remove */\n+\t\t\tvaddr = 0;\n+\t\t\tehea_mr_len -= EHEA_SECTSIZE;\n+\t\t}\n \t\tehea_bmap->top[top]->dir[dir]->ent[idx] = vaddr;\n \t}\n-\n-\tmr_len += nr_pages * PAGE_SIZE;\n-\t*(unsigned long *)arg = mr_len;\n-\n \treturn 0;\n }\n \n-static unsigned long ehea_mr_len;\n+int ehea_add_sect_bmap(unsigned long pfn, unsigned long nr_pages)\n+{\n+\tint ret;\n+\tmutex_lock(&ehea_busmap_mutex);\n+\tret = ehea_update_busmap(pfn, nr_pages, EHEA_BUSMAP_ADD_SECT);\n+\tmutex_unlock(&ehea_busmap_mutex);\n+\treturn ret;\n+}\n \n-static DEFINE_MUTEX(ehea_busmap_mutex);\n+int ehea_rem_sect_bmap(unsigned long pfn, unsigned long nr_pages)\n+{\n+\tint ret;\n+\tmutex_lock(&ehea_busmap_mutex);\n+\tret = ehea_update_busmap(pfn, nr_pages, EHEA_BUSMAP_REM_SECT);\n+\tmutex_unlock(&ehea_busmap_mutex);\n+\treturn ret;\n+}\n+\n+static int ehea_create_busmap_callback(unsigned long pfn,\n+\t\t\t\t unsigned long nr_pages, void *arg)\n+{\n+\treturn ehea_update_busmap(pfn, nr_pages, EHEA_BUSMAP_ADD_SECT);\n+}\n \n int ehea_create_busmap(void)\n {\n \tint ret;\n \tmutex_lock(&ehea_busmap_mutex);\n \tehea_mr_len = 0;\n-\tret = walk_memory_resource(0, 1ULL << MAX_PHYSMEM_BITS, &ehea_mr_len,\n+\tret = walk_memory_resource(0, 1ULL << MAX_PHYSMEM_BITS, NULL,\n \t\t\t\t ehea_create_busmap_callback);\n \tmutex_unlock(&ehea_busmap_mutex);\n \treturn ret;\ndiff -Nurp -X dontdiff linux-netdev-2.6/drivers/net/ehea/ehea_qmr.h patched_kernel/drivers/net/ehea/ehea_qmr.h\n--- linux-netdev-2.6/drivers/net/ehea/ehea_qmr.h\t2008-09-17 16:09:25.729017931 +0200\n+++ patched_kernel/drivers/net/ehea/ehea_qmr.h\t2008-09-17 16:11:26.481026217 +0200\n@@ -378,6 +378,8 @@ int ehea_rem_mr(struct ehea_mr *mr);\n \n void ehea_error_data(struct ehea_adapter *adapter, u64 res_handle);\n \n+int ehea_add_sect_bmap(unsigned long pfn, unsigned long nr_pages);\n+int ehea_rem_sect_bmap(unsigned long pfn, unsigned long nr_pages);\n int ehea_create_busmap(void);\n void ehea_destroy_busmap(void);\n u64 ehea_map_vaddr(void *caddr);\n", "prefixes": [ "2.6.27" ] }