public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Nick Piggin <nickpiggin@yahoo.com.au>
To: "Michael S. Tsirkin" <mst@mellanox.co.il>
Cc: Hugh Dickins <hugh@veritas.com>,
	Gleb Natapov <gleb@minantech.com>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Petr Vandrovec <vandrove@vc.cvut.cz>,
	Badari Pulavarty <pbadari@us.ibm.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: set_page_dirty vs set_page_dirty_lock
Date: Mon, 12 Dec 2005 20:23:10 +1100	[thread overview]
Message-ID: <439D417E.903@yahoo.com.au> (raw)
In-Reply-To: <20051212085532.GW14936@mellanox.co.il>

Michael S. Tsirkin wrote:

> 
> FWIW, I think that copy_to_user will work correctly since it keeps the mmap
> semaphore for the duration of the copy.

Oh, true.

> Direct-io might have the same problem.
> 
> 
>>As such, I don't think it would be something you in particular need to
>>worry about.
>>
>>I guess to solve it, we could either retain mmap_sem for the duration to
>>prevent fork,
> 
> 
> Since this is the receive side, the DMA can take an indefinite
> time to arrive. Isnt this a problem if we keep the mmap_sem?
> 

Well... it goes against our usual stance of trying to push
these kinds of synchronisation issues to userspace.

In a way, you're doing direct-io from the network and so it is
perhaps reasonable to expect the racy semantics that O_DIRECT
has. OTOH, if you are providing the same API on a different
device, then basically by definition you need to provide the
exact same semantics.

> 
>>or try to do something tricky with page_count to determine
>>if we need to do a copy in fork() rather than a COW.
> 
> 
> I'm actually reasonably happy with the trick that I'm using:
> performing a second get_user_pages after DMA and comparing
> the page lists.
> However, doing this every time on the off chance that a
> page was made COW forces me into task context, every time.
> 

I think it might be possible to solve it with the early-copy in
fork(). I'll tinker with it.

-- 
SUSE Labs, Novell Inc.

Send instant messages to your online friends http://au.messenger.yahoo.com 

  reply	other threads:[~2005-12-12  9:23 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-08 19:09 set_page_dirty vs set_page_dirty_lock Michael S. Tsirkin
2005-12-08 19:19 ` Hugh Dickins
2005-12-08 19:29   ` Michael S. Tsirkin
2005-12-08 19:54   ` Jens Axboe
2005-12-08 21:56   ` Michael S. Tsirkin
2005-12-12  3:28     ` Nick Piggin
2005-12-12  6:35       ` Michael S. Tsirkin
2005-12-12  7:10         ` Nick Piggin
2005-12-12  8:14           ` Michael S. Tsirkin
2005-12-12  8:32             ` Nick Piggin
2005-12-12  8:55               ` Michael S. Tsirkin
2005-12-12  9:23                 ` Nick Piggin [this message]
2005-12-12  9:59                   ` Michael S. Tsirkin
2005-12-13 21:07                   ` Michael S. Tsirkin

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=439D417E.903@yahoo.com.au \
    --to=nickpiggin@yahoo.com.au \
    --cc=benh@kernel.crashing.org \
    --cc=gleb@minantech.com \
    --cc=hugh@veritas.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@mellanox.co.il \
    --cc=pbadari@us.ibm.com \
    --cc=vandrove@vc.cvut.cz \
    /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