All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yi Sun <yi.y.sun@linux.intel.com>
To: qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, yan.y.zhao@intel.com,
	Yi Sun <yi.y.sun@linux.intel.com>
Subject: [PATCH v1] memory: remove assert to avoid unnecessary coredump
Date: Tue,  3 Mar 2020 11:11:14 +0800	[thread overview]
Message-ID: <20200303031114.21111-1-yi.y.sun@linux.intel.com> (raw)

It is too strict to use assert to make qemu coredump if
the notification does not overlap with registered range.
Skip it is fine enough.

During test, we found such a case for vhost net device:
    memory_region_notify_one: entry->iova=0xfee00000, entry_end=0xfeffffff, notifier->start=0xfef00000, notifier->end=0xffffffffffffffff

Skip this notification but not coredump makes everything
work well.

Signed-off-by: Yi Sun <yi.y.sun@linux.intel.com>
---
 memory.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/memory.c b/memory.c
index 06484c2bff..62ad0f3377 100644
--- a/memory.c
+++ b/memory.c
@@ -1921,12 +1921,11 @@ void memory_region_notify_one(IOMMUNotifier *notifier,
      * Skip the notification if the notification does not overlap
      * with registered range.
      */
-    if (notifier->start > entry_end || notifier->end < entry->iova) {
+    if (notifier->start > entry_end || notifier->end < entry->iova ||
+        entry->iova < notifier->start || entry_end > notifier->end) {
         return;
     }
 
-    assert(entry->iova >= notifier->start && entry_end <= notifier->end);
-
     if (entry->perm & IOMMU_RW) {
         request_flags = IOMMU_NOTIFIER_MAP;
     } else {
-- 
2.15.1



             reply	other threads:[~2020-03-03  3:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-03  3:11 Yi Sun [this message]
2020-03-03  3:36 ` [PATCH v1] memory: remove assert to avoid unnecessary coredump Yan Zhao
2020-03-03  5:22   ` Yi Sun
2020-03-03  5:30     ` Yan Zhao

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=20200303031114.21111-1-yi.y.sun@linux.intel.com \
    --to=yi.y.sun@linux.intel.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=yan.y.zhao@intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.