From: Russell King - ARM Linux <linux@arm.linux.org.uk>
To: linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 1/2] ARM: PXA: PXAFB: Fix double-free issue.
Date: Thu, 17 Feb 2011 18:56:09 +0000 [thread overview]
Message-ID: <20110217185609.GB30606@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <201102171917.41442.marek.vasut@gmail.com>
On Thu, Feb 17, 2011 at 07:17:41PM +0100, Marek Vasut wrote:
> Why are you getting rid of the atomic operations ?
Because they're idiotic. Just because something is called "atomic"
doesn't make it so, and this is one instance where it's absolutely
useless.
The open and release functions are called with a mutex held. Only
_one_ thread can be inside these at any one time. So what use does
additionally doing an atomic operation within an already thread-safe
environment gain you?
> Besides, "if (ofb->usage++ = 0)" looks suspicious, especially if you later
> declare it as uint32_t.
No. You're not understanding the code. This is equivalent to:
usage = ofb->usage;
ofb->usage = usage + 1;
if (usage = 0)
And if you write it like that, then it is obvious. It's your understanding
of what a post-increment looks like which is suspicious here.
> > @@ -733,12 +739,24 @@ static int overlayfb_release(struct fb_info *info,
> > int user) {
> > struct pxafb_layer *ofb = (struct pxafb_layer*) info;
> >
>
> DTTO, why no atomic?
Because this is already a thread-safe code region.
> > ofb->video_mem = alloc_pages_exact(size, GFP_KERNEL | __GFP_ZERO);
> > @@ -891,7 +910,7 @@ static void __devinit init_pxafb_overlay(struct
> > pxafb_info *fbi,
> >
> > ofb->id = id;
> > ofb->ops = &ofb_ops[id];
>
> DTTO
An initializing store by which a machine can write the entire contents in
one instruction _is_ by its very nature atomic.
atomic_t is one of the most over(ab)used types because people just don't
think about the code they're writing. ;(
next prev parent reply other threads:[~2011-02-17 18:56 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-02 20:46 [PATCH] ARM: PXA: Make PXA27x/PXA3xx overlay actually work Vasily Khoruzhick
2011-02-13 13:31 ` Russell King - ARM Linux
2011-02-15 7:35 ` Eric Miao
2011-02-15 8:41 ` Vasily Khoruzhick
2011-02-15 11:51 ` Eric Miao
2011-02-15 11:58 ` Vasily Khoruzhick
2011-02-15 13:36 ` Eric Miao
2011-02-15 13:51 ` Vasily Khoruzhick
2011-02-15 15:12 ` Eric Miao
2011-02-15 15:18 ` Vasily Khoruzhick
2011-02-17 7:43 ` [PATCH 1/2] ARM: PXA: PXAFB: Fix double-free issue Vasily Khoruzhick
2011-02-17 7:43 ` [PATCH 2/2] ARM: PXA: PXAFB: fix plane Z-ordering problem Vasily Khoruzhick
2011-02-17 11:03 ` [PATCH 1/2] ARM: PXA: PXAFB: Fix double-free issue Russell King - ARM Linux
2011-02-17 11:06 ` Vasily Khoruzhick
2011-02-20 15:02 ` [PATCH v2 1/3] " Vasily Khoruzhick
2011-02-20 15:02 ` [PATCH v2 2/3] ARM: PXA: PXAFB: Fix plane Z-ordering problem Vasily Khoruzhick
2011-02-20 15:02 ` [PATCH v2 3/3] ARM: PXA: PXAFB: Fix typo in ypos assignment Vasily Khoruzhick
2011-02-20 18:47 ` Marek Vasut
2011-02-20 18:46 ` [PATCH v2 1/3] ARM: PXA: PXAFB: Fix double-free issue Marek Vasut
2011-02-26 16:39 ` Vasily Khoruzhick
2011-03-05 22:30 ` Vasily Khoruzhick
2011-03-11 9:20 ` [PATCH 1/4] ARM: PXA: PXAFB: rework pxafb overlay memory management Vasily Khoruzhick
2011-03-11 9:20 ` [PATCH 2/4] ARM: PXA: PXAFB: Fix plane Z-ordering problem Vasily Khoruzhick
2011-03-16 13:16 ` Eric Miao
2011-03-11 9:20 ` [PATCH 3/4] ARM: PXA: PXAFB: Fix typo in ypos assignment Vasily Khoruzhick
2011-03-11 21:35 ` Marek Vasut
2011-03-16 13:15 ` Eric Miao
2011-03-11 9:20 ` [PATCH 4/4] ARM: PXA: PXAFB: don't disable controller on cpufreq transition if overlay is in use Vasily Khoruzhick
2011-03-16 13:16 ` [PATCH 4/4] ARM: PXA: PXAFB: don't disable controller on cpufreq Eric Miao
2011-03-11 21:34 ` [PATCH 1/4] ARM: PXA: PXAFB: rework pxafb overlay memory management Marek Vasut
2011-03-11 21:46 ` Vasily Khoruzhick
2011-03-16 11:17 ` Eric Miao
2011-02-17 18:17 ` [PATCH 1/2] ARM: PXA: PXAFB: Fix double-free issue Marek Vasut
2011-02-17 18:56 ` Russell King - ARM Linux [this message]
2011-02-18 2:24 ` Eric Miao
2011-02-15 9:48 ` [PATCH] ARM: PXA: Make PXA27x/PXA3xx overlay actually work Russell King - ARM Linux
2011-02-15 11:43 ` Eric Miao
2011-02-18 10:07 ` Sascha Hauer
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=20110217185609.GB30606@n2100.arm.linux.org.uk \
--to=linux@arm.linux.org.uk \
--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 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).