Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 268062
b: refs/heads/master
c: 95ff7cd
h: refs/heads/master
v: v3
  • Loading branch information
K. Y. Srinivasan authored and Greg Kroah-Hartman committed Aug 29, 2011
1 parent 99a1767 commit 224b1f4
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ae2a0b42bfe6e7eb9251bfb05f7a03008df446a8
refs/heads/master: 95ff7cde91f5513ebc95ccf0cd482f07dc3454e4
33 changes: 30 additions & 3 deletions trunk/drivers/staging/hv/hv_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,24 @@ static inline void do_adj_guesttime(u64 hosttime)
do_settimeofday(&host_ts);
}

/*
* Set the host time in a process context.
*/

struct adj_time_work {
struct work_struct work;
u64 host_time;
};

static void hv_set_host_time(struct work_struct *work)
{
struct adj_time_work *wrk;

wrk = container_of(work, struct adj_time_work, work);
do_adj_guesttime(wrk->host_time);
kfree(wrk);
}

/*
* Synchronize time with host after reboot, restore, etc.
*
Expand All @@ -119,17 +137,26 @@ static inline void do_adj_guesttime(u64 hosttime)
*/
static inline void adj_guesttime(u64 hosttime, u8 flags)
{
struct adj_time_work *wrk;
static s32 scnt = 50;

wrk = kmalloc(sizeof(struct adj_time_work), GFP_ATOMIC);
if (wrk == NULL)
return;

wrk->host_time = hosttime;
if ((flags & ICTIMESYNCFLAG_SYNC) != 0) {
do_adj_guesttime(hosttime);
INIT_WORK(&wrk->work, hv_set_host_time);
schedule_work(&wrk->work);
return;
}

if ((flags & ICTIMESYNCFLAG_SAMPLE) != 0 && scnt > 0) {
scnt--;
do_adj_guesttime(hosttime);
}
INIT_WORK(&wrk->work, hv_set_host_time);
schedule_work(&wrk->work);
} else
kfree(wrk);
}

/*
Expand Down

0 comments on commit 224b1f4

Please sign in to comment.