lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <6278d2220705160609x5c8462b6i25935a449352bf12@mail.gmail.com>
Date:	Wed, 16 May 2007 14:09:59 +0100
From:	"Daniel J Blueman" <daniel.blueman@...il.com>
To:	"Zoltan Menyhart" <Zoltan.Menyhart@...l.net>
Cc:	"Linux Kernel" <linux-kernel@...r.kernel.org>
Subject: Re: copy_one_pte()

On 03/04/07, Zoltan Menyhart <Zoltan.Menyhart@...l.net> wrote:
> Daniel J Blueman wrote:
> > On 13 Mar, 20:20, Zoltan Menyhart <Zoltan.Menyh...@...e.fr> wrote:
> >
> >> I had a look at copy_one_pte().
> >> I cannot see any ioproc_update_page() call, not even for the COW pages.
> >> Is it intentional?
> >
> > There could be an ioproc_update_range() call in
> > memory.c:copy_pte_range(), after the pte_unmap_unlock(), and this
> > would be an optimisation, since explicitly updating the mappings in
> > the Quadrics RDMA NIC avoids the need for the NIC to trap and update
> > it's MMU later.
>
> I can agree that this optimization is a good idea.
>
> Can you please confirm that cp->update_range() understands the concept of
> the COW? (I.e. the card should not write anything into the COW pages.)
>
> > The code which implements [1] this takes the pagetable locks with
> > pte_offset_map_lock(), and uses one of the kmap_atomic slots, so has
> > to be after the pagetables are unlocked. The
> > ioproc_invalidate_page/range() calls are different and can't live with
> > this race, so have to be used with the pagetable locks held.
>
> I can see two issues here:
>
> - Performance problem: page_table_lock is more expensive than a split lock,
>   and taking page_table_lock after the split lock released is even worse.

I have introduced an ioproc_update_page_locked() call for this and
related paths, and updated the kernel patches; this avoids a race
condition I was seeing in multi-threaded processes taking concurrent
page faults under the split locks. The split lock is now acquired
once, and the changes allowed me to do other some optimisations on
this path too.

> - Synchronization problem: do_wp_page() is protected by the appropriate
>   split lock, i.e. the COW page can be broken up while you are inside
>   cp->update_range() under the protection of page_table_lock.

The split locks were used previously via pte_offset_map_lock(), so
this race wasn't possible previously.

> I think the PTE modification and the cp->update_xxx() should be protected
> by the very same lock, without releasing it between the two operations.
> I think the PTE modification and the cp->update_xxx() should be an
> atomic operation with respect to the VMM activity.

This does make most sense and is now the case, although atomiticity
wasn't a problem, since it's fine to use ioproc_update_page/range()
speculatively.

Dan

> Thanks,
>
> Zoltan
-- 
Daniel J Blueman
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ