Skip to content

Commit

Permalink
kernel_irq_context: mark the IRQ handler in the function
Browse files Browse the repository at this point in the history
This information makes debugging sleeping in atomic warnings easier.

Signed-off-by: Dan Carpenter <[email protected]>
  • Loading branch information
Dan Carpenter committed Feb 19, 2024
1 parent ada69db commit d010690
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions smatch_kernel_irq_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,26 @@ static int db_set_irq(void *_found, int argc, char **argv, char **azColName)
return 0;
}

static void match_declaration(struct symbol *sym)
static bool is_irq_handler(void)
{
int found = 0;

if (!cur_func_sym)
return false;

run_sql(db_set_irq, &found,
"select * from fn_data_link where file = 0x%llx and function = '%s' and static = %d and type = %d;",
(cur_func_sym->ctype.modifiers & MOD_STATIC) ? get_base_file_id() : 0,
cur_func_sym->ident->name,
!!(cur_func_sym->ctype.modifiers & MOD_STATIC),
IRQ_CONTEXT);

if (!found)
return found;
}

static void match_declaration(struct symbol *sym)
{
if (!is_irq_handler())
return;

set_state(my_id, "irq_context", NULL, &true_state);
Expand Down Expand Up @@ -136,7 +144,7 @@ static void match_call_info(struct expression *expr)
if (is_ignored_fn(expr))
return;

sql_insert_caller_info(expr, IRQ_CONTEXT, -1, "", "");
sql_insert_caller_info(expr, IRQ_CONTEXT, -1, "", is_irq_handler() ? "<- IRQ handler" : "");
}

static void select_call_info(const char *name, struct symbol *sym, char *key, char *value)
Expand Down

0 comments on commit d010690

Please sign in to comment.