Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.1/patches/2230072/?format=api
{ "id": 2230072, "url": "http://patchwork.ozlabs.org/api/1.1/patches/2230072/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-ppc/patch/20260429065127.366813-1-shivangu@linux.ibm.com/", "project": { "id": 69, "url": "http://patchwork.ozlabs.org/api/1.1/projects/69/?format=api", "name": "QEMU powerpc development", "link_name": "qemu-ppc", "list_id": "qemu-ppc.nongnu.org", "list_email": "qemu-ppc@nongnu.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20260429065127.366813-1-shivangu@linux.ibm.com>", "date": "2026-04-29T06:51:27", "name": "ppc/spapr: make fadump collect regs for maxcpus", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "088f37faa32edc67eebb51cb9a39c7a095f677b9", "submitter": { "id": 91952, "url": "http://patchwork.ozlabs.org/api/1.1/people/91952/?format=api", "name": "Shivang Upadhyay", "email": "shivangu@linux.ibm.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-ppc/patch/20260429065127.366813-1-shivangu@linux.ibm.com/mbox/", "series": [ { "id": 502003, "url": "http://patchwork.ozlabs.org/api/1.1/series/502003/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-ppc/list/?series=502003", "date": "2026-04-29T06:51:27", "name": "ppc/spapr: make fadump collect regs for maxcpus", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/502003/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2230072/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2230072/checks/", "tags": {}, "headers": { "Return-Path": "<qemu-ppc-bounces+incoming=patchwork.ozlabs.org@nongnu.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@legolas.ozlabs.org", "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256\n header.s=pp1 header.b=tUbsbUr3;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists1p.gnu.org;\n envelope-from=qemu-ppc-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)" ], "Received": [ "from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g57K51ncxz1xqf\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 29 Apr 2026 16:52:23 +1000 (AEST)", "from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists1p.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-ppc-bounces@nongnu.org>)\n\tid 1wHym8-0002bR-3q; Wed, 29 Apr 2026 02:52:00 -0400", "from eggs.gnu.org ([2001:470:142:3::10])\n by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <shivangu@linux.ibm.com>)\n id 1wHym2-0002as-Q8; Wed, 29 Apr 2026 02:51:55 -0400", "from mx0b-001b2d01.pphosted.com ([148.163.158.5])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <shivangu@linux.ibm.com>)\n id 1wHym0-0008Nq-Ve; Wed, 29 Apr 2026 02:51:54 -0400", "from pps.filterd (m0353725.ppops.net [127.0.0.1])\n by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id\n 63T606XY1892388; Wed, 29 Apr 2026 06:51:50 GMT", "from ppma22.wdc07v.mail.ibm.com\n (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92])\n by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4drm1dyu68-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);\n Wed, 29 Apr 2026 06:51:50 +0000 (GMT)", "from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1])\n by ppma22.wdc07v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id\n 63T6cnst018790;\n Wed, 29 Apr 2026 06:51:50 GMT", "from smtprelay05.fra02v.mail.ibm.com ([9.218.2.225])\n by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4ds8avwa2s-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);\n Wed, 29 Apr 2026 06:51:49 +0000 (GMT)", "from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com\n [10.20.54.100])\n by smtprelay05.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id\n 63T6pi7949545656\n (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);\n Wed, 29 Apr 2026 06:51:44 GMT", "from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1])\n by IMSVA (Postfix) with ESMTP id 83EED20043;\n Wed, 29 Apr 2026 06:51:44 +0000 (GMT)", "from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1])\n by IMSVA (Postfix) with ESMTP id A99DD20040;\n Wed, 29 Apr 2026 06:51:42 +0000 (GMT)", "from shivang.com (unknown [9.123.12.247])\n by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP;\n Wed, 29 Apr 2026 06:51:42 +0000 (GMT)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc\n :content-transfer-encoding:date:from:message-id:mime-version\n :subject:to; s=pp1; bh=ackvfLE23OIA3/Emi6Nwt4GfZWO3HPJBwLWkv/WbH\n m8=; b=tUbsbUr34HQN0kkNbWz7DCJUstqxGngXPtMT3yiLd/rSpdJcIF6KvCd2A\n IyYU/DNA38fpMmCFeeCO2W0y/6G73DFoS6C/P28N6K1hSKIfncUl6GvD8h1x/408\n Hk43ExpFLrRGByl17JXGOPUBwQPhuSJH86atrDSDn46w6HaG21SRYQccyCfTHqJ4\n bLXMZzY5vA8NaHYs8HSQPbvQlDF2mNSBtkJT5SmJvzDtdFShge0z3ZtfdSnIIr35\n 3cHmLMEWfBNKbeTQB0kc2IvncCOX/NQnugyVdDThpHu9Get4iX+nT7i2xz0BRLG+\n F9tzPQqnxHS84birShGhnSNJwgQ9A==", "From": "Shivang Upadhyay <shivangu@linux.ibm.com>", "To": "qemu-ppc@nongnu.org, qemu-devel@nongnu.org", "Cc": "Shivang Upadhyay <shivangu@linux.ibm.com>,\n Aditya Gupta <adityag@linux.ibm.com>,\n Sourabh Jain <sourabhjain@linux.ibm.com>,\n Mahesh J Salgaonkar <mahesh@linux.ibm.com>,\n Harsh Prateek Bora <harshpb@linux.ibm.com>,\n Anushree Mathur <anushree.mathur@linux.vnet.ibm.com>", "Subject": "[PATCH] ppc/spapr: make fadump collect regs for maxcpus", "Date": "Wed, 29 Apr 2026 12:21:27 +0530", "Message-ID": "<20260429065127.366813-1-shivangu@linux.ibm.com>", "X-Mailer": "git-send-email 2.53.0", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "X-TM-AS-GCONF": "00", "X-Proofpoint-ORIG-GUID": "dJdOv-P-JoEwq5jzLy4p0RLSqsO0pNSy", "X-Proofpoint-Spam-Details-Enc": "AW1haW4tMjYwNDI5MDA2NiBTYWx0ZWRfX8hlaRZaHH2HK\n 52jJyErWtNCire8YHR0Sy1bz24TPaBW4GtIDLrzxii320W7riwdgr+8U1Cj99h5IiE+l3cNEaaH\n pHlv48ZGEJK8MpFmwrro2DhqZBRRVO+OX7IJw6EI8kJZ7M0cDryxtjWKD6GuKYJ8OVGXoPiSuaw\n VOhY4JfZv0Rhzt0wIpSzn0kSZTdqnrDbuqbTqk3RXGZcSIY/BeTlMDO11LtasaODyNpKh1hne4q\n DSHAZtw/WfrT6P9MFMjtLlaWbEVGaosFE3/f142PObRWiu/Hgn/2gxLAqWm0yX3MjIWOCQ8J2A6\n 8ioW4aqWV5NI82RSFpVXiyMnNl0D7XZtAmX4Y75O/8oLSxUcNW3uGV9BDOC1n1ocnkywY+jhVsH\n oV5XTOzrtX3PaiZWYtunCshhQmVn3jSfl1DlSDOn3cC38E6baGHOvPe3ScKS76NRrTzN03sSv0S\n DJR/GJgu4yKibC4UMow==", "X-Authority-Analysis": "v=2.4 cv=VZLH+lp9 c=1 sm=1 tr=0 ts=69f1aa86 cx=c_pps\n a=5BHTudwdYE3Te8bg5FgnPg==:117 a=5BHTudwdYE3Te8bg5FgnPg==:17\n a=A5OVakUREuEA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22\n a=V8glGbnc2Ofi9Qvn3v5h:22 a=VnNF1IyMAAAA:8 a=RuK-KQVcXEPILYYYT2UA:9", "X-Proofpoint-GUID": "dJdOv-P-JoEwq5jzLy4p0RLSqsO0pNSy", "X-Proofpoint-Virus-Version": "vendor=baseguard\n engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49\n definitions=2026-04-28_05,2026-04-28_01,2025-10-01_01", "X-Proofpoint-Spam-Details": "rule=outbound_notspam policy=outbound score=0\n clxscore=1015 suspectscore=0 adultscore=0 lowpriorityscore=0 phishscore=0\n spamscore=0 malwarescore=0 bulkscore=0 priorityscore=1501 impostorscore=0\n classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0\n reason=mlx scancount=1 engine=8.22.0-2604200000 definitions=main-2604290066", "Received-SPF": "pass client-ip=148.163.158.5;\n envelope-from=shivangu@linux.ibm.com; helo=mx0b-001b2d01.pphosted.com", "X-Spam_score_int": "-26", "X-Spam_score": "-2.7", "X-Spam_bar": "--", "X-Spam_report": "(-2.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,\n DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7,\n RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001,\n SPF_PASS=-0.001 autolearn=ham autolearn_force=no", "X-Spam_action": "no action", "X-BeenThere": "qemu-ppc@nongnu.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "<qemu-ppc.nongnu.org>", "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-ppc>,\n <mailto:qemu-ppc-request@nongnu.org?subject=unsubscribe>", "List-Archive": "<https://lists.nongnu.org/archive/html/qemu-ppc>", "List-Post": "<mailto:qemu-ppc@nongnu.org>", "List-Help": "<mailto:qemu-ppc-request@nongnu.org?subject=help>", "List-Subscribe": "<https://lists.nongnu.org/mailman/listinfo/qemu-ppc>,\n <mailto:qemu-ppc-request@nongnu.org?subject=subscribe>", "Errors-To": "qemu-ppc-bounces+incoming=patchwork.ozlabs.org@nongnu.org", "Sender": "qemu-ppc-bounces+incoming=patchwork.ozlabs.org@nongnu.org" }, "content": "When a ppc machine is started with maxcpus greater than the number of\npresent CPUs (e.g., -smp cpus=2,maxcpus=8), firmware allocates the CPU\nstate data buffer based on maxcpus and advertises this size to the\nkernel during fadump registration.\n\nHowever, fadump currently fails to generate a vmcore during the\nrebooted kernel because:\n\n1. The CPU state buffer length does not match what firmware advertised\n (QEMU only populates entries for present CPUs, not maxcpus)\n2. The kernel cannot find CPU data for all maxcpus slots\n\nThis patch adds placeholder entries for the unrealized cpus.\nThe placeholder entries contain only the CPUSTRT and CPUEND markers\nwith the CPU ID, which is sufficient for the kernel to recognize the\nCPU slot exists even though the CPU was never realized.\n\nThis ensures the CPU state buffer size and structure matches what\nfirmware advertised to the kernel, allowing fadump to successfully\ngenerate vmcore.\n\nCc: Aditya Gupta <adityag@linux.ibm.com>\nCc: Sourabh Jain <sourabhjain@linux.ibm.com>\nCc: Mahesh J Salgaonkar <mahesh@linux.ibm.com>\nCc: Harsh Prateek Bora <harshpb@linux.ibm.com>\nReported-by: Anushree Mathur <anushree.mathur@linux.vnet.ibm.com>\nSigned-off-by: Shivang Upadhyay <shivangu@linux.ibm.com>\n---\n hw/ppc/spapr_fadump.c | 57 +++++++++++++++++++++++++++++++++----------\n 1 file changed, 44 insertions(+), 13 deletions(-)", "diff": "diff --git a/hw/ppc/spapr_fadump.c b/hw/ppc/spapr_fadump.c\nindex 13cab0cfe1..b1a21ff115 100644\n--- a/hw/ppc/spapr_fadump.c\n+++ b/hw/ppc/spapr_fadump.c\n@@ -309,6 +309,30 @@ static bool do_preserve_region(FadumpSection *region)\n return true;\n }\n \n+/*\n+ * Populate placeholder register entries for an unrealized CPU\n+ *\n+ * For CPUs that are not realized (cpu_index < maxcpus), we need to\n+ * create minimal register entries containing only CPUSTRT and CPUEND\n+ * markers to maintain the expected buffer structure.\n+ *\n+ * Returns pointer just past the placeholder entries, which can be used\n+ * as the start address for the next CPU's register entries\n+ */\n+static FadumpRegEntry *populate_cpu_reg_entries_placeholder(int cpu_id,\n+ FadumpRegEntry *curr_reg_entry)\n+{\n+ curr_reg_entry->reg_id = cpu_to_be64(fadump_str_to_u64(\"CPUSTRT\"));\n+ curr_reg_entry->reg_value = cpu_to_be64(cpu_id & FADUMP_CPU_ID_MASK);\n+ ++curr_reg_entry;\n+\n+ curr_reg_entry->reg_id = cpu_to_be64(fadump_str_to_u64(\"CPUEND\"));\n+ curr_reg_entry->reg_value = cpu_to_be64(cpu_id & FADUMP_CPU_ID_MASK);\n+ ++curr_reg_entry;\n+\n+ return curr_reg_entry;\n+}\n+\n /*\n * Populate the passed CPUs register entries, in the buffer starting at\n * the argument 'curr_reg_entry'\n@@ -450,7 +474,7 @@ static FadumpRegEntry *populate_cpu_reg_entries(CPUState *cpu,\n * callers), and sets the size of this buffer in the argument\n * 'cpu_state_len'\n */\n-static void *get_cpu_state_data(uint64_t *cpu_state_len)\n+static void *get_cpu_state_data(uint64_t *cpu_state_len, MachineState *ms)\n {\n FadumpRegSaveAreaHeader reg_save_hdr;\n g_autofree FadumpRegEntry *reg_entries = NULL;\n@@ -459,15 +483,11 @@ static void *get_cpu_state_data(uint64_t *cpu_state_len)\n \n uint32_t num_reg_entries;\n uint32_t reg_entries_size;\n- uint32_t num_cpus = 0;\n+ uint32_t num_cpus = ms->smp.max_cpus;\n \n void *cpu_state_buffer = NULL;\n uint64_t offset = 0;\n \n- CPU_FOREACH(cpu) {\n- ++num_cpus;\n- }\n-\n reg_save_hdr.version = cpu_to_be32(0);\n reg_save_hdr.magic_number =\n cpu_to_be64(fadump_str_to_u64(\"REGSAVE\"));\n@@ -484,10 +504,20 @@ static void *get_cpu_state_data(uint64_t *cpu_state_len)\n /* Pointer to current CPU's registers */\n curr_reg_entry = reg_entries;\n \n- /* Populate register entries for all CPUs */\n- CPU_FOREACH(cpu) {\n- cpu_synchronize_state(cpu);\n- curr_reg_entry = populate_cpu_reg_entries(cpu, curr_reg_entry);\n+ /*\n+ * Populate register entries for all CPU slots (0 to maxcpus-1)\n+ */\n+ for (int i = 0; i < num_cpus; i++) {\n+ cpu = qemu_get_cpu(i);\n+ if (cpu) {\n+ /* CPU is realized - populate full register entries */\n+ cpu_synchronize_state(cpu);\n+ curr_reg_entry = populate_cpu_reg_entries(cpu, curr_reg_entry);\n+ } else {\n+ /* CPU slot is empty - populate placeholder entries */\n+ curr_reg_entry = populate_cpu_reg_entries_placeholder(i,\n+ curr_reg_entry);\n+ }\n }\n \n *cpu_state_len = 0;\n@@ -526,7 +556,7 @@ static void *get_cpu_state_data(uint64_t *cpu_state_len)\n * such as invalid destination address or non-fatal error errors likely\n * caused due to invalid parameters, return true and set region->error_flags\n */\n-static bool do_populate_cpu_state(FadumpSection *region)\n+static bool do_populate_cpu_state(FadumpSection *region, MachineState *ms)\n {\n uint64_t dest_addr = be64_to_cpu(region->destination_address);\n uint64_t cpu_state_len = 0;\n@@ -541,7 +571,7 @@ static bool do_populate_cpu_state(FadumpSection *region)\n attrs.user = 0;\n attrs.memory = 1;\n \n- cpu_state_buffer = get_cpu_state_data(&cpu_state_len);\n+ cpu_state_buffer = get_cpu_state_data(&cpu_state_len, ms);\n \n io_result = address_space_write(default_as, dest_addr, attrs,\n cpu_state_buffer, cpu_state_len);\n@@ -597,6 +627,7 @@ static bool do_populate_cpu_state(FadumpSection *region)\n static bool fadump_preserve_mem(SpaprMachineState *spapr)\n {\n FadumpMemStruct *fdm = &spapr->registered_fdm;\n+ MachineState *ms = MACHINE(spapr);\n uint16_t dump_num_sections, data_type;\n \n assert(spapr->fadump_registered);\n@@ -627,7 +658,7 @@ static bool fadump_preserve_mem(SpaprMachineState *spapr)\n \n switch (data_type) {\n case FADUMP_CPU_STATE_DATA:\n- if (!do_populate_cpu_state(&fdm->rgn[i])) {\n+ if (!do_populate_cpu_state(&fdm->rgn[i], ms)) {\n qemu_log_mask(LOG_GUEST_ERROR,\n \"FADump: Failed to store CPU State Data\");\n fdm->header.dump_status_flag |=\n", "prefixes": [] }