Subversion Repositories HelenOS-historic

Rev

Rev 1264 | Rev 1323 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1264 Rev 1313
Line 38... Line 38...
38
#include <preemption.h>
38
#include <preemption.h>
39
#include <print.h>
39
#include <print.h>
40
#include <debug.h>
40
#include <debug.h>
41
#include <symtab.h>
41
#include <symtab.h>
42
 
42
 
-
 
43
#ifdef CONFIG_FB
-
 
44
#include <genarch/fb/fb.h>
-
 
45
#endif
-
 
46
 
43
#ifdef CONFIG_SMP
47
#ifdef CONFIG_SMP
44
 
48
 
45
/** Initialize spinlock
49
/** Initialize spinlock
46
 *
50
 *
47
 * Initialize spinlock.
51
 * Initialize spinlock.
Line 71... Line 75...
71
    char *symbol;
75
    char *symbol;
72
    bool deadlock_reported = false;
76
    bool deadlock_reported = false;
73
 
77
 
74
    preemption_disable();
78
    preemption_disable();
75
    while (test_and_set(&sl->val)) {
79
    while (test_and_set(&sl->val)) {
-
 
80
 
-
 
81
        /*
-
 
82
         * We need to be careful about printflock and fb_lock.
-
 
83
         * Both of them are used to report deadlocks via
-
 
84
         * printf() and fb_putchar().
-
 
85
         *
-
 
86
         * We trust our code that there is no possible deadlock
-
 
87
         * caused by these two locks (except when an exception
-
 
88
         * is triggered for instance by printf() or fb_putchar()).
-
 
89
         * However, we encountered false positives caused by very
-
 
90
         * slow VESA framebuffer interaction (especially when
-
 
91
         * run in a simulator) that caused problems with both
-
 
92
         * printflock and fb_lock.
-
 
93
         *
-
 
94
         * Possible deadlocks on both printflock and fb_lock
-
 
95
         * are therefore not reported as they would cause an
-
 
96
         * infinite recursion.
-
 
97
         */
-
 
98
        if (sl == &printflock)
-
 
99
            continue;
-
 
100
#ifdef CONFIG_FB
-
 
101
        if (sl == &fb_lock)
-
 
102
            continue;
-
 
103
#endif
76
        if (i++ > 300000 && sl!=&printflock) {
104
        if (i++ > 300000) {
77
            printf("cpu%d: looping on spinlock %.*p:%s, caller=%.*p",
105
            printf("cpu%d: looping on spinlock %.*p:%s, caller=%.*p",
78
                   CPU->id, sizeof(__address) * 2, sl, sl->name, sizeof(__address) * 2, CALLER);
106
                   CPU->id, sizeof(__address) * 2, sl, sl->name, sizeof(__address) * 2, CALLER);
79
            symbol = get_symtab_entry(CALLER);
107
            symbol = get_symtab_entry(CALLER);
80
            if (symbol)
108
            if (symbol)
81
                printf("(%s)", symbol);
109
                printf("(%s)", symbol);