From: Dan Carpenter <dan.carpenter@oracle.com>
To: linux-s390@vger.kernel.org
Subject: [bug report] s390/time: steer clocksource on STP sync events
Date: Wed, 16 Nov 2016 14:11:09 +0000 [thread overview]
Message-ID: <20161116132428.GA4282@mwanda> (raw)
Hello Martin Schwidefsky,
The patch 75c7b6f3f6ba: "s390/time: steer clocksource on STP sync
events" from Oct 11, 2016, leads to the following static checker
warning:
arch/s390/kernel/time.c:422 clock_sync_global()
warn: unsigned 'tod_steering_delta' is never less than zero.
arch/s390/kernel/time.c
402 static void clock_sync_global(unsigned long long delta)
403 {
404 unsigned long now, adj;
405 struct ptff_qto qto;
406
407 /* Fixup the monotonic sched clock. */
408 sched_clock_base_cc += delta;
409 /* Adjust TOD steering parameters. */
410 vdso_data->tb_update_count++;
411 now = get_tod_clock();
412 adj = tod_steering_end - now;
413 if (unlikely((s64) adj >= 0))
414 /* Calculate how much of the old adjustment is left. */
415 tod_steering_delta = ((s64) tod_steering_delta < 0) ?
416 -(adj >> 15) : (adj >> 15);
417 tod_steering_delta += delta;
418 if ((abs(tod_steering_delta) >> 48) != 0)
^^^
Pointless on ULL.
419 panic("TOD clock sync offset %lli is too large to drift\n",
420 tod_steering_delta);
421 tod_steering_end = now + (abs(tod_steering_delta) << 15);
^^^^^^^^^^^^^^^^^^^^^^^
422 vdso_data->ts_dir = (tod_steering_delta < 0) ? 0 : 1;
^^^^^^^^^^^^^^^^^^^^^^
Maybe just make it s64 and remove the other casting?
423 vdso_data->ts_end = tod_steering_end;
424 vdso_data->tb_update_count++;
425 /* Update LPAR offset. */
426 if (ptff_query(PTFF_QTO) && ptff(&qto, sizeof(qto), PTFF_QTO) == 0)
427 lpar_offset = qto.tod_epoch_difference;
428 /* Call the TOD clock change notifier. */
429 atomic_notifier_call_chain(&s390_epoch_delta_notifier, 0, &delta);
430 }
regards,
dan carpenter
reply other threads:[~2016-11-16 14:11 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161116132428.GA4282@mwanda \
--to=dan.carpenter@oracle.com \
--cc=linux-s390@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox