Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/807852/?format=api
{ "id": 807852, "url": "http://patchwork.ozlabs.org/api/patches/807852/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170830182141.19996-4-danielhb@linux.vnet.ibm.com/", "project": { "id": 14, "url": "http://patchwork.ozlabs.org/api/projects/14/?format=api", "name": "QEMU Development", "link_name": "qemu-devel", "list_id": "qemu-devel.nongnu.org", "list_email": "qemu-devel@nongnu.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20170830182141.19996-4-danielhb@linux.vnet.ibm.com>", "list_archive_url": null, "date": "2017-08-30T18:21:41", "name": "[for-2.11,v3,3/3] hw/ppc: CAS reset on early device hotplug", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "8fe0d84e10625032e5e82bc45a36aa576f420bd6", "submitter": { "id": 64623, "url": "http://patchwork.ozlabs.org/api/people/64623/?format=api", "name": "Daniel Henrique Barboza", "email": "danielhb@linux.vnet.ibm.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170830182141.19996-4-danielhb@linux.vnet.ibm.com/mbox/", "series": [ { "id": 681, "url": "http://patchwork.ozlabs.org/api/series/681/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=681", "date": "2017-08-30T18:21:38", "name": "hw/ppc: CAS reset on early device hotplug", "version": 3, "mbox": "http://patchwork.ozlabs.org/series/681/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/807852/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/807852/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org", "Authentication-Results": "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)", "Received": [ "from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xjDTY6gwwz9sNc\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 31 Aug 2017 04:25:53 +1000 (AEST)", "from localhost ([::1]:52146 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dn7gV-00083V-OX\n\tfor incoming@patchwork.ozlabs.org; Wed, 30 Aug 2017 14:25:51 -0400", "from eggs.gnu.org ([2001:4830:134:3::10]:57245)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <danielhb@linux.vnet.ibm.com>) id 1dn7cv-00056P-GJ\n\tfor qemu-devel@nongnu.org; Wed, 30 Aug 2017 14:22:13 -0400", "from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <danielhb@linux.vnet.ibm.com>) id 1dn7cr-0006Rs-7m\n\tfor qemu-devel@nongnu.org; Wed, 30 Aug 2017 14:22:09 -0400", "from mx0b-001b2d01.pphosted.com ([148.163.158.5]:44322\n\thelo=mx0a-001b2d01.pphosted.com)\n\tby eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <danielhb@linux.vnet.ibm.com>)\n\tid 1dn7cr-0006Ra-1f\n\tfor qemu-devel@nongnu.org; Wed, 30 Aug 2017 14:22:05 -0400", "from pps.filterd (m0098420.ppops.net [127.0.0.1])\n\tby mx0b-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id\n\tv7UIJliG014217\n\tfor <qemu-devel@nongnu.org>; Wed, 30 Aug 2017 14:22:04 -0400", "from e16.ny.us.ibm.com (e16.ny.us.ibm.com [129.33.205.206])\n\tby mx0b-001b2d01.pphosted.com with ESMTP id 2cnx0xu48r-1\n\t(version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT)\n\tfor <qemu-devel@nongnu.org>; Wed, 30 Aug 2017 14:22:04 -0400", "from localhost\n\tby e16.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use\n\tOnly! Violators will be prosecuted\n\tfor <qemu-devel@nongnu.org> from <danielhb@linux.vnet.ibm.com>;\n\tWed, 30 Aug 2017 14:22:03 -0400", "from b01cxnp22036.gho.pok.ibm.com (9.57.198.26)\n\tby e16.ny.us.ibm.com (146.89.104.203) with IBM ESMTP SMTP Gateway:\n\tAuthorized Use Only! Violators will be prosecuted; \n\tWed, 30 Aug 2017 14:22:00 -0400", "from b01ledav005.gho.pok.ibm.com (b01ledav005.gho.pok.ibm.com\n\t[9.57.199.110])\n\tby b01cxnp22036.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP\n\tid v7UILxGb30736502; Wed, 30 Aug 2017 18:21:59 GMT", "from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1])\n\tby IMSVA (Postfix) with ESMTP id DA0ECAE03C;\n\tWed, 30 Aug 2017 14:22:23 -0400 (EDT)", "from localhost.localdomain (unknown [9.80.235.18])\n\tby b01ledav005.gho.pok.ibm.com (Postfix) with ESMTP id 7EC18AE04B;\n\tWed, 30 Aug 2017 14:22:22 -0400 (EDT)" ], "From": "Daniel Henrique Barboza <danielhb@linux.vnet.ibm.com>", "To": "qemu-devel@nongnu.org", "Date": "Wed, 30 Aug 2017 15:21:41 -0300", "X-Mailer": "git-send-email 2.9.4", "In-Reply-To": "<20170830182141.19996-1-danielhb@linux.vnet.ibm.com>", "References": "<20170830182141.19996-1-danielhb@linux.vnet.ibm.com>", "X-TM-AS-GCONF": "00", "x-cbid": "17083018-0024-0000-0000-000002C7C2E2", "X-IBM-SpamModules-Scores": "", "X-IBM-SpamModules-Versions": "BY=3.00007637; HX=3.00000241; KW=3.00000007;\n\tPH=3.00000004; SC=3.00000226; SDB=6.00909837; UDB=6.00456354;\n\tIPR=6.00690121; \n\tBA=6.00005562; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009;\n\tZB=6.00000000; \n\tZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00016930;\n\tXFM=3.00000015; UTC=2017-08-30 18:22:01", "X-IBM-AV-DETECTION": "SAVI=unused REMOTE=unused XFE=unused", "x-cbparentid": "17083018-0025-0000-0000-000045432562", "Message-Id": "<20170830182141.19996-4-danielhb@linux.vnet.ibm.com>", "X-Proofpoint-Virus-Version": "vendor=fsecure engine=2.50.10432:, ,\n\tdefinitions=2017-08-30_08:, , signatures=0", "X-Proofpoint-Spam-Details": "rule=outbound_notspam policy=outbound score=0\n\tspamscore=0 suspectscore=1\n\tmalwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam\n\tadjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000\n\tdefinitions=main-1708300278", "X-detected-operating-system": "by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy]", "X-Received-From": "148.163.158.5", "Subject": "[Qemu-devel] [PATCH for-2.11 v3 3/3] hw/ppc: CAS reset on early\n\tdevice hotplug", "X-BeenThere": "qemu-devel@nongnu.org", "X-Mailman-Version": "2.1.21", "Precedence": "list", "List-Id": "<qemu-devel.nongnu.org>", "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>", "List-Archive": "<http://lists.nongnu.org/archive/html/qemu-devel/>", "List-Post": "<mailto:qemu-devel@nongnu.org>", "List-Help": "<mailto:qemu-devel-request@nongnu.org?subject=help>", "List-Subscribe": "<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>", "Cc": "qemu-ppc@nongnu.org, mdroth@linux.vnet.ibm.com,\n\tdavid@gibson.dropbear.id.au", "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org", "Sender": "\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>" }, "content": "This patch is a follow up on the discussions made in patch\n\"hw/ppc: disable hotplug before CAS is completed\" that can be\nfound at [1].\n\nAt this moment, we do not support CPU/memory hotplug in early\nboot stages, before CAS. When a hotplug occurs, the event is logged\nin an internal RTAS event log queue and an IRQ pulse is fired. In\nregular conditions, the guest handles the interrupt by executing\ncheck_exception, fetching the generated hotplug event and enabling\nthe device for use.\n\nIn early boot, this IRQ isn't caught (SLOF does not handle hotplug\nevents), leaving the event in the rtas event log queue. If the guest\nexecutes check_exception due to another hotplug event, the re-assertion\nof the IRQ ends up de-queuing the first hotplug event as well. In short,\na device hotplugged before CAS is considered coldplugged by SLOF.\nThis leads to device misbehavior and, in some cases, guest kernel\nOoops when trying to unplug the device.\n\nA proper fix would be to turn every device hotplugged before CAS\nas a colplugged device. This is not trivial to do with the current\ncode base though - the FDT is written in the guest memory at\nppc_spapr_reset and can't be retrieved without adding extra state\n(fdt_size for example) that will need to managed and migrated. Adding\nthe hotplugged DT in the middle of CAS negotiation via the updated DT\ntree works with CPU devs, but panics the guest kernel at boot. Additional\nanalysis would be necessary for LMBs and PCI devices. There are\nquestions to be made in QEMU/SLOF/kernel level about how we can make\nthis change in a sustainable way.\n\nWith Linux guests, a fix would be the kernel executing check_exception\nat boot time, de-queueing the events that happened in early boot and\nprocessing them. However, even if/when the newer kernels start\nfetching these events at boot time, we need to take care of older\nkernels that won't be doing that.\n\nThis patch works around the situation by issuing a CAS reset if a hotplugged\ndevice is detected during CAS:\n\n- the DRC conditions that warrant a CAS reset is the same as those that\ntriggers a DRC migration - the DRC must have a device attached and\nthe DRC state is not equal to its ready_state. With that in mind, this\npatch makes use of 'spapr_drc_needed' to determine if a CAS reset\nis needed.\n\n- In the middle of CAS negotiations, the function\n'spapr_hotplugged_dev_before_cas' goes through all the DRCs to see\nif there are any DRC that requires a reset, using spapr_drc_needed. If\nthat happens, returns '1' in 'spapr_h_cas_compose_response' which will set\nspapr->cas_reboot to true, causing the machine to reboot.\n\nNo changes are made for coldplug devices.\n\n[1] http://lists.nongnu.org/archive/html/qemu-devel/2017-08/msg02855.html\n\nSigned-off-by: Daniel Henrique Barboza <danielhb@linux.vnet.ibm.com>\n---\n hw/ppc/spapr.c | 26 +++++++++++++++++++++++++-\n hw/ppc/spapr_drc.c | 2 +-\n include/hw/ppc/spapr_drc.h | 1 +\n 3 files changed, 27 insertions(+), 2 deletions(-)", "diff": "diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c\nindex 085415c..067f571 100644\n--- a/hw/ppc/spapr.c\n+++ b/hw/ppc/spapr.c\n@@ -790,6 +790,26 @@ out:\n return ret;\n }\n \n+static bool spapr_hotplugged_dev_before_cas(void)\n+{\n+ Object *drc_container, *obj;\n+ ObjectProperty *prop;\n+ ObjectPropertyIterator iter;\n+\n+ drc_container = container_get(object_get_root(), \"/dr-connector\");\n+ object_property_iter_init(&iter, drc_container);\n+ while ((prop = object_property_iter_next(&iter))) {\n+ if (!strstart(prop->type, \"link<\", NULL)) {\n+ continue;\n+ }\n+ obj = object_property_get_link(drc_container, prop->name, NULL);\n+ if (spapr_drc_needed(obj)) {\n+ return true;\n+ }\n+ }\n+ return false;\n+}\n+\n int spapr_h_cas_compose_response(sPAPRMachineState *spapr,\n target_ulong addr, target_ulong size,\n sPAPROptionVector *ov5_updates)\n@@ -797,9 +817,13 @@ int spapr_h_cas_compose_response(sPAPRMachineState *spapr,\n void *fdt, *fdt_skel;\n sPAPRDeviceTreeUpdateHeader hdr = { .version_id = 1 };\n \n+ if (spapr_hotplugged_dev_before_cas()) {\n+ return 1;\n+ }\n+\n size -= sizeof(hdr);\n \n- /* Create sceleton */\n+ /* Create skeleton */\n fdt_skel = g_malloc0(size);\n _FDT((fdt_create(fdt_skel, size)));\n _FDT((fdt_begin_node(fdt_skel, \"\")));\ndiff --git a/hw/ppc/spapr_drc.c b/hw/ppc/spapr_drc.c\nindex 6670a76..915e9b5 100644\n--- a/hw/ppc/spapr_drc.c\n+++ b/hw/ppc/spapr_drc.c\n@@ -460,7 +460,7 @@ static void drc_reset(void *opaque)\n spapr_drc_reset(SPAPR_DR_CONNECTOR(opaque));\n }\n \n-static bool spapr_drc_needed(void *opaque)\n+bool spapr_drc_needed(void *opaque)\n {\n sPAPRDRConnector *drc = (sPAPRDRConnector *)opaque;\n sPAPRDRConnectorClass *drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc);\ndiff --git a/include/hw/ppc/spapr_drc.h b/include/hw/ppc/spapr_drc.h\nindex a7958d0..f8d9f5b 100644\n--- a/include/hw/ppc/spapr_drc.h\n+++ b/include/hw/ppc/spapr_drc.h\n@@ -257,6 +257,7 @@ int spapr_drc_populate_dt(void *fdt, int fdt_offset, Object *owner,\n void spapr_drc_attach(sPAPRDRConnector *drc, DeviceState *d, void *fdt,\n int fdt_start_offset, Error **errp);\n void spapr_drc_detach(sPAPRDRConnector *drc);\n+bool spapr_drc_needed(void *opaque);\n \n static inline bool spapr_drc_unplug_requested(sPAPRDRConnector *drc)\n {\n", "prefixes": [ "for-2.11", "v3", "3/3" ] }