From: Narcisa Ana Maria Vasile <navasile@linux.microsoft.com>
To: dev@dpdk.org, thomas@monjalon.net, haramakr@linux.microsoft.com,
ocardona@microsoft.com, pallavi.kadam@intel.com,
dmitry.kozliuk@gmail.com
Cc: ranjit.menon@intel.com, dmitrym@microsoft.com,
Narcisa Vasile <navasile@microsoft.com>
Subject: [dpdk-dev] [PATCH 16/22] uio: Wrap call into try/except block
Date: Thu, 13 Aug 2020 16:21:39 -0700 [thread overview]
Message-ID: <1597360905-74106-17-git-send-email-navasile@linux.microsoft.com> (raw)
In-Reply-To: <1597360905-74106-1-git-send-email-navasile@linux.microsoft.com>
From: Narcisa Vasile <navasile@microsoft.com>
MmMapLockedPagesSpecifyCache can raise an exception when
it cannot map the specified pages.
Signed-off-by: Narcisa Vasile <navasile@microsoft.com>
Reported-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
---
kernel/windows/netuio/netuio_queue.c | 36 ++++++++++++++++++----------
1 file changed, 23 insertions(+), 13 deletions(-)
diff --git a/kernel/windows/netuio/netuio_queue.c b/kernel/windows/netuio/netuio_queue.c
index 9c7ff7d06..c2bc998dc 100644
--- a/kernel/windows/netuio/netuio_queue.c
+++ b/kernel/windows/netuio/netuio_queue.c
@@ -53,13 +53,18 @@ netuio_map_address_into_user_process(_In_ PNETUIO_CONTEXT_DATA netuio_contextdat
// Map the scratch memory regions to the user's process context
MmBuildMdlForNonPagedPool(netuio_contextdata->dpdk_seg.mdl);
- netuio_contextdata->dpdk_seg.mem.user_mapped_virt_addr =
- MmMapLockedPagesSpecifyCache(
- netuio_contextdata->dpdk_seg.mdl, UserMode, MmCached,
- NULL, FALSE, (NormalPagePriority | MdlMappingNoExecute));
+ __try {
+ netuio_contextdata->dpdk_seg.mem.user_mapped_virt_addr =
+ MmMapLockedPagesSpecifyCache(netuio_contextdata->dpdk_seg.mdl, UserMode,
+ MmCached, NULL, FALSE, NormalPagePriority);
- if (netuio_contextdata->dpdk_seg.mem.user_mapped_virt_addr == NULL) {
- status = STATUS_INSUFFICIENT_RESOURCES;
+ if (netuio_contextdata->dpdk_seg.mem.user_mapped_virt_addr == NULL) {
+ status = STATUS_INSUFFICIENT_RESOURCES;
+ goto end;
+ }
+ }
+ __except (EXCEPTION_EXECUTE_HANDLER) {
+ status = GetExceptionCode();
goto end;
}
@@ -70,13 +75,18 @@ netuio_map_address_into_user_process(_In_ PNETUIO_CONTEXT_DATA netuio_contextdat
}
MmBuildMdlForNonPagedPool(netuio_contextdata->dpdk_hw[idx].mdl);
- netuio_contextdata->dpdk_hw[idx].mem.user_mapped_virt_addr =
- MmMapLockedPagesSpecifyCache(
- netuio_contextdata->dpdk_hw[idx].mdl, UserMode, MmCached,
- NULL, FALSE, (NormalPagePriority | MdlMappingNoExecute));
-
- if (netuio_contextdata->dpdk_hw[idx].mem.user_mapped_virt_addr == NULL) {
- status = STATUS_INSUFFICIENT_RESOURCES;
+ __try {
+ netuio_contextdata->dpdk_hw[idx].mem.user_mapped_virt_addr =
+ MmMapLockedPagesSpecifyCache(netuio_contextdata->dpdk_hw[idx].mdl, UserMode,
+ MmCached, NULL, FALSE, NormalPagePriority);
+
+ if (netuio_contextdata->dpdk_hw[idx].mem.user_mapped_virt_addr == NULL) {
+ status = STATUS_INSUFFICIENT_RESOURCES;
+ goto end;
+ }
+ }
+ __except (EXCEPTION_EXECUTE_HANDLER) {
+ status = GetExceptionCode();
goto end;
}
}
--
2.23.0.vfs.1.1.63.g5a5ad7f
next prev parent reply other threads:[~2020-08-13 23:25 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-13 23:21 [dpdk-dev] [PATCH 00/22] windows/netuio: add netuio driver for Windows Narcisa Ana Maria Vasile
2020-08-13 23:21 ` [dpdk-dev] [PATCH 01/22] init DPDK repository Narcisa Ana Maria Vasile
2020-08-14 20:02 ` Dmitry Kozlyuk
2020-08-13 23:21 ` [dpdk-dev] [PATCH 02/22] Initial commit of UIO driver for Windows Narcisa Ana Maria Vasile
2020-08-13 23:21 ` [dpdk-dev] [PATCH 03/22] Added new core libraries " Narcisa Ana Maria Vasile
2020-08-14 20:02 ` Dmitry Kozlyuk
2020-08-13 23:21 ` [dpdk-dev] [PATCH 04/22] Windows DPDK libraries and applications have now been updated to the latest public release v18.08, of the main DPDK source Narcisa Ana Maria Vasile
2020-08-13 23:21 ` [dpdk-dev] [PATCH 05/22] doc: remove embedded buffer from Windows UIO ioctl Narcisa Ana Maria Vasile
2020-08-14 20:02 ` Dmitry Kozlyuk
2020-08-13 23:21 ` [dpdk-dev] [PATCH 06/22] Windows DPDK libraries and applications have now been updated to the latest public release v18.08, of the main DPDK source Narcisa Ana Maria Vasile
2020-08-13 23:21 ` [dpdk-dev] [PATCH 07/22] doc: change the Windows UIO driver's default security descriptor to admin only Narcisa Ana Maria Vasile
2020-08-13 23:21 ` [dpdk-dev] [PATCH 08/22] doc: remove lower bound on mapped address from Windows UIO driver Narcisa Ana Maria Vasile
2020-08-13 23:21 ` [dpdk-dev] [PATCH 09/22] doc: remove embedded buffer from Windows UIO ioctl Narcisa Ana Maria Vasile
2020-08-13 23:21 ` [dpdk-dev] [PATCH 10/22] uio: move SDDL string to INF on Windows Narcisa Ana Maria Vasile
2020-08-13 23:21 ` [dpdk-dev] [PATCH 11/22] Updated Source and Project files to use Clang toolset Narcisa Ana Maria Vasile
2020-08-14 20:02 ` Dmitry Kozlyuk
2020-08-13 23:21 ` [dpdk-dev] [PATCH 12/22] uio: Fix 64 bit BARs mapping Narcisa Ana Maria Vasile
2020-08-13 23:21 ` [dpdk-dev] [PATCH 13/22] Update .gitignore and create .gitattributes Narcisa Ana Maria Vasile
2020-08-13 23:21 ` [dpdk-dev] [PATCH 14/22] uio: Use local time when verifying INF DriverVer Narcisa Ana Maria Vasile
2020-08-13 23:21 ` [dpdk-dev] [PATCH 15/22] uio: Remove co-installers section from inf Narcisa Ana Maria Vasile
2020-08-13 23:21 ` Narcisa Ana Maria Vasile [this message]
2020-08-13 23:21 ` [dpdk-dev] [PATCH 17/22] uio: Use request handler that guarantees execution in correct context Narcisa Ana Maria Vasile
2020-08-13 23:21 ` [dpdk-dev] [PATCH 18/22] uio: Change the device setup class to a custom one Narcisa Ana Maria Vasile
2020-08-13 23:21 ` [dpdk-dev] [PATCH 19/22] Enable DMA remapping through INF directive Narcisa Ana Maria Vasile
2020-08-13 23:21 ` [dpdk-dev] [PATCH 20/22] license: update headers with BSD 3-clause license: Narcisa Ana Maria Vasile
2020-08-14 20:02 ` Dmitry Kozlyuk
2020-08-13 23:21 ` [dpdk-dev] [PATCH 21/22] doc: updating REAME for NetUIO driver Narcisa Ana Maria Vasile
2020-08-14 20:11 ` Dmitry Kozlyuk
2020-08-13 23:21 ` [dpdk-dev] [PATCH 22/22] Move all files under windows folder Narcisa Ana Maria Vasile
2020-08-14 14:56 ` [dpdk-dev] [PATCH 00/22] windows/netuio: add netuio driver for Windows Harini Ramakrishnan
2020-08-14 20:01 ` Dmitry Kozlyuk
2020-08-14 20:26 ` Narcisa Ana Maria Vasile
2020-08-14 20:45 ` Omar Cardona
2020-08-14 20:57 ` Dmitry Kozlyuk
2020-08-14 22:51 ` Ranjit Menon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1597360905-74106-17-git-send-email-navasile@linux.microsoft.com \
--to=navasile@linux.microsoft.com \
--cc=dev@dpdk.org \
--cc=dmitry.kozliuk@gmail.com \
--cc=dmitrym@microsoft.com \
--cc=haramakr@linux.microsoft.com \
--cc=navasile@microsoft.com \
--cc=ocardona@microsoft.com \
--cc=pallavi.kadam@intel.com \
--cc=ranjit.menon@intel.com \
--cc=thomas@monjalon.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).