From: Linus Torvalds <torvalds@linux-foundation.org>
To: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Cc: Josh Triplett <josh@joshtriplett.org>,
Sparse Mailing-list <linux-sparse@vger.kernel.org>
Subject: Re: idea/question about sparse's context checking
Date: Fri, 18 Aug 2017 14:10:26 -0700 [thread overview]
Message-ID: <CA+55aFzFYgEPAREZCWLNTxY3HdamETBvjP-uQafnqwGxReoD+w@mail.gmail.com> (raw)
In-Reply-To: <CAExDi1Sn4q67_WcN6jSWKDSyxSSR2UPseTYm9Or9uopcQNn81w@mail.gmail.com>
On Fri, Aug 18, 2017 at 1:59 PM, Luc Van Oostenryck
<luc.vanoostenryck@gmail.com> wrote:
>
>> We do all the flow stuff for variables
>> anyway, and using a hidden variable would make it potentially a lot
>> more flexible. You could make the context op do much more than just a
>> fixed inc/dec.
>
> Yes, I see potential too, but nothing very specific. Have you something in mind?
No, to a first approximation I'd just continue to add and subtract
constant values.
But it might allow us to do conditional contexts, which the kernel
actually needs. Right now the kernel does tricks like this:
# define __cond_lock(x,c) ((c) ? ({ __acquire(x); 1; }) : 0)
(see include/linux/compiler.h) exactly because we want to not really
add a constant 1 to the context, but add it only if the condition "c"
was non-zero.
We then depend on sparse just doing the flow simplification etc. But
it *could* have been done by just instead allowing the context to be
updated with a boolean variable..
But sparse might prefer that flow-based approach anyway - I'm just
saying that sometimes a more flexible model could be a good thing at
least in theory.
Linus
next prev parent reply other threads:[~2017-08-18 21:10 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-18 13:20 idea/question about sparse's context checking Luc Van Oostenryck
2017-08-18 14:26 ` Josh Triplett
2017-08-18 14:37 ` Christopher Li
2017-08-18 16:15 ` Luc Van Oostenryck
2017-08-18 18:18 ` Christopher Li
2017-08-18 19:01 ` Luc Van Oostenryck
2017-08-18 19:59 ` Christopher Li
2017-08-18 19:34 ` Linus Torvalds
2017-08-18 20:59 ` Luc Van Oostenryck
2017-08-18 21:10 ` Linus Torvalds [this message]
2017-08-18 21:56 ` Luc Van Oostenryck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CA+55aFzFYgEPAREZCWLNTxY3HdamETBvjP-uQafnqwGxReoD+w@mail.gmail.com \
--to=torvalds@linux-foundation.org \
--cc=josh@joshtriplett.org \
--cc=linux-sparse@vger.kernel.org \
--cc=luc.vanoostenryck@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).