From: Jeff Garzik <jgarzik@pobox.com>
To: Marcelo Tosatti <marcelo.tosatti@cyclades.com>
Cc: Linux Kernel <linux-kernel@vger.kernel.org>,
Bartlomiej Zolnierkiewicz <B.Zolnierkiewicz@elka.pw.edu.pl>,
Douglas Gilbert <dougg@torque.net>, Jens Axboe <axboe@suse.de>,
William Lee Irwin III <wli@holomorphy.com>
Subject: Re: [PATCH 2.4] the perils of kunmap_atomic
Date: Thu, 28 Oct 2004 00:18:01 -0400 [thread overview]
Message-ID: <418072F9.2020004@pobox.com> (raw)
In-Reply-To: <20041027161936.GC1081@logos.cnet>
Marcelo Tosatti wrote:
> On Tue, Oct 26, 2004 at 07:31:24PM -0400, Jeff Garzik wrote:
>
>>kunmap_atomic() violates the Principle of Least Surprise in a nasty way.
>> kmap(), kunmap(), and kmap_atomic() all take struct page* to
>>reference the memory location. kunmap_atomic() is the oddball of the
>>three, and takes a kernel address.
>>
>>Ignoring the driver-related bugs that are present due to
>>kunmap_atomic()'s weirdness, there also appears to be a big in the
>>!CONFIG_HIGHMEM implementation in 2.4.x.
>>
>>(Bart is poking through some of the 2.6.x-related kunmap_atomic slip-ups)
>>
>>Anyway, what do people think about the attached patch to 2.4.x? I'm
>>surprised it has gone unnoticed until now.
>>
>> Jeff
>>
>>===== include/linux/highmem.h 1.12 vs edited =====
>>--- 1.12/include/linux/highmem.h 2003-06-30 20:18:42 -04:00
>>+++ edited/include/linux/highmem.h 2004-10-26 19:26:14 -04:00
>>@@ -70,7 +70,7 @@
>> #define kunmap(page) do { } while (0)
>>
>> #define kmap_atomic(page,idx) kmap(page)
>>-#define kunmap_atomic(page,idx) kunmap(page)
>>+#define kunmap_atomic(addr,idx) kunmap(virt_to_page(addr))
>>
>> #define bh_kmap(bh) ((bh)->b_data)
>> #define bh_kunmap(bh) do { } while (0)
>
>
> Ugh :(
Actually, a private email to me pointed out the obvious... kmap/kunmap
are no-ops on !CONFIG_HIGHMEM, so it's really a cosmetic bug, and my
patch won't fix anything but human confusion :)
> An audit of kunmap_atomic() users is needed.
agreed
Jeff
prev parent reply other threads:[~2004-10-28 4:18 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-26 23:31 [PATCH 2.4] the perils of kunmap_atomic Jeff Garzik
2004-10-26 23:36 ` Nigel Cunningham
2004-10-28 4:20 ` Jeff Garzik
2004-10-26 23:42 ` Nigel Cunningham
2004-10-27 0:07 ` William Lee Irwin III
2004-10-27 16:19 ` Marcelo Tosatti
2004-10-28 4:18 ` Jeff Garzik [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=418072F9.2020004@pobox.com \
--to=jgarzik@pobox.com \
--cc=B.Zolnierkiewicz@elka.pw.edu.pl \
--cc=axboe@suse.de \
--cc=dougg@torque.net \
--cc=linux-kernel@vger.kernel.org \
--cc=marcelo.tosatti@cyclades.com \
--cc=wli@holomorphy.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 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.