aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/ds.c
diff options
context:
space:
mode:
authorMarkus Metzger <markus.t.metzger@intel.com>2009-03-13 05:46:42 -0400
committerIngo Molnar <mingo@elte.hu>2009-03-13 06:57:20 -0400
commitb8e47195451c5d3f62620b2b1b5928669afd56eb (patch)
tree382417812bb3da005fb294dfe99e389273b1137a /arch/x86/kernel/ds.c
parent8a327f6d1b05f5ce16572b4413a5df1d0e872283 (diff)
x86, bts: correct comment style in ds.c
Correct the comment style in ds.c. Signed-off-by: Markus Metzger <markus.t.metzger@intel.com> LKML-Reference: <20090313104642.A30149@sedona.ch.intel.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/ds.c')
-rw-r--r--arch/x86/kernel/ds.c79
1 files changed, 39 insertions, 40 deletions
diff --git a/arch/x86/kernel/ds.c b/arch/x86/kernel/ds.c
index 51c936c1a390..d9cab7168058 100644
--- a/arch/x86/kernel/ds.c
+++ b/arch/x86/kernel/ds.c
@@ -35,25 +35,22 @@
35 * The configuration for a particular DS hardware implementation. 35 * The configuration for a particular DS hardware implementation.
36 */ 36 */
37struct ds_configuration { 37struct ds_configuration {
38 /* the name of the configuration */ 38 /* The name of the configuration. */
39 const char *name; 39 const char *name;
40 /* the size of one pointer-typed field in the DS structure and 40 /* The size of pointer-typed fields in DS, BTS, and PEBS. */
41 in the BTS and PEBS buffers in bytes;
42 this covers the first 8 DS fields related to buffer management. */
43 unsigned char sizeof_ptr_field; 41 unsigned char sizeof_ptr_field;
44 /* the size of a BTS/PEBS record in bytes */ 42 /* The size of a BTS/PEBS record in bytes. */
45 unsigned char sizeof_rec[2]; 43 unsigned char sizeof_rec[2];
46 /* a series of bit-masks to control various features indexed 44 /* Control bit-masks indexed by enum ds_feature. */
47 * by enum ds_feature */
48 unsigned long ctl[dsf_ctl_max]; 45 unsigned long ctl[dsf_ctl_max];
49}; 46};
50static DEFINE_PER_CPU(struct ds_configuration, ds_cfg_array); 47static DEFINE_PER_CPU(struct ds_configuration, ds_cfg_array);
51 48
52#define ds_cfg per_cpu(ds_cfg_array, smp_processor_id()) 49#define ds_cfg per_cpu(ds_cfg_array, smp_processor_id())
53 50
54#define MAX_SIZEOF_DS (12 * 8) /* maximal size of a DS configuration */ 51#define MAX_SIZEOF_DS (12 * 8) /* Maximal size of a DS configuration. */
55#define MAX_SIZEOF_BTS (3 * 8) /* maximal size of a BTS record */ 52#define MAX_SIZEOF_BTS (3 * 8) /* Maximal size of a BTS record. */
56#define DS_ALIGNMENT (1 << 3) /* BTS and PEBS buffer alignment */ 53#define DS_ALIGNMENT (1 << 3) /* BTS and PEBS buffer alignment. */
57 54
58#define BTS_CONTROL \ 55#define BTS_CONTROL \
59 (ds_cfg.ctl[dsf_bts] | ds_cfg.ctl[dsf_bts_kernel] | ds_cfg.ctl[dsf_bts_user] |\ 56 (ds_cfg.ctl[dsf_bts] | ds_cfg.ctl[dsf_bts_kernel] | ds_cfg.ctl[dsf_bts_user] |\
@@ -67,28 +64,28 @@ static DEFINE_PER_CPU(struct ds_configuration, ds_cfg_array);
67 * to identify tracers. 64 * to identify tracers.
68 */ 65 */
69struct ds_tracer { 66struct ds_tracer {
70 /* the DS context (partially) owned by this tracer */ 67 /* The DS context (partially) owned by this tracer. */
71 struct ds_context *context; 68 struct ds_context *context;
72 /* the buffer provided on ds_request() and its size in bytes */ 69 /* The buffer provided on ds_request() and its size in bytes. */
73 void *buffer; 70 void *buffer;
74 size_t size; 71 size_t size;
75}; 72};
76 73
77struct bts_tracer { 74struct bts_tracer {
78 /* the common DS part */ 75 /* The common DS part. */
79 struct ds_tracer ds; 76 struct ds_tracer ds;
80 /* the trace including the DS configuration */ 77 /* The trace including the DS configuration. */
81 struct bts_trace trace; 78 struct bts_trace trace;
82 /* buffer overflow notification function */ 79 /* Buffer overflow notification function. */
83 bts_ovfl_callback_t ovfl; 80 bts_ovfl_callback_t ovfl;
84}; 81};
85 82
86struct pebs_tracer { 83struct pebs_tracer {
87 /* the common DS part */ 84 /* The common DS part. */
88 struct ds_tracer ds; 85 struct ds_tracer ds;
89 /* the trace including the DS configuration */ 86 /* The trace including the DS configuration. */
90 struct pebs_trace trace; 87 struct pebs_trace trace;
91 /* buffer overflow notification function */ 88 /* Buffer overflow notification function. */
92 pebs_ovfl_callback_t ovfl; 89 pebs_ovfl_callback_t ovfl;
93}; 90};
94 91
@@ -214,18 +211,16 @@ static inline int check_tracer(struct task_struct *task)
214 * deallocated when the last user puts the context. 211 * deallocated when the last user puts the context.
215 */ 212 */
216struct ds_context { 213struct ds_context {
217 /* pointer to the DS configuration; goes into MSR_IA32_DS_AREA */ 214 /* The DS configuration; goes into MSR_IA32_DS_AREA. */
218 unsigned char ds[MAX_SIZEOF_DS]; 215 unsigned char ds[MAX_SIZEOF_DS];
219 /* the owner of the BTS and PEBS configuration, respectively */ 216 /* The owner of the BTS and PEBS configuration, respectively. */
220 struct bts_tracer *bts_master; 217 struct bts_tracer *bts_master;
221 struct pebs_tracer *pebs_master; 218 struct pebs_tracer *pebs_master;
222 /* use count */ 219 /* Use count. */
223 unsigned long count; 220 unsigned long count;
224 /* a pointer to the context location inside the thread_struct 221 /* Pointer to the context pointer field. */
225 * or the per_cpu context array */
226 struct ds_context **this; 222 struct ds_context **this;
227 /* a pointer to the task owning this context, or NULL, if the 223 /* The traced task; NULL for current cpu. */
228 * context is owned by a cpu */
229 struct task_struct *task; 224 struct task_struct *task;
230}; 225};
231 226
@@ -350,14 +345,14 @@ static int ds_write(struct ds_context *context, enum ds_qualifier qual,
350 unsigned long write_size, adj_write_size; 345 unsigned long write_size, adj_write_size;
351 346
352 /* 347 /*
353 * write as much as possible without producing an 348 * Write as much as possible without producing an
354 * overflow interrupt. 349 * overflow interrupt.
355 * 350 *
356 * interrupt_threshold must either be 351 * Interrupt_threshold must either be
357 * - bigger than absolute_maximum or 352 * - bigger than absolute_maximum or
358 * - point to a record between buffer_base and absolute_maximum 353 * - point to a record between buffer_base and absolute_maximum
359 * 354 *
360 * index points to a valid record. 355 * Index points to a valid record.
361 */ 356 */
362 base = ds_get(context->ds, qual, ds_buffer_base); 357 base = ds_get(context->ds, qual, ds_buffer_base);
363 index = ds_get(context->ds, qual, ds_index); 358 index = ds_get(context->ds, qual, ds_index);
@@ -366,8 +361,10 @@ static int ds_write(struct ds_context *context, enum ds_qualifier qual,
366 361
367 write_end = min(end, int_th); 362 write_end = min(end, int_th);
368 363
369 /* if we are already beyond the interrupt threshold, 364 /*
370 * we fill the entire buffer */ 365 * If we are already beyond the interrupt threshold,
366 * we fill the entire buffer.
367 */
371 if (write_end <= index) 368 if (write_end <= index)
372 write_end = end; 369 write_end = end;
373 370
@@ -384,7 +381,7 @@ static int ds_write(struct ds_context *context, enum ds_qualifier qual,
384 adj_write_size = write_size / ds_cfg.sizeof_rec[qual]; 381 adj_write_size = write_size / ds_cfg.sizeof_rec[qual];
385 adj_write_size *= ds_cfg.sizeof_rec[qual]; 382 adj_write_size *= ds_cfg.sizeof_rec[qual];
386 383
387 /* zero out trailing bytes */ 384 /* Zero out trailing bytes. */
388 memset((char *)index + write_size, 0, 385 memset((char *)index + write_size, 0,
389 adj_write_size - write_size); 386 adj_write_size - write_size);
390 index += adj_write_size; 387 index += adj_write_size;
@@ -556,7 +553,8 @@ static void ds_init_ds_trace(struct ds_trace *trace, enum ds_qualifier qual,
556 unsigned int flags) { 553 unsigned int flags) {
557 unsigned long buffer, adj; 554 unsigned long buffer, adj;
558 555
559 /* adjust the buffer address and size to meet alignment 556 /*
557 * Adjust the buffer address and size to meet alignment
560 * constraints: 558 * constraints:
561 * - buffer is double-word aligned 559 * - buffer is double-word aligned
562 * - size is multiple of record size 560 * - size is multiple of record size
@@ -578,7 +576,8 @@ static void ds_init_ds_trace(struct ds_trace *trace, enum ds_qualifier qual,
578 trace->begin = (void *)buffer; 576 trace->begin = (void *)buffer;
579 trace->top = trace->begin; 577 trace->top = trace->begin;
580 trace->end = (void *)(buffer + size); 578 trace->end = (void *)(buffer + size);
581 /* The value for 'no threshold' is -1, which will set the 579 /*
580 * The value for 'no threshold' is -1, which will set the
582 * threshold outside of the buffer, just like we want it. 581 * threshold outside of the buffer, just like we want it.
583 */ 582 */
584 trace->ith = (void *)(buffer + size - ith); 583 trace->ith = (void *)(buffer + size - ith);
@@ -602,7 +601,7 @@ static int ds_request(struct ds_tracer *tracer, struct ds_trace *trace,
602 if (!base) 601 if (!base)
603 goto out; 602 goto out;
604 603
605 /* we require some space to do alignment adjustments below */ 604 /* We require some space to do alignment adjustments below. */
606 error = -EINVAL; 605 error = -EINVAL;
607 if (size < (DS_ALIGNMENT + ds_cfg.sizeof_rec[qual])) 606 if (size < (DS_ALIGNMENT + ds_cfg.sizeof_rec[qual]))
608 goto out; 607 goto out;
@@ -640,7 +639,7 @@ struct bts_tracer *ds_request_bts(struct task_struct *task,
640 unsigned long irq; 639 unsigned long irq;
641 int error; 640 int error;
642 641
643 /* buffer overflow notification is not yet implemented */ 642 /* Buffer overflow notification is not yet implemented. */
644 error = -EOPNOTSUPP; 643 error = -EOPNOTSUPP;
645 if (ovfl) 644 if (ovfl)
646 goto out; 645 goto out;
@@ -700,7 +699,7 @@ struct pebs_tracer *ds_request_pebs(struct task_struct *task,
700 unsigned long irq; 699 unsigned long irq;
701 int error; 700 int error;
702 701
703 /* buffer overflow notification is not yet implemented */ 702 /* Buffer overflow notification is not yet implemented. */
704 error = -EOPNOTSUPP; 703 error = -EOPNOTSUPP;
705 if (ovfl) 704 if (ovfl)
706 goto out; 705 goto out;
@@ -983,9 +982,9 @@ void __cpuinit ds_init_intel(struct cpuinfo_x86 *c)
983 case 0x1c: /* Atom */ 982 case 0x1c: /* Atom */
984 ds_configure(&ds_cfg_core2_atom, c); 983 ds_configure(&ds_cfg_core2_atom, c);
985 break; 984 break;
986 case 0x1a: /* i7 */ 985 case 0x1a: /* Core i7 */
987 default: 986 default:
988 /* sorry, don't know about them */ 987 /* Sorry, don't know about them. */
989 break; 988 break;
990 } 989 }
991 break; 990 break;
@@ -997,12 +996,12 @@ void __cpuinit ds_init_intel(struct cpuinfo_x86 *c)
997 ds_configure(&ds_cfg_netburst, c); 996 ds_configure(&ds_cfg_netburst, c);
998 break; 997 break;
999 default: 998 default:
1000 /* sorry, don't know about them */ 999 /* Sorry, don't know about them. */
1001 break; 1000 break;
1002 } 1001 }
1003 break; 1002 break;
1004 default: 1003 default:
1005 /* sorry, don't know about them */ 1004 /* Sorry, don't know about them. */
1006 break; 1005 break;
1007 } 1006 }
1008} 1007}