Deleted Added
full compact
kern_clocksource.c (247329) kern_clocksource.c (247454)
1/*-
2 * Copyright (c) 2010-2012 Alexander Motin <mav@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2010-2012 Alexander Motin <mav@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: head/sys/kern/kern_clocksource.c 247329 2013-02-26 18:13:42Z mav $");
28__FBSDID("$FreeBSD: head/sys/kern/kern_clocksource.c 247454 2013-02-28 10:46:54Z davide $");
29
30/*
31 * Common routines to manage event timers hardware.
32 */
33
34#include "opt_device_polling.h"
35#include "opt_kdtrace.h"
36

--- 725 unchanged lines hidden (view full) ---

762 } else
763 profiling--;
764 ET_UNLOCK();
765}
766
767/*
768 * Switch to idle mode (all ticks handled).
769 */
29
30/*
31 * Common routines to manage event timers hardware.
32 */
33
34#include "opt_device_polling.h"
35#include "opt_kdtrace.h"
36

--- 725 unchanged lines hidden (view full) ---

762 } else
763 profiling--;
764 ET_UNLOCK();
765}
766
767/*
768 * Switch to idle mode (all ticks handled).
769 */
770void
770sbintime_t
771cpu_idleclock(void)
772{
773 struct bintime now, t;
774 struct pcpu_state *state;
775
776 if (idletick || busy ||
777 (periodic && (timer->et_flags & ET_FLAGS_PERCPU))
778#ifdef DEVICE_POLLING
779 || curcpu == CPU_FIRST()
780#endif
781 )
771cpu_idleclock(void)
772{
773 struct bintime now, t;
774 struct pcpu_state *state;
775
776 if (idletick || busy ||
777 (periodic && (timer->et_flags & ET_FLAGS_PERCPU))
778#ifdef DEVICE_POLLING
779 || curcpu == CPU_FIRST()
780#endif
781 )
782 return;
782 return (-1);
783 state = DPCPU_PTR(timerstate);
784 if (periodic)
785 now = state->now;
786 else
787 binuptime(&now);
788 CTR4(KTR_SPARE2, "idle at %d: now %d.%08x%08x",
789 curcpu, now.sec, (u_int)(now.frac >> 32),
790 (u_int)(now.frac & 0xffffffff));
791 getnextcpuevent(&t, 1);
792 ET_HW_LOCK(state);
793 state->idle = 1;
794 state->nextevent = t;
795 if (!periodic)
796 loadtimer(&now, 0);
797 ET_HW_UNLOCK(state);
783 state = DPCPU_PTR(timerstate);
784 if (periodic)
785 now = state->now;
786 else
787 binuptime(&now);
788 CTR4(KTR_SPARE2, "idle at %d: now %d.%08x%08x",
789 curcpu, now.sec, (u_int)(now.frac >> 32),
790 (u_int)(now.frac & 0xffffffff));
791 getnextcpuevent(&t, 1);
792 ET_HW_LOCK(state);
793 state->idle = 1;
794 state->nextevent = t;
795 if (!periodic)
796 loadtimer(&now, 0);
797 ET_HW_UNLOCK(state);
798 bintime_sub(&t, &now);
799 return (MAX(bttosbt(t), 0));
798}
799
800/*
801 * Switch to active mode (skip empty ticks).
802 */
803void
804cpu_activeclock(void)
805{

--- 172 unchanged lines hidden ---
800}
801
802/*
803 * Switch to active mode (skip empty ticks).
804 */
805void
806cpu_activeclock(void)
807{

--- 172 unchanged lines hidden ---