From: Andrew Morton <akpm@osdl.org>
To: William Lee Irwin III <wli@holomorphy.com>
Cc: nickpiggin@yahoo.com.au, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, hugh@veritas.com, pbadari@us.ibm.com,
linux-scsi@vger.kernel.org
Subject: Re: [patch][rfc] 5/5: core remove PageReserved
Date: Thu, 23 Jun 2005 21:50:11 -0700 [thread overview]
Message-ID: <20050623215011.0b1e6ef2.akpm@osdl.org> (raw)
In-Reply-To: <20050623095153.GB3334@holomorphy.com>
William Lee Irwin III <wli@holomorphy.com> wrote:
>
> On Thu, Jun 23, 2005 at 05:08:24PM +1000, Nick Piggin wrote:
> > Index: linux-2.6/drivers/scsi/sg.c
> > ===================================================================
> > --- linux-2.6.orig/drivers/scsi/sg.c
> > +++ linux-2.6/drivers/scsi/sg.c
> > @@ -1887,9 +1887,10 @@ st_unmap_user_pages(struct scatterlist *
> > int i;
> >
> > for (i=0; i < nr_pages; i++) {
> > - if (dirtied && !PageReserved(sgl[i].page))
> > + if (dirtied)
> > SetPageDirty(sgl[i].page);
> > /* unlock_page(sgl[i].page); */
> > + /* FIXME: XXX don't dirty/unmap VM_RESERVED regions? */
> > /* FIXME: cache flush missing for rw==READ
> > * FIXME: call the correct reference counting function
> > */
>
> An answer should be devised for this. My numerous SCSI CD-ROM devices
> (I have 5 across several different machines of several different arches)
> are rather unlikely to be happy with /* FIXME: XXX ... as an answer.
>
>
> On Thu, Jun 23, 2005 at 05:08:24PM +1000, Nick Piggin wrote:
> > Index: linux-2.6/drivers/scsi/st.c
> > ===================================================================
> > --- linux-2.6.orig/drivers/scsi/st.c
> > +++ linux-2.6/drivers/scsi/st.c
> > @@ -4435,8 +4435,9 @@ static int sgl_unmap_user_pages(struct s
> > int i;
> >
> > for (i=0; i < nr_pages; i++) {
> > - if (dirtied && !PageReserved(sgl[i].page))
> > + if (dirtied)
> > SetPageDirty(sgl[i].page);
> > + /* FIXME: XXX don't dirty/unmap VM_RESERVED regions? */
> > /* FIXME: cache flush missing for rw==READ
> > * FIXME: call the correct reference counting function
> > */
>
> Mutatis mutandis for my SCSI tape drive.
This scsi code is already rather wrong. There isn't much point in just
setting PG_dirty and leaving the page marked as clean in the radix tree.
As it is we'll lose data if the user reads it into a MAP_SHARED memory
buffer.
set_page_dirty_lock() should be used here. That can sleep.
<looks>
The above two functions are called under write_lock_irqsave() (at least)
and might be called from irq context (dunno). So we cannot use
set_page_dirty_lock() and we don't have a ref on the page's inode. We
could use set_page_dirty() and be racy against page reclaim.
But to get all this correct (and it's very incorrect now) we'd need to punt
the page dirtying up to process context, along the lines of
bio_check_pages_dirty().
Or, if st_unmap_user_pages() and sgl_unmap_user_pages() are not called from
irq context then we should arrange for them to be called without locks held
and use set_page_dirty_lock().
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"aart@kvack.org"> aart@kvack.org </a>
next prev parent reply other threads:[~2005-06-24 4:50 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-06-23 7:05 [patch][rfc] 0/5: " Nick Piggin
2005-06-23 7:06 ` [patch][rfc] 1/5: comment for mm/rmap.c Nick Piggin
2005-06-23 7:06 ` [patch][rfc] 2/5: micro optimisation " Nick Piggin
2005-06-23 7:07 ` [patch][rfc] 3/5: remove atomic bitop when freeing page Nick Piggin
2005-06-23 7:07 ` [patch][rfc] 4/5: remap ZERO_PAGE mappings Nick Piggin
2005-06-23 7:08 ` [patch][rfc] 5/5: core remove PageReserved Nick Piggin
2005-06-23 9:51 ` William Lee Irwin III
2005-06-23 10:32 ` Nick Piggin
2005-06-23 22:08 ` William Lee Irwin III
2005-06-23 23:21 ` Nick Piggin
2005-06-24 0:59 ` William Lee Irwin III
2005-06-24 1:17 ` Nick Piggin
2005-06-24 1:47 ` Nick Piggin
2005-06-24 1:25 ` Nick Piggin
2005-06-24 4:50 ` Andrew Morton [this message]
2005-06-24 8:24 ` William Lee Irwin III
2005-06-26 8:41 ` Nick Piggin
2005-06-23 7:26 ` [patch][rfc] 2/5: micro optimisation for mm/rmap.c William Lee Irwin III
2005-06-23 7:33 ` Nick Piggin
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=20050623215011.0b1e6ef2.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=hugh@veritas.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-scsi@vger.kernel.org \
--cc=nickpiggin@yahoo.com.au \
--cc=pbadari@us.ibm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox