Skip to contentSkip to conversation

Block patches

GIT PULL Applied Stefan Hajnoczi 3 participants 4 messages Mar 15, 2017

lore
Share & tools
lore
#0 lore raw

The following changes since commit d84f714eafedd8bb9d4aaec8b76417bef8e3535e:

Update version for v2.9.0-rc0 release (2017-03-14 19:18:23 +0000)

are available in the git repository at:

git://github.com/stefanha/qemu.git tags/block-pull-request

for you to fetch changes up to 9dc44aa5829eb3131a01378a738dee28a382bbc1:

os: don't corrupt pre-existing memory-backend data with prealloc (2017-03-15 11:55:41 +0800)

----------------------------------------------------------------

----------------------------------------------------------------

Daniel P. Berrange (1):
os: don't corrupt pre-existing memory-backend data with prealloc

 util/oslib-posix.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
Signature · 1 line
2.9.3
#1 lore raw

[Qemu-devel] [PULL for-2.9 1/1] os: don't corrupt pre-existing memory-backend data with prealloc

From: "Daniel P. Berrange" <[email protected]>

When using a memory-backend object with prealloc turned on, QEMU will memset() the first byte in every memory page to zero. While this might have been acceptable for memory backends associated with RAM, this corrupts application data for NVDIMMs.

Instead of setting every page to zero, read the current byte value and then just write that same value back, so we are not corrupting the original data. Directly write the value instead of memset()ing it, since there's no benefit to memset for a single byte write.

Message-id: [email protected]

---
 util/oslib-posix.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
util/oslib-posix.c +13 -1
index 956f66a..94d81b9 100644
@@ -361,7 +361,19 @@ static void *do_touch_pages(void *arg)
         memset_thread_failed = true;
     } else {
         for (i = 0; i < numpages; i++) {
-            memset(addr, 0, 1);
+            /*
+             * Read & write back the same value, so we don't
+             * corrupt existing user/app data that might be
+             * stored.
+             *
+             * 'volatile' to stop compiler optimizing this away
+             * to a no-op
+             *
+             * TODO: get a better solution from kernel so we
+             * don't need to write at all so we don't cause
+             * wear on the storage backing the region...
+             */
+            *(volatile char *)addr = *addr;
             addr += hpagesize;
         }
     }
Signature · 1 line
2.9.3
#2 lore raw
In reply to Stefan Hajnoczi
This series seems to have some coding style problems. See output below for more information:

Hi,

This series seems to have some coding style problems. See output below for more information:

Type: series
Subject: [Qemu-devel] [PULL for-2.9 0/1] Block patches
Message-id: [email protected]

=== TEST SCRIPT BEGIN ===
#!/bin/bash

BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0

# Useful git options
git config --local diff.renamelimit 0
git config --local diff.renames True

commits="$(git log --format=%H --reverse $BASE..)" for c in $commits; do

    echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
    if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
        failed=1
        echo
    fi
    n=$((n+1))

done

exit $failed
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
* [new tag] patchew/[email protected] -> patchew/[email protected]
Switched to a new branch 'test'
1562711 os: don't corrupt pre-existing memory-backend data with prealloc

=== OUTPUT BEGIN ===
Checking PATCH 1/1: os: don't corrupt pre-existing memory-backend data with prealloc...
ERROR: Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt #45: FILE: util/oslib-posix.c:376:
+ *(volatile char *)addr = *addr;

total: 1 errors, 0 warnings, 20 lines checked

Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.

=== OUTPUT END ===

Test command exited with code: 1

---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to [email protected]

#3 lore raw
In reply to Stefan Hajnoczi
Quoted 14 lines · Stefan Hajnoczi

The following changes since commit d84f714eafedd8bb9d4aaec8b76417bef8e3535e:

Update version for v2.9.0-rc0 release (2017-03-14 19:18:23 +0000)

are available in the git repository at:

git://github.com/stefanha/qemu.git tags/block-pull-request

for you to fetch changes up to 9dc44aa5829eb3131a01378a738dee28a382bbc1:

os: don't corrupt pre-existing memory-backend data with prealloc (2017-03-15 11:55:41 +0800)

----------------------------------------------------------------

Quoted 7 lines

----------------------------------------------------------------

Daniel P. Berrange (1):
os: don't corrupt pre-existing memory-backend data with prealloc

 util/oslib-posix.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

Applied, thanks.

-- PMM