mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 08:13:54 -06:00
general: Replace global smp variables with smp machine properties
Basically, the context could get the MachineState reference via call chains or unrecommended qdev_get_machine() in !CONFIG_USER_ONLY mode. A local variable of the same name would be introduced in the declaration phase out of less effort OR replace it on the spot if it's only used once in the context. No semantic changes. Signed-off-by: Like Xu <like.xu@linux.intel.com> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Message-Id: <20190518205428.90532-4-like.xu@linux.intel.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
This commit is contained in:
parent
a0628599fa
commit
5cc8767d05
10 changed files with 45 additions and 11 deletions
|
@ -29,6 +29,7 @@
|
|||
#include "sysemu/balloon.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "trace.h"
|
||||
#include "hw/boards.h"
|
||||
|
||||
/* Arbitrary limit on size of each discard command,
|
||||
* keeps them around ~200 bytes
|
||||
|
@ -128,6 +129,8 @@ static void migration_exit_cb(Notifier *n, void *data)
|
|||
|
||||
static struct PostcopyBlocktimeContext *blocktime_context_new(void)
|
||||
{
|
||||
MachineState *ms = MACHINE(qdev_get_machine());
|
||||
unsigned int smp_cpus = ms->smp.cpus;
|
||||
PostcopyBlocktimeContext *ctx = g_new0(PostcopyBlocktimeContext, 1);
|
||||
ctx->page_fault_vcpu_time = g_new0(uint32_t, smp_cpus);
|
||||
ctx->vcpu_addr = g_new0(uintptr_t, smp_cpus);
|
||||
|
@ -141,10 +144,11 @@ static struct PostcopyBlocktimeContext *blocktime_context_new(void)
|
|||
|
||||
static uint32List *get_vcpu_blocktime_list(PostcopyBlocktimeContext *ctx)
|
||||
{
|
||||
MachineState *ms = MACHINE(qdev_get_machine());
|
||||
uint32List *list = NULL, *entry = NULL;
|
||||
int i;
|
||||
|
||||
for (i = smp_cpus - 1; i >= 0; i--) {
|
||||
for (i = ms->smp.cpus - 1; i >= 0; i--) {
|
||||
entry = g_new0(uint32List, 1);
|
||||
entry->value = ctx->vcpu_blocktime[i];
|
||||
entry->next = list;
|
||||
|
@ -807,6 +811,8 @@ static void mark_postcopy_blocktime_end(uintptr_t addr)
|
|||
{
|
||||
MigrationIncomingState *mis = migration_incoming_get_current();
|
||||
PostcopyBlocktimeContext *dc = mis->blocktime_ctx;
|
||||
MachineState *ms = MACHINE(qdev_get_machine());
|
||||
unsigned int smp_cpus = ms->smp.cpus;
|
||||
int i, affected_cpu = 0;
|
||||
bool vcpu_total_blocktime = false;
|
||||
uint32_t read_vcpu_time, low_time_offset;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue