blob: b3dc2198ede5414eb77a3cf179a394700502a7dd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_CLOCK_TICK_H
#define _SYS_CLOCK_TICK_H
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/types.h>
#include <sys/mutex.h>
#include <sys/cpuvar.h>
#include <sys/systm.h>
#include <sys/cyclic.h>
#ifdef __cplusplus
extern "C" {
#endif
#define CLOCK_TICK_NCPUS 32
/*
* Per-CPU structure to facilitate multi-threaded tick accounting.
*
* ct_lock
* Mutex for the structure. Used to lock the structure to pass
* arguments to the tick processing softint handler.
* ct_intr
* Tick processing softint handle. For parallelism, each CPU
* needs to have its own softint handle.
* ct_lbolt
* Copy of the lbolt at the time of tick scheduling.
* ct_pending
* Number of ticks to be processed by one invocation of the tick
* processing softint.
* ct_start
* First CPU to do tick processing for.
* ct_end
* Last CPU to do tick processing for.
* ct_scan
* CPU to start the tick processing from. Rotated every tick.
*/
typedef struct clock_tick_cpu {
kmutex_t ct_lock;
ulong_t ct_intr;
clock_t ct_lbolt;
int ct_pending;
int ct_start;
int ct_end;
int ct_scan;
} clock_tick_cpu_t;
/*
* Per-set structure to facilitate multi-threaded tick accounting.
* clock_tick_lock protects this.
*
* ct_start
* First CPU to do tick processing for.
* ct_end
* Last CPU to do tick processing for.
* ct_scan
* CPU to start the tick processing from. Rotated every tick.
*/
typedef struct clock_tick_set {
int ct_start;
int ct_end;
int ct_scan;
} clock_tick_set_t;
#define CLOCK_TICK_CPU_OFFLINE(cp) \
(((cp) != cpu_active) && ((cp)->cpu_next_onln == (cp)))
#define CLOCK_TICK_XCALL_SAFE(cp) \
CPU_IN_SET(clock_tick_online_cpuset, cp->cpu_id)
#define CLOCK_TICK_PROC_MAX 10
#ifdef _KERNEL
#pragma weak create_softint
extern ulong_t create_softint(uint_t, uint_t (*)(caddr_t, caddr_t),
caddr_t);
#pragma weak invoke_softint
extern void invoke_softint(processorid_t, ulong_t);
#pragma weak sync_softint
extern void sync_softint(cpuset_t);
extern void clock_tick(kthread_t *, int);
extern void membar_sync(void);
extern int hires_tick;
#endif /* _KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_CLOCK_TICK_H */
|