* BKM on generating a call graph for smatch warnings
@ 2021-08-17 7:32 Reshetova, Elena
2021-09-13 15:09 ` Dan Carpenter
0 siblings, 1 reply; 3+ messages in thread
From: Reshetova, Elena @ 2021-08-17 7:32 UTC (permalink / raw)
To: smatch@vger.kernel.org
Hi,
Quick question: are there some suggested methods for obtaining a call graph
for a warning that a smatch pattern reports when I run it for the whole kernel?
I can see that there are a couple of existing patterns (check_capable, check_locking)
that use sql methods for saving the caller_info, but I don't fully understand how it
works, maybe there is some description somewhere on this that I missed?
Best Regards,
Elena.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: BKM on generating a call graph for smatch warnings
2021-08-17 7:32 BKM on generating a call graph for smatch warnings Reshetova, Elena
@ 2021-09-13 15:09 ` Dan Carpenter
2021-09-14 6:06 ` Reshetova, Elena
0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2021-09-13 15:09 UTC (permalink / raw)
To: Reshetova, Elena; +Cc: smatch@vger.kernel.org
Hi,
I'm really sorry, I missed your email. I was on vacation that week and
didn't see your email until now.
On Tue, Aug 17, 2021 at 07:32:21AM +0000, Reshetova, Elena wrote:
> Hi,
>
> Quick question: are there some suggested methods for obtaining a call graph
> for a warning that a smatch pattern reports when I run it for the whole kernel?
>
> I can see that there are a couple of existing patterns (check_capable, check_locking)
> that use sql methods for saving the caller_info, but I don't fully understand how it
> works, maybe there is some description somewhere on this that I missed?
How the Smatch cross function database works is that you run:
/path/to/smatch/smatch_scripts/build_kernel_data.sh
This takes a long time to run. It does a complete Smatch run and it
outputs a ton of SQL insert commands. Then it does:
cat sql.txt | sqlite3 smatch_db.sqlite
It doesn't literally cat that because that would be very slow. It's
uses a perl script to handle transactions, caching and syncing etc.
There is also a little bit of tweaking for some of the tables. The
final database on my system is 30GB.
What I do is I rebuild my database every night. Each time you rebuild
the database then the knowledge about the call tree gets pushed out one
call further.
In my experience if you rebuild the DB 5-7 times, that's basically
the limit. The call tree is complete, of course, right away. foo()
calls bar() calls baz(). But it takes two rebuilds before the user
data from foo() gets to baz().
The /path/to/smatch/smatch_data/db/smdb.py script is a way to see what's
stored in the database. `smdb.py foo` will print all the callers of
foo() and `smdb.py return_states foo` will show what it returns.
Again, very sorry for the long delay. Please let me know if you have
any questions.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: BKM on generating a call graph for smatch warnings
2021-09-13 15:09 ` Dan Carpenter
@ 2021-09-14 6:06 ` Reshetova, Elena
0 siblings, 0 replies; 3+ messages in thread
From: Reshetova, Elena @ 2021-09-14 6:06 UTC (permalink / raw)
To: Dan Carpenter; +Cc: smatch@vger.kernel.org
Hi Dan,
Thank you very much, this helps greatly!
And no worries for delayed reply, I have not gotten to resolve this yet,
was busy with other things. Let me try this out!
Best Regards,
Elena.
> -----Original Message-----
> From: Dan Carpenter <dan.carpenter@oracle.com>
> Sent: Monday, September 13, 2021 6:10 PM
> To: Reshetova, Elena <elena.reshetova@intel.com>
> Cc: smatch@vger.kernel.org
> Subject: Re: BKM on generating a call graph for smatch warnings
>
> Hi,
>
> I'm really sorry, I missed your email. I was on vacation that week and
> didn't see your email until now.
>
> On Tue, Aug 17, 2021 at 07:32:21AM +0000, Reshetova, Elena wrote:
> > Hi,
> >
> > Quick question: are there some suggested methods for obtaining a call graph
> > for a warning that a smatch pattern reports when I run it for the whole kernel?
> >
> > I can see that there are a couple of existing patterns (check_capable,
> check_locking)
> > that use sql methods for saving the caller_info, but I don't fully understand how it
> > works, maybe there is some description somewhere on this that I missed?
>
> How the Smatch cross function database works is that you run:
>
> /path/to/smatch/smatch_scripts/build_kernel_data.sh
>
> This takes a long time to run. It does a complete Smatch run and it
> outputs a ton of SQL insert commands. Then it does:
>
> cat sql.txt | sqlite3 smatch_db.sqlite
>
> It doesn't literally cat that because that would be very slow. It's
> uses a perl script to handle transactions, caching and syncing etc.
> There is also a little bit of tweaking for some of the tables. The
> final database on my system is 30GB.
>
> What I do is I rebuild my database every night. Each time you rebuild
> the database then the knowledge about the call tree gets pushed out one
> call further.
>
> In my experience if you rebuild the DB 5-7 times, that's basically
> the limit. The call tree is complete, of course, right away. foo()
> calls bar() calls baz(). But it takes two rebuilds before the user
> data from foo() gets to baz().
>
> The /path/to/smatch/smatch_data/db/smdb.py script is a way to see what's
> stored in the database. `smdb.py foo` will print all the callers of
> foo() and `smdb.py return_states foo` will show what it returns.
>
> Again, very sorry for the long delay. Please let me know if you have
> any questions.
>
> regards,
> dan carpenter
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-09-14 6:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-08-17 7:32 BKM on generating a call graph for smatch warnings Reshetova, Elena
2021-09-13 15:09 ` Dan Carpenter
2021-09-14 6:06 ` Reshetova, Elena
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.