Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/814138/?format=api
{ "id": 814138, "url": "http://patchwork.ozlabs.org/api/patches/814138/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/patch/20170915080619.25250-9-xypron.glpk@gmx.de/", "project": { "id": 18, "url": "http://patchwork.ozlabs.org/api/projects/18/?format=api", "name": "U-Boot", "link_name": "uboot", "list_id": "u-boot.lists.denx.de", "list_email": "u-boot@lists.denx.de", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20170915080619.25250-9-xypron.glpk@gmx.de>", "list_archive_url": null, "date": "2017-09-15T08:06:17", "name": "[U-Boot,08/10] efi_selftest: test task priority levels", "commit_ref": "1835f6ea7133263dbb51977a420b84b41234b5f1", "pull_url": null, "state": "accepted", "archived": false, "hash": "a15ee3b867b610fe6643f187cbe013cbc95da46a", "submitter": { "id": 61270, "url": "http://patchwork.ozlabs.org/api/people/61270/?format=api", "name": "Heinrich Schuchardt", "email": "xypron.glpk@gmx.de" }, "delegate": { "id": 3400, "url": "http://patchwork.ozlabs.org/api/users/3400/?format=api", "username": "agraf", "first_name": "Alexander", "last_name": "Graf", "email": "agraf@suse.de" }, "mbox": "http://patchwork.ozlabs.org/project/uboot/patch/20170915080619.25250-9-xypron.glpk@gmx.de/mbox/", "series": [ { "id": 3244, "url": "http://patchwork.ozlabs.org/api/series/3244/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/list/?series=3244", "date": "2017-09-15T08:06:10", "name": "efi_loader: event services & API test", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/3244/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/814138/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/814138/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<u-boot-bounces@lists.denx.de>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org", "Authentication-Results": "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.denx.de\n\t(client-ip=81.169.180.215; helo=lists.denx.de;\n\tenvelope-from=u-boot-bounces@lists.denx.de;\n\treceiver=<UNKNOWN>)", "Received": [ "from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xtp7l0HtQz9sBZ\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 15 Sep 2017 18:13:38 +1000 (AEST)", "by lists.denx.de (Postfix, from userid 105)\n\tid B4EACC21FBF; Fri, 15 Sep 2017 08:09:33 +0000 (UTC)", "from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 7A875C21FBE;\n\tFri, 15 Sep 2017 08:08:16 +0000 (UTC)", "by lists.denx.de (Postfix, from userid 105)\n\tid 8649CC21EBE; Fri, 15 Sep 2017 08:07:44 +0000 (UTC)", "from mout.gmx.net (mout.gmx.net [212.227.17.21])\n\tby lists.denx.de (Postfix) with ESMTPS id 41E03C21DAA\n\tfor <u-boot@lists.denx.de>; Fri, 15 Sep 2017 08:07:41 +0000 (UTC)", "from laptop1.fritz.box ([94.197.120.111]) by mail.gmx.com (mrgmx102\n\t[212.227.17.174]) with ESMTPSA (Nemesis) id 0Lurin-1dS3tE0nbd-0104B6;\n\tFri, 15 Sep 2017 10:07:26 +0200" ], "X-Spam-Checker-Version": "SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de", "X-Spam-Level": "", "X-Spam-Status": "No, score=-0.7 required=5.0 tests=FREEMAIL_FROM,\n\tRCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,\n\tRCVD_IN_MSPIKE_WL autolearn=unavailable\n\tautolearn_force=no version=3.4.0", "From": "Heinrich Schuchardt <xypron.glpk@gmx.de>", "To": "Alexander Graf <agraf@suse.de>", "Date": "Fri, 15 Sep 2017 10:06:17 +0200", "Message-Id": "<20170915080619.25250-9-xypron.glpk@gmx.de>", "X-Mailer": "git-send-email 2.11.0", "In-Reply-To": "<20170915080619.25250-1-xypron.glpk@gmx.de>", "References": "<20170915080619.25250-1-xypron.glpk@gmx.de>", "X-Provags-ID": "V03:K0:+EVAHtJWBUZoGhMHCEDvI4j4LQIgsCxYM1JzkTKAg/skQ+GR6B0\n\tKKTdIExQ+qQ1mR71/BQfclsYTRYkzYGxjkj77IrtEyYoZEm1zQxY7V0x8WLAHWqIRFSSKaY\n\tGCoVRkA6q7k5CI9ZD0pfCYR2OeXsJxHkeUvald9cBfBtJy34hNjZhmlAGSPmzYqsSrLdNwu\n\tKKyRz5/M6wUFSTCSCFoQw==", "X-UI-Out-Filterresults": "notjunk:1; V01:K0:3/guBmeSF58=:0wASq0C8Q2Bv2aKRzuoce7\n\tzJ8oC2JdxuPiQ4/d9ZlxBh5wq/iIp/nQ1nRwVPd6bC2N9GXWsdSvSVO9u0q2/s2C04YbV60/J\n\ts/Q4cY/gzTcExp1TRcwPWOR0BUYycmt6Z4QzGqbTJzodtf9/LKY74IGRvvRZNF7Ywc7Brqz1Q\n\t3wQTnGAsYzX8MHnYlKVp6S628MTiCwzKEysLsdlC/Fu/30eAqHrMb1oVZndblc3/4RiDca60f\n\trNaUzRFUJYP49bHMpjX5Kzar54u0Ghqxl5Cc6TADl2WJ6Au8IdQrCKBCv+fZqE4X0QFbhK1Oe\n\tYv7WXMEcNaFZvUjRn2VoQgHVpxjeFnSjtjSl4M/+LqFQFN3WmcYUmSbOWpzqP+YovzhWWp72W\n\twpiGD3vtViNJkSVul/zXG309rP/Vf6Q0TiUDTfHx5XnkPsTI5ifmx9Av8SnyL4GhiFTYQ6USR\n\tQtxYlZO8inGWNxIyXjO994Z4WpAZMdevR7TCiVYpo2Sy06AOAO9wOQFAtaAsjoFD04cTz4WGP\n\tPn3xMtM0/fVHzbHqd8qtEekpxghoH3Wxusz5SeFv8JGMH+xGb+a5NlUoT/Avmi0337m3l43zN\n\tfX3HINLbE7RZ8EvrMwFbKkdPIytr1TPcySPGrfW0qh1Abzj+9Uxeik5D9x3HgNGko4Em0IJLi\n\tNMKyTyGjZc9k3O0A9d9e20L7OXIjkf1RMshLGma832X1r6wehNrQrL2iUmXrgyQzbyJpqNE04\n\tqO8lZZlYXRoP18Vuip6ncmqE4tL2pSgisHD3NT88h3pUvrIBwl8w6cVfw9VESLrceputiDB6a\n\tOh9dTtKJDVWgUq9i2L9B52k1zHoqQ==", "Cc": "=?utf-8?q?=C5=81ukasz_Majewski?= <l.majewski@samsung.com>,\n\tHeinrich Schuchardt <xypron.glpk@gmx.de>, Andy Shevchenko\n\t<andriy.shevchenko@linux.intel.com>, u-boot@lists.denx.de, Fabio Estevam\n\t<fabio.estevam@nxp.com>, Maxime Ripard <maxime.ripard@free-electrons.com>", "Subject": "[U-Boot] [PATCH 08/10] efi_selftest: test task priority levels", "X-BeenThere": "u-boot@lists.denx.de", "X-Mailman-Version": "2.1.18", "Precedence": "list", "List-Id": "U-Boot discussion <u-boot.lists.denx.de>", "List-Unsubscribe": "<https://lists.denx.de/options/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>", "List-Archive": "<http://lists.denx.de/pipermail/u-boot/>", "List-Post": "<mailto:u-boot@lists.denx.de>", "List-Help": "<mailto:u-boot-request@lists.denx.de?subject=help>", "List-Subscribe": "<https://lists.denx.de/listinfo/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"utf-8\"", "Content-Transfer-Encoding": "base64", "Errors-To": "u-boot-bounces@lists.denx.de", "Sender": "\"U-Boot\" <u-boot-bounces@lists.denx.de>" }, "content": "Run a 10 ms periodic timer and check that it is called 10 times\nwhile waiting for 100 ms single shot timer.\n\nRaise the TPL level to the level of the 10 ms timer and observe\nthat the notification function is not called again.\n\nLower the TPL level and check that the queued notification\nfunction is called.\n\nSigned-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>\n---\n lib/efi_selftest/Makefile | 5 +-\n lib/efi_selftest/efi_selftest_tpl.c | 214 ++++++++++++++++++++++++++++++++++++\n 2 files changed, 218 insertions(+), 1 deletion(-)\n create mode 100644 lib/efi_selftest/efi_selftest_tpl.c", "diff": "diff --git a/lib/efi_selftest/Makefile b/lib/efi_selftest/Makefile\nindex a71c8bf937..ddf304e1fa 100644\n--- a/lib/efi_selftest/Makefile\n+++ b/lib/efi_selftest/Makefile\n@@ -13,8 +13,11 @@ CFLAGS_efi_selftest_console.o := $(CFLAGS_EFI)\n CFLAGS_REMOVE_efi_selftest_console.o := $(CFLAGS_NON_EFI)\n CFLAGS_efi_selftest_events.o := $(CFLAGS_EFI)\n CFLAGS_REMOVE_efi_selftest_events.o := $(CFLAGS_NON_EFI)\n+CFLAGS_efi_selftest_tpl.o := $(CFLAGS_EFI)\n+CFLAGS_REMOVE_efi_selftest_tpl.o := $(CFLAGS_NON_EFI)\n \n obj-$(CONFIG_CMD_BOOTEFI_SELFTEST) += \\\n efi_selftest.o \\\n efi_selftest_console.o \\\n-efi_selftest_events.o\n+efi_selftest_events.o \\\n+efi_selftest_tpl.o\ndiff --git a/lib/efi_selftest/efi_selftest_tpl.c b/lib/efi_selftest/efi_selftest_tpl.c\nnew file mode 100644\nindex 0000000000..90ace0f51e\n--- /dev/null\n+++ b/lib/efi_selftest/efi_selftest_tpl.c\n@@ -0,0 +1,214 @@\n+/*\n+ * efi_selftest_events\n+ *\n+ * Copyright (c) 2017 Heinrich Schuchardt <xypron.glpk@gmx.de>\n+ *\n+ * SPDX-License-Identifier: GPL-2.0+\n+ *\n+ * This unit test uses timer events to check the handling of\n+ * task priority levels.\n+ */\n+\n+#include <efi_selftest.h>\n+\n+static struct efi_event *event_notify;\n+static struct efi_event *event_wait;\n+static unsigned int counter;\n+static struct efi_boot_services *boottime;\n+\n+/*\n+ * Notification function, increments a counter.\n+ *\n+ * @event\tnotified event\n+ * @context\tpointer to the counter\n+ */\n+static void EFIAPI notify(struct efi_event *event, void *context)\n+{\n+\tif (!context)\n+\t\treturn;\n+\t++*(unsigned int *)context;\n+}\n+\n+/*\n+ * Setup unit test.\n+ *\n+ * Create two timer events.\n+ * One with EVT_NOTIFY_SIGNAL, the other with EVT_NOTIFY_WAIT.\n+ *\n+ * @handle:\thandle of the loaded image\n+ * @systable:\tsystem table\n+ */\n+static int setup(const efi_handle_t handle,\n+\t\t const struct efi_system_table *systable)\n+{\n+\tefi_status_t ret;\n+\n+\tboottime = systable->boottime;\n+\n+\tret = boottime->create_event(EVT_TIMER | EVT_NOTIFY_SIGNAL,\n+\t\t\t\t TPL_CALLBACK, notify, (void *)&counter,\n+\t\t\t\t &event_notify);\n+\tif (ret != EFI_SUCCESS) {\n+\t\tefi_st_error(\"could not create event\\n\");\n+\t\treturn 1;\n+\t}\n+\tret = boottime->create_event(EVT_TIMER | EVT_NOTIFY_WAIT,\n+\t\t\t\t TPL_HIGH_LEVEL, notify, NULL, &event_wait);\n+\tif (ret != EFI_SUCCESS) {\n+\t\tefi_st_error(\"could not create event\\n\");\n+\t\treturn 1;\n+\t}\n+\treturn 0;\n+}\n+\n+/*\n+ * Tear down unit test.\n+ *\n+ * Close the events created in setup.\n+ */\n+static int teardown(void)\n+{\n+\tefi_status_t ret;\n+\n+\tif (event_notify) {\n+\t\tret = boottime->close_event(event_notify);\n+\t\tevent_notify = NULL;\n+\t\tif (ret != EFI_SUCCESS) {\n+\t\t\tefi_st_error(\"could not close event\\n\");\n+\t\t\treturn 1;\n+\t\t}\n+\t}\n+\tif (event_wait) {\n+\t\tret = boottime->close_event(event_wait);\n+\t\tevent_wait = NULL;\n+\t\tif (ret != EFI_SUCCESS) {\n+\t\t\tefi_st_error(\"could not close event\\n\");\n+\t\t\treturn 1;\n+\t\t}\n+\t}\n+\tboottime->restore_tpl(TPL_APPLICATION);\n+\treturn 0;\n+}\n+\n+/*\n+ * Execute unit test.\n+ *\n+ * Run a 10 ms periodic timer and check that it is called 10 times\n+ * while waiting for 100 ms single shot timer.\n+ *\n+ * Raise the TPL level to the level of the 10 ms timer and observe\n+ * that the notification function is not called again.\n+ *\n+ * Lower the TPL level and check that the queued notification\n+ * function is called.\n+ */\n+static int execute(void)\n+{\n+\tunsigned long index;\n+\tefi_status_t ret;\n+\tUINTN old_tpl;\n+\n+\t/* Set 10 ms timer */\n+\tcounter = 0;\n+\tret = boottime->set_timer(event_notify, EFI_TIMER_PERIODIC, 100000);\n+\tif (ret != EFI_SUCCESS) {\n+\t\tefi_st_error(\"Could not set timer\\n\");\n+\t\treturn 1;\n+\t}\n+\t/* Set 100 ms timer */\n+\tret = boottime->set_timer(event_wait, EFI_TIMER_RELATIVE, 1000000);\n+\tif (ret != EFI_SUCCESS) {\n+\t\tefi_st_error(\"Could not set timer\\n\");\n+\t\treturn 1;\n+\t}\n+\tindex = 5;\n+\tret = boottime->wait_for_event(1, &event_wait, &index);\n+\tif (ret != EFI_SUCCESS) {\n+\t\tefi_st_error(\"Could not wait for event\\n\");\n+\t\treturn 1;\n+\t}\n+\tret = boottime->check_event(event_wait);\n+\tif (ret != EFI_NOT_READY) {\n+\t\tefi_st_error(\"Signaled state was not cleared.\\n\");\n+\t\tefi_st_printf(\"ret = %u\\n\", (unsigned int)ret);\n+\t\treturn 1;\n+\t}\n+\tif (index != 0) {\n+\t\tefi_st_error(\"WaitForEvent returned wrong index\\n\");\n+\t\treturn 1;\n+\t}\n+\tefi_st_printf(\"Counter with TPL level TPL_APPLICATION: %u\\n\", counter);\n+\tif (counter < 8 || counter > 12) {\n+\t\tefi_st_error(\"Incorrect timing of events\\n\");\n+\t\treturn 1;\n+\t}\n+\tret = boottime->set_timer(event_notify, EFI_TIMER_STOP, 0);\n+\tif (index != 0) {\n+\t\tefi_st_error(\"Could not cancel timer\\n\");\n+\t\treturn 1;\n+\t}\n+\t/* Raise TPL level */\n+\told_tpl = boottime->raise_tpl(TPL_CALLBACK);\n+\tif (old_tpl != TPL_APPLICATION) {\n+\t\tefi_st_error(\"Initial TPL level was not TPL_APPLICATION\");\n+\t\treturn 1;\n+\t}\n+\t/* Set 10 ms timer */\n+\tcounter = 0;\n+\tret = boottime->set_timer(event_notify, EFI_TIMER_PERIODIC, 100000);\n+\tif (index != 0) {\n+\t\tefi_st_error(\"Could not set timer\\n\");\n+\t\treturn 1;\n+\t}\n+\t/* Set 100 ms timer */\n+\tret = boottime->set_timer(event_wait, EFI_TIMER_RELATIVE, 1000000);\n+\tif (ret != EFI_SUCCESS) {\n+\t\tefi_st_error(\"Could not set timer\\n\");\n+\t\treturn 1;\n+\t}\n+\tdo {\n+\t\tret = boottime->check_event(event_wait);\n+\t} while (ret == EFI_NOT_READY);\n+\tif (ret != EFI_SUCCESS) {\n+\t\tefi_st_error(\"Could not check event\\n\");\n+\t\treturn 1;\n+\t}\n+\tefi_st_printf(\"Counter with TPL level TPL_CALLBACK: %u\\n\", counter);\n+\tif (counter != 0) {\n+\t\tefi_st_error(\"Suppressed timer fired\\n\");\n+\t\treturn 1;\n+\t}\n+\t/* Set 1 ms timer */\n+\tret = boottime->set_timer(event_wait, EFI_TIMER_RELATIVE, 1000);\n+\tif (ret != EFI_SUCCESS) {\n+\t\tefi_st_error(\"Could not set timer\\n\");\n+\t\treturn 1;\n+\t}\n+\t/* Restore the old TPL level */\n+\tboottime->restore_tpl(TPL_APPLICATION);\n+\tret = boottime->wait_for_event(1, &event_wait, &index);\n+\tif (ret != EFI_SUCCESS) {\n+\t\tefi_st_error(\"Could not wait for event\\n\");\n+\t\treturn 1;\n+\t}\n+\tefi_st_printf(\"Counter with TPL level TPL_APPLICATION: %u\\n\", counter);\n+\tif (counter < 1) {\n+\t\tefi_st_error(\"Queued timer event did not fire\\n\");\n+\t\treturn 1;\n+\t}\n+\tret = boottime->set_timer(event_wait, EFI_TIMER_STOP, 0);\n+\tif (index != 0) {\n+\t\tefi_st_error(\"Could not cancel timer\\n\");\n+\t\treturn 1;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+EFI_UNIT_TEST(tpl) = {\n+\t.name = \"task priority levels\",\n+\t.phase = EFI_EXECUTE_BEFORE_BOOTTIME_EXIT,\n+\t.setup = setup,\n+\t.execute = execute,\n+\t.teardown = teardown,\n+};\n", "prefixes": [ "U-Boot", "08/10" ] }