Skip to content

Commit 0990d83

Browse files
mzaslonkhcahca
authored andcommitted
s390/debug: debug feature version 3
Change __debug_entry structure in the following way: - remove redundant union - Field containing cpuid is expanded to 16 bits. 8-bit width was not enough since we already support up to 512 cpus. - Field containing the timestamp is expanded to 60 bits. The timestamp itself is now stored in the absolute Unix time format in microseconds taking the Epoch Index into acount. Adjust default header for debug entries by setting minimum width for cpuid to 4 digits. Reviewed-by: Heiko Carstens <[email protected]> Signed-off-by: Mikhail Zaslonko <[email protected]> Signed-off-by: Heiko Carstens <[email protected]>
1 parent 929a343 commit 0990d83

File tree

2 files changed

+24
-25
lines changed

2 files changed

+24
-25
lines changed

arch/s390/include/asm/debug.h

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/*
33
* S/390 debug facility
44
*
5-
* Copyright IBM Corp. 1999, 2000
5+
* Copyright IBM Corp. 1999, 2020
66
*/
77
#ifndef DEBUG_H
88
#define DEBUG_H
@@ -26,19 +26,14 @@
2626
#define DEBUG_DATA(entry) (char *)(entry + 1) /* data is stored behind */
2727
/* the entry information */
2828

29-
#define __DEBUG_FEATURE_VERSION 2 /* version of debug feature */
29+
#define __DEBUG_FEATURE_VERSION 3 /* version of debug feature */
3030

3131
struct __debug_entry {
32-
union {
33-
struct {
34-
unsigned long clock : 52;
35-
unsigned long exception : 1;
36-
unsigned long level : 3;
37-
unsigned long cpuid : 8;
38-
} fields;
39-
unsigned long stck;
40-
} id;
32+
unsigned long clock : 60;
33+
unsigned long exception : 1;
34+
unsigned long level : 3;
4135
void *caller;
36+
unsigned short cpu;
4237
} __packed;
4338

4439
typedef struct __debug_entry debug_entry_t;

arch/s390/kernel/debug.c

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/*
33
* S/390 debug facility
44
*
5-
* Copyright IBM Corp. 1999, 2012
5+
* Copyright IBM Corp. 1999, 2020
66
*
77
* Author(s): Michael Holzheu ([email protected]),
88
* Holger Smolinski ([email protected])
@@ -433,7 +433,7 @@ static int debug_format_entry(file_private_info_t *p_info)
433433
act_entry = (debug_entry_t *) ((char *)id_snap->areas[p_info->act_area]
434434
[p_info->act_page] + p_info->act_entry);
435435

436-
if (act_entry->id.stck == 0LL)
436+
if (act_entry->clock == 0LL)
437437
goto out; /* empty entry */
438438
if (view->header_proc)
439439
len += view->header_proc(id_snap, view, p_info->act_area,
@@ -829,12 +829,17 @@ static inline debug_entry_t *get_active_entry(debug_info_t *id)
829829
static inline void debug_finish_entry(debug_info_t *id, debug_entry_t *active,
830830
int level, int exception)
831831
{
832-
active->id.stck = get_tod_clock_fast() -
833-
*(unsigned long long *) &tod_clock_base[1];
834-
active->id.fields.cpuid = smp_processor_id();
832+
unsigned char clk[STORE_CLOCK_EXT_SIZE];
833+
unsigned long timestamp;
834+
835+
get_tod_clock_ext(clk);
836+
timestamp = *(unsigned long *) &clk[0] >> 4;
837+
timestamp -= TOD_UNIX_EPOCH >> 12;
838+
active->clock = timestamp;
839+
active->cpu = smp_processor_id();
835840
active->caller = __builtin_return_address(0);
836-
active->id.fields.exception = exception;
837-
active->id.fields.level = level;
841+
active->exception = exception;
842+
active->level = level;
838843
proceed_active_entry(id);
839844
if (exception)
840845
proceed_active_area(id);
@@ -1398,25 +1403,24 @@ static int debug_hex_ascii_format_fn(debug_info_t *id, struct debug_view *view,
13981403
int debug_dflt_header_fn(debug_info_t *id, struct debug_view *view,
13991404
int area, debug_entry_t *entry, char *out_buf)
14001405
{
1401-
unsigned long base, sec, usec;
1406+
unsigned long sec, usec;
14021407
unsigned long caller;
14031408
unsigned int level;
14041409
char *except_str;
14051410
int rc = 0;
14061411

1407-
level = entry->id.fields.level;
1408-
base = (*(unsigned long *) &tod_clock_base[0]) >> 4;
1409-
sec = (entry->id.stck >> 12) + base - (TOD_UNIX_EPOCH >> 12);
1412+
level = entry->level;
1413+
sec = entry->clock;
14101414
usec = do_div(sec, USEC_PER_SEC);
14111415

1412-
if (entry->id.fields.exception)
1416+
if (entry->exception)
14131417
except_str = "*";
14141418
else
14151419
except_str = "-";
14161420
caller = (unsigned long) entry->caller;
1417-
rc += sprintf(out_buf, "%02i %011ld:%06lu %1u %1s %02i %pK ",
1421+
rc += sprintf(out_buf, "%02i %011ld:%06lu %1u %1s %04u %pK ",
14181422
area, sec, usec, level, except_str,
1419-
entry->id.fields.cpuid, (void *)caller);
1423+
entry->cpu, (void *)caller);
14201424
return rc;
14211425
}
14221426
EXPORT_SYMBOL(debug_dflt_header_fn);

0 commit comments

Comments
 (0)