From: Hanjun Guo <guohanjun@huawei.com>
To: Will Deacon <will@kernel.org>, Kees Cook <keescook@chromium.org>
Cc: Peter Zijlstra <peterz@infradead.org>,
<linux-kernel@vger.kernel.org>, Ingo Molnar <mingo@kernel.org>,
Elena Reshetova <elena.reshetova@intel.com>,
Ard Biesheuvel <ard.biesheuvel@linaro.org>,
Jan Glauber <jglauber@marvell.com>
Subject: Re: [PATCH v2 0/6] Rework REFCOUNT_FULL using atomic_fetch_* operations
Date: Sat, 7 Sep 2019 09:57:00 +0800 [thread overview]
Message-ID: <82fb5620-1c10-3080-6f60-e4d826fa2aad@huawei.com> (raw)
In-Reply-To: <20190906134302.ie7wbdojkzsmrle7@willie-the-truck>
On 2019/9/6 21:43, Will Deacon wrote:
> On Wed, Aug 28, 2019 at 02:03:37PM -0700, Kees Cook wrote:
>> On Wed, Aug 28, 2019 at 03:14:40PM +0100, Will Deacon wrote:
>>> On Wed, Aug 28, 2019 at 09:30:52AM +0200, Peter Zijlstra wrote:
>>>> On Tue, Aug 27, 2019 at 05:31:58PM +0100, Will Deacon wrote:
>>>>> Will Deacon (6):
>>>>> lib/refcount: Define constants for saturation and max refcount values
>>>>> lib/refcount: Ensure integer operands are treated as signed
>>>>> lib/refcount: Remove unused refcount_*_checked() variants
>>>>> lib/refcount: Move bulk of REFCOUNT_FULL implementation into header
>>>>> lib/refcount: Improve performance of generic REFCOUNT_FULL code
>>>>> lib/refcount: Consolidate REFCOUNT_{MAX,SATURATED} definitions
>> BTW, can you repeat the timing details into the "Improve performance of
>> generic REFCOUNT_FULL code" patch?
> Of course.
>
>>>> So I'm not a fan; I itch at the whole racy nature of this thing and I
>>>> find the code less than obvious. Yet, I have to agree it is exceedingly
>>>> unlikely the race will ever actually happen, I just don't want to be the
>>>> one having to debug it.
>>> FWIW, I think much the same about the version under arch/x86 ;)
>>>
>>>> I've not looked at the implementation much; does it do all the same
>>>> checks the FULL one does? The x86-asm one misses a few iirc, so if this
>>>> is similarly fast but has all the checks, it is in fact better.
>>> Yes, it passes all of the REFCOUNT_* tests in lkdtm [1] so I agree that
>>> it's an improvement over the asm version.
>>>
>>>> Can't we make this a default !FULL implementation?
>>> My concern with doing that is I think it would make the FULL implementation
>>> entirely pointless. I can't see anybody using it, and it would only exist
>>> as an academic exercise in handling the theoretical races. That's a change
>>> from the current situation where it genuinely handles cases which the
>>> x86-specific code does not and, judging by the Kconfig text, that's the
>>> only reason for its existence.
>> Looking at timing details, the new implementation is close enough to the
>> x86 asm version that I would be fine to drop the x86-specific case
>> entirely as long as we could drop "FULL" entirely too -- we'd have _one_
>> refcount_t implementation: it would be both complete and fast.
> That works for me; I'll spin a new version of this series so you can see
> what it looks like.
I will wait for the new version then do the performance test on ARM64 server.
Thanks
Hanjun
prev parent reply other threads:[~2019-09-07 1:57 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-27 16:31 Will Deacon
2019-08-27 16:31 ` [PATCH v2 1/6] lib/refcount: Define constants for saturation and max refcount values Will Deacon
2019-08-27 16:32 ` [PATCH v2 2/6] lib/refcount: Ensure integer operands are treated as signed Will Deacon
2019-08-27 16:32 ` [PATCH v2 3/6] lib/refcount: Remove unused refcount_*_checked() variants Will Deacon
2019-08-27 16:32 ` [PATCH v2 4/6] lib/refcount: Move bulk of REFCOUNT_FULL implementation into header Will Deacon
2019-08-27 16:32 ` [PATCH v2 5/6] lib/refcount: Improve performance of generic REFCOUNT_FULL code Will Deacon
2019-08-27 16:32 ` [PATCH v2 6/6] lib/refcount: Consolidate REFCOUNT_{MAX,SATURATED} definitions Will Deacon
2019-08-27 17:51 ` [PATCH v2 0/6] Rework REFCOUNT_FULL using atomic_fetch_* operations Kees Cook
2019-08-28 7:30 ` Peter Zijlstra
2019-08-28 14:14 ` Will Deacon
2019-08-28 21:03 ` Kees Cook
2019-08-31 17:48 ` Ard Biesheuvel
2019-08-31 19:02 ` Kees Cook
2019-08-31 20:54 ` Ard Biesheuvel
2019-09-06 13:43 ` Will Deacon
2019-09-07 1:57 ` Hanjun Guo [this message]
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=82fb5620-1c10-3080-6f60-e4d826fa2aad@huawei.com \
--to=guohanjun@huawei.com \
--cc=ard.biesheuvel@linaro.org \
--cc=elena.reshetova@intel.com \
--cc=jglauber@marvell.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=will@kernel.org \
/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
all inboxes | Powered by JetHome®