{"id":807849,"url":"http://patchwork.ozlabs.org/api/1.0/patches/807849/?format=json","project":{"id":14,"url":"http://patchwork.ozlabs.org/api/1.0/projects/14/?format=json","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":""},"msgid":"<20170830182141.19996-3-danielhb@linux.vnet.ibm.com>","date":"2017-08-30T18:21:40","name":"[for-2.11,v3,2/3] hw/ppc: clear pending_events on machine reset","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"591ac4dbc377c04a87cb6eb02afdf61598cd0e96","submitter":{"id":64623,"url":"http://patchwork.ozlabs.org/api/1.0/people/64623/?format=json","name":"Daniel Henrique Barboza","email":"danielhb@linux.vnet.ibm.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20170830182141.19996-3-danielhb@linux.vnet.ibm.com/mbox/","series":[{"id":681,"url":"http://patchwork.ozlabs.org/api/1.0/series/681/?format=json","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/"}],"check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/807849/checks/","tags":{},"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 3xjDPy6ykcz9s7C\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 31 Aug 2017 04:22:46 +1000 (AEST)","from localhost ([::1]:52124 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 1dn7dU-000596-OZ\n\tfor incoming@patchwork.ozlabs.org; Wed, 30 Aug 2017 14:22:44 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:57234)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <danielhb@linux.vnet.ibm.com>) id 1dn7cs-00054g-PA\n\tfor qemu-devel@nongnu.org; Wed, 30 Aug 2017 14:22:11 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <danielhb@linux.vnet.ibm.com>) id 1dn7cn-0006Qe-Oj\n\tfor qemu-devel@nongnu.org; Wed, 30 Aug 2017 14:22:06 -0400","from mx0b-001b2d01.pphosted.com ([148.163.158.5]:60744\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 1dn7cn-0006QH-HW\n\tfor qemu-devel@nongnu.org; Wed, 30 Aug 2017 14:22:01 -0400","from pps.filterd (m0098416.ppops.net [127.0.0.1])\n\tby mx0b-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id\n\tv7UIJhoR133660\n\tfor <qemu-devel@nongnu.org>; Wed, 30 Aug 2017 14:22:01 -0400","from e14.ny.us.ibm.com (e14.ny.us.ibm.com [129.33.205.204])\n\tby mx0b-001b2d01.pphosted.com with ESMTP id 2cnxtfev8a-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:00 -0400","from localhost\n\tby e14.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:00 -0400","from b01cxnp23032.gho.pok.ibm.com (9.57.198.27)\n\tby e14.ny.us.ibm.com (146.89.104.201) with IBM ESMTP SMTP Gateway:\n\tAuthorized Use Only! Violators will be prosecuted; \n\tWed, 30 Aug 2017 14:21:57 -0400","from b01ledav005.gho.pok.ibm.com (b01ledav005.gho.pok.ibm.com\n\t[9.57.199.110])\n\tby b01cxnp23032.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP\n\tid v7UILuVi23986378; Wed, 30 Aug 2017 18:21:56 GMT","from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1])\n\tby IMSVA (Postfix) with ESMTP id 205F6AE043;\n\tWed, 30 Aug 2017 14:22:21 -0400 (EDT)","from localhost.localdomain (unknown [9.80.235.18])\n\tby b01ledav005.gho.pok.ibm.com (Postfix) with ESMTP id B89DDAE03C;\n\tWed, 30 Aug 2017 14:22:19 -0400 (EDT)"],"From":"Daniel Henrique Barboza <danielhb@linux.vnet.ibm.com>","To":"qemu-devel@nongnu.org","Date":"Wed, 30 Aug 2017 15:21:40 -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-0052-0000-0000-000002582831","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:21:58","X-IBM-AV-DETECTION":"SAVI=unused REMOTE=unused XFE=unused","x-cbparentid":"17083018-0053-0000-0000-000051D6A3E0","Message-Id":"<20170830182141.19996-3-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=3\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 2/3] hw/ppc: clear pending_events\n\ton machine reset","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":"The sPAPR machine isn't clearing up the pending events QTAILQ on\nmachine reboot. This allows for unprocessed hotplug/epow events\nto persist in the queue after reset and, when reasserting the IRQs in\ncheck_exception later on, these will be being processed by the OS.\n\nThis patch implements a new function called 'spapr_clear_pending_events'\nthat clears up the pending_events QTAILQ. This helper is then called\ninside ppc_spapr_reset to clear up the events queue, preventing\nold/deprecated events from persisting after a reset.\n\nSigned-off-by: Daniel Henrique Barboza <danielhb@linux.vnet.ibm.com>\n---\n hw/ppc/spapr.c         |  1 +\n hw/ppc/spapr_events.c  | 11 +++++++++++\n include/hw/ppc/spapr.h |  1 +\n 3 files changed, 13 insertions(+)","diff":"diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c\nindex fb1e5e0..085415c 100644\n--- a/hw/ppc/spapr.c\n+++ b/hw/ppc/spapr.c\n@@ -1392,6 +1392,7 @@ static void ppc_spapr_reset(void)\n     }\n \n     qemu_devices_reset();\n+    spapr_clear_pending_events(spapr);\n \n     /*\n      * We place the device tree and RTAS just below either the top of the RMA,\ndiff --git a/hw/ppc/spapr_events.c b/hw/ppc/spapr_events.c\nindex f952b78..66b8164 100644\n--- a/hw/ppc/spapr_events.c\n+++ b/hw/ppc/spapr_events.c\n@@ -700,6 +700,17 @@ static void event_scan(PowerPCCPU *cpu, sPAPRMachineState *spapr,\n     rtas_st(rets, 0, RTAS_OUT_NO_ERRORS_FOUND);\n }\n \n+void spapr_clear_pending_events(sPAPRMachineState *spapr)\n+{\n+    sPAPREventLogEntry *entry = NULL;\n+\n+    QTAILQ_FOREACH(entry, &spapr->pending_events, next) {\n+        QTAILQ_REMOVE(&spapr->pending_events, entry, next);\n+        g_free(entry->extended_log);\n+        g_free(entry);\n+    }\n+}\n+\n void spapr_events_init(sPAPRMachineState *spapr)\n {\n     QTAILQ_INIT(&spapr->pending_events);\ndiff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h\nindex 86c982c..91617e3 100644\n--- a/include/hw/ppc/spapr.h\n+++ b/include/hw/ppc/spapr.h\n@@ -662,6 +662,7 @@ void spapr_cpu_parse_features(sPAPRMachineState *spapr);\n int spapr_hpt_shift_for_ramsize(uint64_t ramsize);\n void spapr_reallocate_hpt(sPAPRMachineState *spapr, int shift,\n                           Error **errp);\n+void spapr_clear_pending_events(sPAPRMachineState *spapr);\n \n /* CPU and LMB DRC release callbacks. */\n void spapr_core_release(DeviceState *dev);\n","prefixes":["for-2.11","v3","2/3"]}