Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

s390/ctcm, netiucv: migrate variables to handle y2038 problem

This patch is concerned with migrating the time variables for the s390
network drivers. The changes handle the y2038 problem where timespec will
overflow in the year 2038. timespec was replaced by unsigned long and
all time variables get their values from the jiffies global variable.
This was done for the sake of speed and efficiency.

Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Ursula Braun <ursula.braun@de.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Aya Mahfouz and committed by
David S. Miller
ee6edb97 33e9fcc6

+15 -19
+7 -11
drivers/s390/net/ctcm_fsms.c
··· 251 251 int first = 1; 252 252 int i; 253 253 unsigned long duration; 254 - struct timespec done_stamp = current_kernel_time(); /* xtime */ 254 + unsigned long done_stamp = jiffies; 255 255 256 256 CTCM_PR_DEBUG("%s(%s): %s\n", __func__, ch->id, dev->name); 257 257 258 - duration = 259 - (done_stamp.tv_sec - ch->prof.send_stamp.tv_sec) * 1000000 + 260 - (done_stamp.tv_nsec - ch->prof.send_stamp.tv_nsec) / 1000; 258 + duration = done_stamp - ch->prof.send_stamp; 261 259 if (duration > ch->prof.tx_time) 262 260 ch->prof.tx_time = duration; 263 261 ··· 305 307 spin_unlock(&ch->collect_lock); 306 308 ch->ccw[1].count = ch->trans_skb->len; 307 309 fsm_addtimer(&ch->timer, CTCM_TIME_5_SEC, CTC_EVENT_TIMER, ch); 308 - ch->prof.send_stamp = current_kernel_time(); /* xtime */ 310 + ch->prof.send_stamp = jiffies; 309 311 rc = ccw_device_start(ch->cdev, &ch->ccw[0], 310 312 (unsigned long)ch, 0xff, 0); 311 313 ch->prof.doios_multi++; ··· 1227 1229 int rc; 1228 1230 struct th_header *header; 1229 1231 struct pdu *p_header; 1230 - struct timespec done_stamp = current_kernel_time(); /* xtime */ 1232 + unsigned long done_stamp = jiffies; 1231 1233 1232 1234 CTCM_PR_DEBUG("Enter %s: %s cp:%i\n", 1233 1235 __func__, dev->name, smp_processor_id()); 1234 1236 1235 - duration = 1236 - (done_stamp.tv_sec - ch->prof.send_stamp.tv_sec) * 1000000 + 1237 - (done_stamp.tv_nsec - ch->prof.send_stamp.tv_nsec) / 1000; 1237 + duration = done_stamp - ch->prof.send_stamp; 1238 1238 if (duration > ch->prof.tx_time) 1239 1239 ch->prof.tx_time = duration; 1240 1240 ··· 1357 1361 1358 1362 ch->ccw[1].count = ch->trans_skb->len; 1359 1363 fsm_addtimer(&ch->timer, CTCM_TIME_5_SEC, CTC_EVENT_TIMER, ch); 1360 - ch->prof.send_stamp = current_kernel_time(); /* xtime */ 1364 + ch->prof.send_stamp = jiffies; 1361 1365 if (do_debug_ccw) 1362 1366 ctcmpc_dumpit((char *)&ch->ccw[0], sizeof(struct ccw1) * 3); 1363 1367 rc = ccw_device_start(ch->cdev, &ch->ccw[0], ··· 1823 1827 fsm_newstate(wch->fsm, CTC_STATE_TX); 1824 1828 1825 1829 spin_lock_irqsave(get_ccwdev_lock(wch->cdev), saveflags); 1826 - wch->prof.send_stamp = current_kernel_time(); /* xtime */ 1830 + wch->prof.send_stamp = jiffies; 1827 1831 rc = ccw_device_start(wch->cdev, &wch->ccw[3], 1828 1832 (unsigned long) wch, 0xff, 0); 1829 1833 spin_unlock_irqrestore(get_ccwdev_lock(wch->cdev), saveflags);
+2 -2
drivers/s390/net/ctcm_main.c
··· 567 567 fsm_newstate(ch->fsm, CTC_STATE_TX); 568 568 fsm_addtimer(&ch->timer, CTCM_TIME_5_SEC, CTC_EVENT_TIMER, ch); 569 569 spin_lock_irqsave(get_ccwdev_lock(ch->cdev), saveflags); 570 - ch->prof.send_stamp = current_kernel_time(); /* xtime */ 570 + ch->prof.send_stamp = jiffies; 571 571 rc = ccw_device_start(ch->cdev, &ch->ccw[ccw_idx], 572 572 (unsigned long)ch, 0xff, 0); 573 573 spin_unlock_irqrestore(get_ccwdev_lock(ch->cdev), saveflags); ··· 831 831 sizeof(struct ccw1) * 3); 832 832 833 833 spin_lock_irqsave(get_ccwdev_lock(ch->cdev), saveflags); 834 - ch->prof.send_stamp = current_kernel_time(); /* xtime */ 834 + ch->prof.send_stamp = jiffies; 835 835 rc = ccw_device_start(ch->cdev, &ch->ccw[ccw_idx], 836 836 (unsigned long)ch, 0xff, 0); 837 837 spin_unlock_irqrestore(get_ccwdev_lock(ch->cdev), saveflags);
+1 -1
drivers/s390/net/ctcm_main.h
··· 121 121 unsigned long doios_multi; 122 122 unsigned long txlen; 123 123 unsigned long tx_time; 124 - struct timespec send_stamp; 124 + unsigned long send_stamp; 125 125 }; 126 126 127 127 /*
+2 -2
drivers/s390/net/ctcm_sysfs.c
··· 100 100 priv->channel[WRITE]->prof.doios_multi); 101 101 p += sprintf(p, " Netto bytes written: %ld\n", 102 102 priv->channel[WRITE]->prof.txlen); 103 - p += sprintf(p, " Max. TX IO-time: %ld\n", 104 - priv->channel[WRITE]->prof.tx_time); 103 + p += sprintf(p, " Max. TX IO-time: %u\n", 104 + jiffies_to_usecs(priv->channel[WRITE]->prof.tx_time)); 105 105 106 106 printk(KERN_INFO "Statistics for %s:\n%s", 107 107 priv->channel[CTCM_WRITE]->netdev->name, sbuf);
+3 -3
drivers/s390/net/netiucv.c
··· 178 178 unsigned long doios_multi; 179 179 unsigned long txlen; 180 180 unsigned long tx_time; 181 - struct timespec send_stamp; 181 + unsigned long send_stamp; 182 182 unsigned long tx_pending; 183 183 unsigned long tx_max_pending; 184 184 }; ··· 786 786 787 787 header.next = 0; 788 788 memcpy(skb_put(conn->tx_buff, NETIUCV_HDRLEN), &header, NETIUCV_HDRLEN); 789 - conn->prof.send_stamp = current_kernel_time(); 789 + conn->prof.send_stamp = jiffies; 790 790 txmsg.class = 0; 791 791 txmsg.tag = 0; 792 792 rc = iucv_message_send(conn->path, &txmsg, 0, 0, ··· 1220 1220 memcpy(skb_put(nskb, NETIUCV_HDRLEN), &header, NETIUCV_HDRLEN); 1221 1221 1222 1222 fsm_newstate(conn->fsm, CONN_STATE_TX); 1223 - conn->prof.send_stamp = current_kernel_time(); 1223 + conn->prof.send_stamp = jiffies; 1224 1224 1225 1225 msg.tag = 1; 1226 1226 msg.class = 0;