migration queue
From: "Dr. David Alan Gilbert" <[email protected]>
The following changes since commit 6651620b92bc08cde07cb500e9a43dba7bd9b2b7:
Merge remote-tracking branch 'remotes/kraxel/tags/seabios-20200702-pull-request' into staging (2020-07-03 09:55:35 +0100)
are available in the Git repository at:
git://github.com/dagrh/qemu.git tags/pull-migration-20200703a
for you to fetch changes up to fb6135807fcab4670d69663ac88e88e124348ffd:
migration: Count new_dirty instead of real_dirty (2020-07-03 16:23:05 +0100)
----------------------------------------------------------------
virtiofsd+migration pull 2020-07-03
A couple of small migration fixes, and some capability rework for virtiofsd.
----------------------------------------------------------------
Dr. David Alan Gilbert (4):
virtiofsd: Terminate capability list
virtiofsd: Check capability calls
virtiofsd: Allow addition or removal of capabilities
migration: postcopy take proper error return
Keqian Zhu (1):
migration: Count new_dirty instead of real_dirty
docs/tools/virtiofsd.rst | 5 +++ include/exec/ram_addr.h | 5 +-- migration/postcopy-ram.c | 2 +- migration/ram.c | 8 +++-- tools/virtiofsd/helper.c | 2 ++ tools/virtiofsd/passthrough_ll.c | 71 +++++++++++++++++++++++++++++++++++++--- 6 files changed, 80 insertions(+), 13 deletions(-)
[PULL 1/5] virtiofsd: Terminate capability list
From: "Dr. David Alan Gilbert" <[email protected]>
capng_updatev is a varargs function that needs a -1 to terminate it, but it was missing.
In practice what seems to have been happening is that it's added the capabilities we asked for, then runs into junk on the stack, so if we're unlucky it might be adding some more, but in reality it's failing - but after adding the capabilities we asked for.
Message-Id: <[email protected]>
--- tools/virtiofsd/passthrough_ll.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
tools/virtiofsd/passthrough_ll.c +3 -1
@@ -2598,7 +2598,9 @@ static void setup_capabilities(void)CAP_SETGID ,CAP_SETUID ,CAP_MKNOD , - CAP_SETFCAP); +CAP_SETFCAP , + -1); +capng_apply (CAPNG_SELECT_BOTH ); cap.saved =capng_save_state ();
Signature · 1 line
2.26.2
[PULL 2/5] virtiofsd: Check capability calls
In reply to Dr. David Alan Gilbert (git)From: "Dr. David Alan Gilbert" <[email protected]>
Check the capability calls worked.
Message-Id: <[email protected]>
--- tools/virtiofsd/passthrough_ll.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
tools/virtiofsd/passthrough_ll.c +13 -3
@@ -2589,7 +2589,7 @@ static void setup_capabilities(void)*/ capng_setpid (syscall (SYS_gettid));capng_clear (CAPNG_SELECT_BOTH ); - capng_updatev(CAPNG_ADD, CAPNG_PERMITTED | CAPNG_EFFECTIVE, + if (capng_updatev(CAPNG_ADD, CAPNG_PERMITTED | CAPNG_EFFECTIVE, CAP_CHOWN, CAP_DAC_OVERRIDE, CAP_DAC_READ_SEARCH,
@@ -2599,11 +2599,21 @@ static void setup_capabilities(void) CAP_SETUID, CAP_MKNOD, CAP_SETFCAP, - -1); + -1)) { +fuse_log (FUSE_LOG_ERR ,"%s: capng_updatev failed\n" , __func__); +exit (1 ); + } -capng_apply (CAPNG_SELECT_BOTH ); +if (capng_apply (CAPNG_SELECT_BOTH )) { +fuse_log (FUSE_LOG_ERR ,"%s: capng_apply failed\n" , __func__); +exit (1 ); + } cap.saved =capng_save_state (); +if (!cap.saved) { +fuse_log (FUSE_LOG_ERR ,"%s: capng_save_state failed\n" , __func__); +exit (1 ); + }pthread_mutex_unlock (&cap.mutex); }
Signature · 1 line
2.26.2
[PULL 3/5] virtiofsd: Allow addition or removal of capabilities
In reply to Dr. David Alan Gilbert (git)From: "Dr. David Alan Gilbert" <[email protected]>
Allow capabilities to be added or removed from the allowed set for the daemon; e.g.
default:
CapPrm: 00000000880000df
CapEff: 00000000880000df
-o modcaps=+sys_admin
CapPrm: 00000000882000df
CapEff: 00000000882000df
-o modcaps=+sys_admin:-chown
CapPrm: 00000000882000de
CapEff: 00000000882000de
Message-Id: <[email protected]>
--- docs/tools/virtiofsd.rst | 5 +++ tools/virtiofsd/helper.c | 2 ++ tools/virtiofsd/passthrough_ll.c | 53 ++++++++++++++++++++++++++++++-- 3 files changed, 58 insertions(+), 2 deletions(-)
docs/tools/virtiofsd.rst +5 -0
@@ -54,6 +54,11 @@ Options * flock|no_flock - Enable/disable flock. The default is ``no_flock``. + * modcaps=CAPLIST + Modify the list of capabilities allowed; CAPLIST is a colon separated + list of capabilities, each preceded by either + or -, e.g. + ''+sys_admin:-chown''. + * log_level=LEVEL - Print only log messages matching LEVEL or more severe. LEVEL is one of ``err``, ``warn``, ``info``, or ``debug``. The default is ``info``.
tools/virtiofsd/helper.c +2 -0
@@ -174,6 +174,8 @@ void fuse_cmdline_help(void)" default: no_writeback\n" " -o xattr|no_xattr enable/disable xattr\n" " default: no_xattr\n" +" -o modcaps=CAPLIST Modify the list of capabilities\n" +" e.g. -o modcaps=+sys_admin:-chown\n" " --rlimit-nofile=<num> set maximum number of file descriptors\n" " (0 leaves rlimit unchanged)\n" " default: min(1000000, fs.file-max - 16384)\n"
tools/virtiofsd/passthrough_ll.c +51 -2
85 lines not on this page · raw message
Signature · 1 line
2.26.2
[PULL 4/5] migration: postcopy take proper error return
In reply to Dr. David Alan Gilbert (git)From: "Dr. David Alan Gilbert" <[email protected]>
This function returns a boolean success and we're returning -1; lets just use the 'out' error path.
Message-Id: <[email protected]>
--- migration/postcopy-ram.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
migration/postcopy-ram.c +1 -1
@@ -389,7 +389,7 @@ bool postcopy_ram_supported_by_host(MigrationIncomingState *mis)*/ if (munlockall ()) {error_report ("%s: munlockall: %s" , __func__,strerror (errno)); -return -1 ; + goto out; }/*
Signature · 1 line
2.26.2
[PULL 5/5] migration: Count new_dirty instead of real_dirty
In reply to Dr. David Alan Gilbert (git)From: Keqian Zhu <[email protected]>
real_dirty_pages becomes equal to total ram size after dirty log sync in ram_init_bitmaps, the reason is that the bitmap of ramblock is initialized to be all set, so old path counts them as "real dirty" at beginning.
This causes wrong dirty rate and false positive throttling.
Message-Id: <[email protected]>
--- include/exec/ram_addr.h | 5 +---- migration/ram.c | 8 +++++--- 2 files changed, 6 insertions(+), 7 deletions(-)
include/exec/ram_addr.h +1 -4
@@ -442,8 +442,7 @@ static inline void cpu_physical_memory_clear_dirty_range(ram_addr_t start,static inline uint64_t cpu_physical_memory_sync_dirty_bitmap (RAMBlock *rb,ram_addr_t start, -ram_addr_t length, -uint64_t *real_dirty_pages) +ram_addr_t length) {ram_addr_t addr;unsigned long word =BIT_WORD ((start + rb->offset) >>TARGET_PAGE_BITS );
@@ -469,7 +468,6 @@ uint64_t cpu_physical_memory_sync_dirty_bitmap(RAMBlock *rb,if (src[idx][offset]) {unsigned long bits =atomic_xchg (&src[idx][offset],0 );unsigned long new_dirty; - *real_dirty_pages +=ctpopl (bits); new_dirty = ~dest[k]; dest[k] |= bits; new_dirty &= bits;
@@ -502,7 +500,6 @@ uint64_t cpu_physical_memory_sync_dirty_bitmap(RAMBlock *rb, start + addr + offset, TARGET_PAGE_SIZE, DIRTY_MEMORY_MIGRATION)) { - *real_dirty_pages +=1 ;long k = (start + addr) >>TARGET_PAGE_BITS ;if (!test_and_set_bit (k, dest)) { num_dirty++;
migration/ram.c +5 -3
@@ -859,9 +859,11 @@ static inline bool migration_bitmap_clear_dirty(RAMState *rs,/* Called with RCU critical section */ static void ramblock_sync_dirty_bitmap (RAMState *rs,RAMBlock *rb) { - rs->migration_dirty_pages += -cpu_physical_memory_sync_dirty_bitmap (rb,0 , rb->used_length, - &rs->num_dirty_pages_period); +uint64_t new_dirty_pages = +cpu_physical_memory_sync_dirty_bitmap (rb,0 , rb->used_length); + + rs->migration_dirty_pages += new_dirty_pages; + rs->num_dirty_pages_period += new_dirty_pages; }/**
Signature · 1 line
2.26.2
Peter Maydell
AppliedQuoted 18 lines · Dr. David Alan Gilbert (git)
From: "Dr. David Alan Gilbert" <[email protected]>
The following changes since commit
6651620b92bc08cde07cb500e9a43dba7bd9b2b7:Merge remote-tracking branch 'remotes/kraxel/tags/seabios-20200702-pull-request' into staging (2020-07-03 09:55:35 +0100)
are available in the Git repository at:
git://github.com/dagrh/qemu.gittags/pull-migration-20200703afor you to fetch changes up to
fb6135807fcab4670d69663ac88e88e124348ffd:migration: Count
new_dirtyinstead ofreal_dirty(2020-07-03 16:23:05 +0100)----------------------------------------------------------------
virtiofsd+migration pull 2020-07-03
Quoted 6 lines
A couple of small migration fixes, and some capability rework for virtiofsd.
Signed-off-by Dr. David Alan Gilbert <[email protected]>----------------------------------------------------------------
Applied, thanks.
Please update the changelog at https://wiki.qemu.org/ChangeLog/5.1
for any user-visible changes.
-- PMM