* [PATCH] dissect: use struct symbol::visited/inspected instead of ::examined/evaluated
@ 2020-07-29 14:51 Luc Van Oostenryck
2020-07-29 15:34 ` Oleg Nesterov
0 siblings, 1 reply; 3+ messages in thread
From: Luc Van Oostenryck @ 2020-07-29 14:51 UTC (permalink / raw)
To: linux-sparse, Oleg Nesterov; +Cc: Alexey Gladkov, Luc Van Oostenryck
The dissect client uses struct symbol's fields 'examined' & 'evaluated'
to avoid reprocessing the same symbols. But these fields are used
internally by sparse for type examination & evaluation and despite
dissect not doing these operations explicitly, they can be done
implicitly (for example to handle static assertions or when the
value of a constant expression is needed).
So, add a new field to struct symbol: 'inspected' and use it, as
well as the existing 'visited', instead of 'evaluated' & 'examined'.
Note: when used on the kernel, this patch avoids a lot of warnings:
"warning: r_member bad sym type=7 kind=0"
"warning: r_member bad mem->kind = 0"
and creates substantially more normal output.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
dissect.c | 8 ++++----
symbol.h | 1 +
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/dissect.c b/dissect.c
index fd09707dbf67..582e8fc32e46 100644
--- a/dissect.c
+++ b/dissect.c
@@ -204,9 +204,9 @@ static void examine_sym_node(struct symbol *node, struct symbol *parent)
struct ident *name = node->ident;
struct symbol *base, *dctx;
- if (node->examined)
+ if (node->visited)
return;
- node->examined = 1;
+ node->visited = 1;
node->kind = 'v';
while ((base = node->ctype.base_type) != NULL)
@@ -228,9 +228,9 @@ static void examine_sym_node(struct symbol *node, struct symbol *parent)
break;
case SYM_STRUCT: case SYM_UNION: //case SYM_ENUM:
- if (base->evaluated)
+ if (base->inspected)
return;
- base->evaluated = 1;
+ base->inspected = 1;
base->kind = 's';
if (!base->symbol_list)
diff --git a/symbol.h b/symbol.h
index c2b60ce91c27..08d1134a7d82 100644
--- a/symbol.h
+++ b/symbol.h
@@ -209,6 +209,7 @@ struct symbol {
struct { /* sparse ctags */
char kind;
unsigned char visited:1;
+ unsigned char inspected:1;
};
};
pseudo_t pseudo;
--
2.28.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] dissect: use struct symbol::visited/inspected instead of ::examined/evaluated
2020-07-29 14:51 [PATCH] dissect: use struct symbol::visited/inspected instead of ::examined/evaluated Luc Van Oostenryck
@ 2020-07-29 15:34 ` Oleg Nesterov
2020-07-29 15:48 ` Luc Van Oostenryck
0 siblings, 1 reply; 3+ messages in thread
From: Oleg Nesterov @ 2020-07-29 15:34 UTC (permalink / raw)
To: Luc Van Oostenryck; +Cc: linux-sparse, Alexey Gladkov
On 07/29, Luc Van Oostenryck wrote:
>
> The dissect client uses struct symbol's fields 'examined' & 'evaluated'
> to avoid reprocessing the same symbols. But these fields are used
> internally by sparse for type examination & evaluation and despite
> dissect not doing these operations explicitly, they can be done
> implicitly
Yes. For example, test_dissect.c calls show_typename() and this can
lead to examine/evaluate.
I didn't bother to fix this because test_dissect.c is the very basic
debugging tool.
> So, add a new field to struct symbol: 'inspected' and use it, as
> well as the existing 'visited', instead of 'evaluated' & 'examined'.
Thanks! Looks good to me.
> Note: when used on the kernel, this patch avoids a lot of warnings:
> "warning: r_member bad sym type=7 kind=0"
> "warning: r_member bad mem->kind = 0"
> and creates substantially more normal output.
So this is test-dissect, sindex should be fine even without this patch.
Acked-by: Oleg Nesterov <oleg@redhat.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] dissect: use struct symbol::visited/inspected instead of ::examined/evaluated
2020-07-29 15:34 ` Oleg Nesterov
@ 2020-07-29 15:48 ` Luc Van Oostenryck
0 siblings, 0 replies; 3+ messages in thread
From: Luc Van Oostenryck @ 2020-07-29 15:48 UTC (permalink / raw)
To: Oleg Nesterov; +Cc: linux-sparse, Alexey Gladkov
On Wed, Jul 29, 2020 at 05:34:13PM +0200, Oleg Nesterov wrote:
> On 07/29, Luc Van Oostenryck wrote:
> >
> > The dissect client uses struct symbol's fields 'examined' & 'evaluated'
> > to avoid reprocessing the same symbols. But these fields are used
> > internally by sparse for type examination & evaluation and despite
> > dissect not doing these operations explicitly, they can be done
> > implicitly
>
> Yes. For example, test_dissect.c calls show_typename() and this can
> lead to examine/evaluate.
>
> I didn't bother to fix this because test_dissect.c is the very basic
> debugging tool.
>
> > So, add a new field to struct symbol: 'inspected' and use it, as
> > well as the existing 'visited', instead of 'evaluated' & 'examined'.
>
> Thanks! Looks good to me.
>
> > Note: when used on the kernel, this patch avoids a lot of warnings:
> > "warning: r_member bad sym type=7 kind=0"
> > "warning: r_member bad mem->kind = 0"
> > and creates substantially more normal output.
>
> So this is test-dissect, sindex should be fine even without this patch.
Yes, I only used test-dissect but sindex should be affected too.
The real problem is that, even without the show_typename() from
test-dissect, some symbols can already be examined by __sparse().
In this case dissect.c:examine_sym_node() will be a no-op because
node->examined will already be set. One of the symptoms is node->kind
having a value of 0.
I'll clarify the commit message.
-- Luc
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-07-29 15:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-29 14:51 [PATCH] dissect: use struct symbol::visited/inspected instead of ::examined/evaluated Luc Van Oostenryck
2020-07-29 15:34 ` Oleg Nesterov
2020-07-29 15:48 ` Luc Van Oostenryck
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.