* [Qemu-devel] [PULL 0/4] Block layer patches for 2.8.0-rc2
@ 2016-11-29 16:17 Kevin Wolf
2016-11-29 16:17 ` [Qemu-devel] [PULL 1/4] qcow2: Make qcow2_cache_table_release() work only in Linux Kevin Wolf
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Kevin Wolf @ 2016-11-29 16:17 UTC (permalink / raw)
To: qemu-block; +Cc: kwolf, stefanha, qemu-devel
The following changes since commit 00227fefd2059464cd2f59aed29944874c630e2f:
Update version for v2.8.0-rc1 release (2016-11-22 22:29:08 +0000)
are available in the git repository at:
git://repo.or.cz/qemu/kevin.git tags/for-upstream
for you to fetch changes up to 8f57758311d816c66e88cfcfdc91f986f59345ad:
docs: Specify that cache-clean-interval is only supported in Linux (2016-11-25 13:51:31 +0100)
----------------------------------------------------------------
Block layer patches for 2.8.0-rc2
----------------------------------------------------------------
Alberto Garcia (4):
qcow2: Make qcow2_cache_table_release() work only in Linux
qcow2: Allow 'cache-clean-interval' in Linux only
qcow2: Remove stale comment
docs: Specify that cache-clean-interval is only supported in Linux
block/qcow2-cache.c | 6 +++---
block/qcow2.c | 8 ++++++++
docs/qcow2-cache.txt | 5 +++--
3 files changed, 14 insertions(+), 5 deletions(-)
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Qemu-devel] [PULL 1/4] qcow2: Make qcow2_cache_table_release() work only in Linux
2016-11-29 16:17 [Qemu-devel] [PULL 0/4] Block layer patches for 2.8.0-rc2 Kevin Wolf
@ 2016-11-29 16:17 ` Kevin Wolf
2016-11-29 16:17 ` [Qemu-devel] [PULL 2/4] qcow2: Allow 'cache-clean-interval' in Linux only Kevin Wolf
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Kevin Wolf @ 2016-11-29 16:17 UTC (permalink / raw)
To: qemu-block; +Cc: kwolf, stefanha, qemu-devel
From: Alberto Garcia <berto@igalia.com>
We are using QEMU_MADV_DONTNEED to discard the memory of individual L2
cache tables. The problem with this is that those semantics are
specific to the Linux madvise() system call. Other implementations of
madvise() (including the very Linux implementation of posix_madvise())
don't do that, so we cannot use them for the same purpose.
This patch makes the code Linux-specific and uses madvise() directly
since there's no point in going through qemu_madvise() for this.
Signed-off-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block/qcow2-cache.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/block/qcow2-cache.c b/block/qcow2-cache.c
index 6eaefed..ab8ee2d 100644
--- a/block/qcow2-cache.c
+++ b/block/qcow2-cache.c
@@ -66,7 +66,8 @@ static inline int qcow2_cache_get_table_idx(BlockDriverState *bs,
static void qcow2_cache_table_release(BlockDriverState *bs, Qcow2Cache *c,
int i, int num_tables)
{
-#if QEMU_MADV_DONTNEED != QEMU_MADV_INVALID
+/* Using MADV_DONTNEED to discard memory is a Linux-specific feature */
+#ifdef CONFIG_LINUX
BDRVQcow2State *s = bs->opaque;
void *t = qcow2_cache_get_table_addr(bs, c, i);
int align = getpagesize();
@@ -74,7 +75,7 @@ static void qcow2_cache_table_release(BlockDriverState *bs, Qcow2Cache *c,
size_t offset = QEMU_ALIGN_UP((uintptr_t) t, align) - (uintptr_t) t;
size_t length = QEMU_ALIGN_DOWN(mem_size - offset, align);
if (length > 0) {
- qemu_madvise((uint8_t *) t + offset, length, QEMU_MADV_DONTNEED);
+ madvise((uint8_t *) t + offset, length, MADV_DONTNEED);
}
#endif
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Qemu-devel] [PULL 2/4] qcow2: Allow 'cache-clean-interval' in Linux only
2016-11-29 16:17 [Qemu-devel] [PULL 0/4] Block layer patches for 2.8.0-rc2 Kevin Wolf
2016-11-29 16:17 ` [Qemu-devel] [PULL 1/4] qcow2: Make qcow2_cache_table_release() work only in Linux Kevin Wolf
@ 2016-11-29 16:17 ` Kevin Wolf
2016-11-29 16:17 ` [Qemu-devel] [PULL 3/4] qcow2: Remove stale comment Kevin Wolf
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Kevin Wolf @ 2016-11-29 16:17 UTC (permalink / raw)
To: qemu-block; +Cc: kwolf, stefanha, qemu-devel
From: Alberto Garcia <berto@igalia.com>
The cache-clean-interval option of qcow2 only works on Linux. However
we allow setting it in other systems regardless of whether it works or
not.
In those systems this option is not simply a no-op: it actually
invalidates perfectly valid cache tables for no good reason without
freeing their memory.
This patch forbids using that option in non-Linux systems.
Signed-off-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block/qcow2.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/block/qcow2.c b/block/qcow2.c
index 7cfcd84..ed9e0f3 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -668,6 +668,14 @@ static int qcow2_update_options_prepare(BlockDriverState *bs,
r->cache_clean_interval =
qemu_opt_get_number(opts, QCOW2_OPT_CACHE_CLEAN_INTERVAL,
s->cache_clean_interval);
+#ifndef CONFIG_LINUX
+ if (r->cache_clean_interval != 0) {
+ error_setg(errp, QCOW2_OPT_CACHE_CLEAN_INTERVAL
+ " not supported on this host");
+ ret = -EINVAL;
+ goto fail;
+ }
+#endif
if (r->cache_clean_interval > UINT_MAX) {
error_setg(errp, "Cache clean interval too big");
ret = -EINVAL;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Qemu-devel] [PULL 3/4] qcow2: Remove stale comment
2016-11-29 16:17 [Qemu-devel] [PULL 0/4] Block layer patches for 2.8.0-rc2 Kevin Wolf
2016-11-29 16:17 ` [Qemu-devel] [PULL 1/4] qcow2: Make qcow2_cache_table_release() work only in Linux Kevin Wolf
2016-11-29 16:17 ` [Qemu-devel] [PULL 2/4] qcow2: Allow 'cache-clean-interval' in Linux only Kevin Wolf
@ 2016-11-29 16:17 ` Kevin Wolf
2016-11-29 16:17 ` [Qemu-devel] [PULL 4/4] docs: Specify that cache-clean-interval is only supported in Linux Kevin Wolf
2016-11-29 17:11 ` [Qemu-devel] [Qemu-block] [PULL 0/4] Block layer patches for 2.8.0-rc2 Stefan Hajnoczi
4 siblings, 0 replies; 6+ messages in thread
From: Kevin Wolf @ 2016-11-29 16:17 UTC (permalink / raw)
To: qemu-block; +Cc: kwolf, stefanha, qemu-devel
From: Alberto Garcia <berto@igalia.com>
We haven't been using CONFIG_MADVISE since 02d0e095031b7fda77de8b
Signed-off-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block/qcow2-cache.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/block/qcow2-cache.c b/block/qcow2-cache.c
index ab8ee2d..1d25147 100644
--- a/block/qcow2-cache.c
+++ b/block/qcow2-cache.c
@@ -22,7 +22,6 @@
* THE SOFTWARE.
*/
-/* Needed for CONFIG_MADVISE */
#include "qemu/osdep.h"
#include "block/block_int.h"
#include "qemu-common.h"
--
1.8.3.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Qemu-devel] [PULL 4/4] docs: Specify that cache-clean-interval is only supported in Linux
2016-11-29 16:17 [Qemu-devel] [PULL 0/4] Block layer patches for 2.8.0-rc2 Kevin Wolf
` (2 preceding siblings ...)
2016-11-29 16:17 ` [Qemu-devel] [PULL 3/4] qcow2: Remove stale comment Kevin Wolf
@ 2016-11-29 16:17 ` Kevin Wolf
2016-11-29 17:11 ` [Qemu-devel] [Qemu-block] [PULL 0/4] Block layer patches for 2.8.0-rc2 Stefan Hajnoczi
4 siblings, 0 replies; 6+ messages in thread
From: Kevin Wolf @ 2016-11-29 16:17 UTC (permalink / raw)
To: qemu-block; +Cc: kwolf, stefanha, qemu-devel
From: Alberto Garcia <berto@igalia.com>
Make it clear that having Linux is a hard requirement for this
feature.
Signed-off-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
docs/qcow2-cache.txt | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/docs/qcow2-cache.txt b/docs/qcow2-cache.txt
index 5bb0607..1fdd6f9 100644
--- a/docs/qcow2-cache.txt
+++ b/docs/qcow2-cache.txt
@@ -160,5 +160,6 @@ If unset, the default value for this parameter is 0 and it disables
this feature.
Note that this functionality currently relies on the MADV_DONTNEED
-argument for madvise() to actually free the memory, so it is not
-useful in systems that don't follow that behavior.
+argument for madvise() to actually free the memory. This is a
+Linux-specific feature, so cache-clean-interval is not supported in
+other systems.
--
1.8.3.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [Qemu-block] [PULL 0/4] Block layer patches for 2.8.0-rc2
2016-11-29 16:17 [Qemu-devel] [PULL 0/4] Block layer patches for 2.8.0-rc2 Kevin Wolf
` (3 preceding siblings ...)
2016-11-29 16:17 ` [Qemu-devel] [PULL 4/4] docs: Specify that cache-clean-interval is only supported in Linux Kevin Wolf
@ 2016-11-29 17:11 ` Stefan Hajnoczi
4 siblings, 0 replies; 6+ messages in thread
From: Stefan Hajnoczi @ 2016-11-29 17:11 UTC (permalink / raw)
To: Kevin Wolf; +Cc: qemu-block, qemu-devel, stefanha
[-- Attachment #1: Type: text/plain, Size: 1220 bytes --]
On Tue, Nov 29, 2016 at 05:17:03PM +0100, Kevin Wolf wrote:
> The following changes since commit 00227fefd2059464cd2f59aed29944874c630e2f:
>
> Update version for v2.8.0-rc1 release (2016-11-22 22:29:08 +0000)
>
> are available in the git repository at:
>
> git://repo.or.cz/qemu/kevin.git tags/for-upstream
>
> for you to fetch changes up to 8f57758311d816c66e88cfcfdc91f986f59345ad:
>
> docs: Specify that cache-clean-interval is only supported in Linux (2016-11-25 13:51:31 +0100)
>
> ----------------------------------------------------------------
> Block layer patches for 2.8.0-rc2
>
> ----------------------------------------------------------------
> Alberto Garcia (4):
> qcow2: Make qcow2_cache_table_release() work only in Linux
> qcow2: Allow 'cache-clean-interval' in Linux only
> qcow2: Remove stale comment
> docs: Specify that cache-clean-interval is only supported in Linux
>
> block/qcow2-cache.c | 6 +++---
> block/qcow2.c | 8 ++++++++
> docs/qcow2-cache.txt | 5 +++--
> 3 files changed, 14 insertions(+), 5 deletions(-)
>
Thanks, applied to my staging tree:
https://github.com/stefanha/qemu/commits/staging
Stefan
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-11-29 17:12 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-29 16:17 [Qemu-devel] [PULL 0/4] Block layer patches for 2.8.0-rc2 Kevin Wolf
2016-11-29 16:17 ` [Qemu-devel] [PULL 1/4] qcow2: Make qcow2_cache_table_release() work only in Linux Kevin Wolf
2016-11-29 16:17 ` [Qemu-devel] [PULL 2/4] qcow2: Allow 'cache-clean-interval' in Linux only Kevin Wolf
2016-11-29 16:17 ` [Qemu-devel] [PULL 3/4] qcow2: Remove stale comment Kevin Wolf
2016-11-29 16:17 ` [Qemu-devel] [PULL 4/4] docs: Specify that cache-clean-interval is only supported in Linux Kevin Wolf
2016-11-29 17:11 ` [Qemu-devel] [Qemu-block] [PULL 0/4] Block layer patches for 2.8.0-rc2 Stefan Hajnoczi
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).