From owner-freebsd-hackers@FreeBSD.ORG Thu Sep 10 06:57:25 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BA420106568B for ; Thu, 10 Sep 2009 06:57:25 +0000 (UTC) (envelope-from guomingyan@gmail.com) Received: from mail-ew0-f208.google.com (mail-ew0-f208.google.com [209.85.219.208]) by mx1.freebsd.org (Postfix) with ESMTP id 4735F8FC0A for ; Thu, 10 Sep 2009 06:57:25 +0000 (UTC) Received: by ewy4 with SMTP id 4so47106ewy.36 for ; Wed, 09 Sep 2009 23:57:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=Db1QftQ0KNHlMqva0vqufJQ8othqJc8dYGIiu2VPh8E=; b=VxbpdtfzHib8DGridxuqW2L/r0KecgGW5iolzuDcQ/eNaPxVJB8CvSXoJKIWphKK77 RoBuVpVR2JyqeQPyfZEolvQxQ1RclYYsQg4kX793DlrBRctPYFyBrVch4NWGFjLtKVIu awV+IuBkxaMMscHnzrGn+FtdNNHJnkUhGv3BU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=ssmvhIECriRTZQTmIJ2aXm4f/tOJM8sG6NN1DrTXSqqox9NRspj5yb+o+yi0zWd32j WCLQl7pl6Dy7vJmPnlBIY6TusOoP1b23TdhSNu35EewgRxA5/2siAGfOlDqee0fxe5uL GaKiH2p9fY77luVelIfWDw0iEHDoPDWwd7LxM= MIME-Version: 1.0 Received: by 10.211.172.8 with SMTP id z8mr1256202ebo.92.1252565844410; Wed, 09 Sep 2009 23:57:24 -0700 (PDT) In-Reply-To: <1fa17f810909092326l1271df94t1dea5ac9d5deba1b@mail.gmail.com> References: <1fa17f810909092326l1271df94t1dea5ac9d5deba1b@mail.gmail.com> Date: Wed, 9 Sep 2009 23:57:24 -0700 Message-ID: <1fa17f810909092357x8625182q970f8fb6aa76e7a9@mail.gmail.com> From: MingyanGuo To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: LI Xin Subject: Re: How to prevent other CPU from accessing a set of pages before calling pmap_remove_all function X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Sep 2009 06:57:25 -0000 On Wed, Sep 9, 2009 at 11:26 PM, MingyanGuo wrote: > Hi all, > > I find that function pmap_remove_all for arch amd64 works with a time > window between reading & clearing the PTE flags(access flag and dirty flag) > and invalidating its TLB entry on other CPU. After some discussion with Li > Xin(cced), I think all the processes that are using the PTE being removed > should be blocked before calling pmap_remove_all, or other CPU may dirty the > page but does not set the dirty flag before the TLB entry is flushed. But I > can not find how to block them to call the function. I read the function > vm_pageout_scan in file vm/vm_pageout.c but can not find the exact method it > used. Or I just misunderstood the semantics of function pmap_remove_all ? > > Thanks in advance. > > Regards, > MingyanGuo > Sorry for the noise. I understand the logic now. There is no time window problem between reading & clearing the PTE and invalidating it on other CPU, even if other CPU is using the PTE. I misunderstood the logic. Regards, MingyanGuo