Change XPC's reserved page timestamp to be based on jiffies.
Signed-off-by: Dean Nelson <dcn@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
u64 vars_pa; /* physical address of struct xpc_vars */
u64 activate_mq_gpa; /* global phys address of activate_mq */
} sn;
- struct timespec stamp; /* time when reserved page was setup by XPC */
- u64 pad2[9]; /* align to last u64 in 2nd 64-byte cacheline */
+ unsigned long stamp; /* time when reserved page was setup by XPC */
+ u64 pad2[10]; /* align to last u64 in 2nd 64-byte cacheline */
u64 SAL_nasids_size; /* SAL: size of each nasid mask in bytes */
};
#define XPC_SUPPORTS_RP_STAMP(_version) \
(_version >= _XPC_VERSION(1, 1))
-#define ZERO_STAMP ((struct timespec){0, 0})
-/*
- * compare stamps - the return value is:
- *
- * < 0, if stamp1 < stamp2
- * = 0, if stamp1 == stamp2
- * > 0, if stamp1 > stamp2
- */
-static inline int
-xpc_compare_stamps(struct timespec *stamp1, struct timespec *stamp2)
-{
- int ret;
-
- ret = stamp1->tv_sec - stamp2->tv_sec;
- if (ret == 0)
- ret = stamp1->tv_nsec - stamp2->tv_nsec;
-
- return ret;
-}
-
/*
* Define the structures by which XPC variables can be exported to other
* partitions. (There are two: struct xpc_vars and struct xpc_vars_part)
/* XPC HB infrastructure */
u8 remote_rp_version; /* version# of partition's rsvd pg */
- struct timespec remote_rp_stamp; /* time when rsvd pg was initialized */
+ unsigned long remote_rp_stamp; /* time when rsvd pg was initialized */
u64 remote_rp_pa; /* phys addr of partition's rsvd pg */
u64 remote_vars_pa; /* phys addr of partition's vars */
u64 remote_vars_part_pa; /* phys addr of partition's vars part */
{
struct xpc_partition *part = (struct xpc_partition *)data;
- DBUG_ON(time_before(jiffies, part->disengage_request_timeout));
+ DBUG_ON(time_is_after_jiffies(part->disengage_request_timeout));
(void)xpc_partition_disengaged(part);
{
xpc_increment_heartbeat();
- if (time_after_eq(jiffies, xpc_hb_check_timeout))
+ if (time_is_before_eq_jiffies(xpc_hb_check_timeout))
wake_up_interruptible(&xpc_act_IRQ_wq);
xpc_hb_timer.expires = jiffies + (xpc_hb_interval * HZ);
atomic_read(&xpc_act_IRQ_rcvd) - last_IRQ_count);
/* checking of remote heartbeats is skewed by IRQ handling */
- if (time_after_eq(jiffies, xpc_hb_check_timeout)) {
+ if (time_is_before_eq_jiffies(xpc_hb_check_timeout)) {
dev_dbg(xpc_part, "checking remote heartbeats\n");
xpc_check_remote_hb();
(void)wait_event_interruptible(xpc_act_IRQ_wq,
(last_IRQ_count <
atomic_read(&xpc_act_IRQ_rcvd)
- || time_after_eq(jiffies,
- xpc_hb_check_timeout) ||
+ || time_is_before_eq_jiffies(
+ xpc_hb_check_timeout) ||
xpc_exiting));
}
}
if (xpc_partition_engaged(-1UL)) {
- if (time_after(jiffies, printmsg_time)) {
+ if (time_is_before_jiffies(printmsg_time)) {
dev_info(xpc_part, "waiting for remote "
"partitions to disengage, timeout in "
"%ld seconds\n",
DBUG_ON(xpc_any_hbs_allowed() != 0);
/* indicate to others that our reserved page is uninitialized */
- xpc_rsvd_page->stamp = ZERO_STAMP;
+ xpc_rsvd_page->stamp = 0;
if (reason == xpUnloading) {
(void)unregister_die_notifier(&xpc_die_notifier);
/* initialization was not successful */
out_4:
/* indicate to others that our reserved page is uninitialized */
- xpc_rsvd_page->stamp = ZERO_STAMP;
+ xpc_rsvd_page->stamp = 0;
(void)unregister_die_notifier(&xpc_die_notifier);
(void)unregister_reboot_notifier(&xpc_reboot_notifier);
{
struct xpc_rsvd_page *rp;
u64 rp_pa;
+ unsigned long new_stamp;
/* get the local reserved page's address */
* This signifies to the remote partition that our reserved
* page is initialized.
*/
- rp->stamp = CURRENT_TIME;
+ new_stamp = jiffies;
+ if (new_stamp == 0 || new_stamp == rp->stamp)
+ new_stamp++;
+ rp->stamp = new_stamp;
return rp;
}
discovered_nasids[i] |= remote_part_nasids[i];
}
- /* check that the partid is valid and is for another partition */
-
- if (remote_rp->SAL_partid < 0 ||
- remote_rp->SAL_partid >= xp_max_npartitions) {
- return xpInvalidPartid;
- }
-
- if (remote_rp->SAL_partid == sn_partition_id)
- return xpLocalPartid;
-
- /* see if the rest of the reserved page has been set up by XPC */
- if (timespec_equal(&remote_rp->stamp, &ZERO_STAMP))
+ /* see if the reserved page has been set up by XPC */
+ if (remote_rp->stamp == 0)
return xpRsvdPageNotSet;
if (XPC_VERSION_MAJOR(remote_rp->version) !=
return xpBadVersion;
}
- if (remote_rp->max_npartitions <= sn_partition_id)
+ /* check that both local and remote partids are valid for each side */
+ if (remote_rp->SAL_partid < 0 ||
+ remote_rp->SAL_partid >= xp_max_npartitions ||
+ remote_rp->max_npartitions <= sn_partition_id) {
return xpInvalidPartid;
+ }
+
+ if (remote_rp->SAL_partid == sn_partition_id)
+ return xpLocalPartid;
return xpSuccess;
}
disengaged = (xpc_partition_engaged(1UL << partid) == 0);
if (part->disengage_request_timeout) {
if (!disengaged) {
- if (time_before(jiffies,
- part->disengage_request_timeout)) {
+ if (time_is_after_jiffies(part->
+ disengage_request_timeout)) {
/* timelimit hasn't been reached yet */
return 0;
}
*/
static void
xpc_update_partition_info_sn2(struct xpc_partition *part, u8 remote_rp_version,
- struct timespec *remote_rp_stamp,
- u64 remote_rp_pa, u64 remote_vars_pa,
+ unsigned long *remote_rp_stamp, u64 remote_rp_pa,
+ u64 remote_vars_pa,
struct xpc_vars_sn2 *remote_vars)
{
part->remote_rp_version = remote_rp_version;
part->remote_rp_version);
part->remote_rp_stamp = *remote_rp_stamp;
- dev_dbg(xpc_part, " remote_rp_stamp (tv_sec = 0x%lx tv_nsec = 0x%lx\n",
- part->remote_rp_stamp.tv_sec, part->remote_rp_stamp.tv_nsec);
+ dev_dbg(xpc_part, " remote_rp_stamp = 0x%016lx\n",
+ part->remote_rp_stamp);
part->remote_rp_pa = remote_rp_pa;
dev_dbg(xpc_part, " remote_rp_pa = 0x%016lx\n", part->remote_rp_pa);
u64 remote_vars_pa;
int remote_rp_version;
int reactivate = 0;
- int stamp_diff;
- struct timespec remote_rp_stamp = { 0, 0 }; /*>>> ZERO_STAMP */
+ unsigned long remote_rp_stamp = 0;
short partid;
struct xpc_partition *part;
enum xp_retval ret;
} else {
DBUG_ON(!XPC_SUPPORTS_DISENGAGE_REQUEST(remote_vars->version));
- stamp_diff = xpc_compare_stamps(&part->remote_rp_stamp,
- &remote_rp_stamp);
- if (stamp_diff != 0) {
- DBUG_ON(stamp_diff >= 0);
+ if (remote_rp_stamp != part->remote_rp_stamp) {
/*
* Other side rebooted and the previous XPC did support