From: catalin.marinas@arm.com (Catalin Marinas)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/2] ARM: mm: make mm->context.id an atomic64_t variable
Date: Mon, 25 Feb 2013 15:59:46 +0000 [thread overview]
Message-ID: <20130225155946.GC612@arm.com> (raw)
In-Reply-To: <1361805488-8798-2-git-send-email-will.deacon@arm.com>
On Mon, Feb 25, 2013 at 03:18:08PM +0000, Will Deacon wrote:
> mm->context.id is updated under asid_lock when a new ASID is allocated
> to an mm_struct. However, it is also read without the lock when a task
> is being scheduled and checking whether or not the current ASID
> generation is up-to-date.
>
> If two threads of the same process are being scheduled in parallel and
> the bottom bits of the generation in their mm->context.id match the
> current generation (that is, the mm_struct has not been used for ~2^24
> rollovers) then the non-atomic, lockless access to mm->context.id may
> yield the incorrect ASID.
>
> This patch fixes this issue by making mm->context.id and atomic64_t,
> ensuring that the generation is always read consistently. For code that
> only requires access to the ASID bits (e.g. TLB flushing by mm), then
> the value is accessed directly, which GCC converts to an ldrb.
>
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Will Deacon <will.deacon@arm.com>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
next prev parent reply other threads:[~2013-02-25 15:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-25 15:18 [PATCH 1/2] ARM: mm: fix race updating mm->context.id on ASID rollover Will Deacon
2013-02-25 15:18 ` [PATCH 2/2] ARM: mm: make mm->context.id an atomic64_t variable Will Deacon
2013-02-25 15:59 ` Catalin Marinas [this message]
2013-02-25 15:59 ` [PATCH 1/2] ARM: mm: fix race updating mm->context.id on ASID rollover Catalin Marinas
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=20130225155946.GC612@arm.com \
--to=catalin.marinas@arm.com \
--cc=linux-arm-kernel@lists.infradead.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 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.