From owner-freebsd-hackers@freebsd.org Tue Oct 13 00:42:31 2015 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BC7509D1DE6 for ; Tue, 13 Oct 2015 00:42:31 +0000 (UTC) (envelope-from gsuryacse7k@gmail.com) Received: from mail-vk0-x230.google.com (mail-vk0-x230.google.com [IPv6:2607:f8b0:400c:c05::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7688EEB; Tue, 13 Oct 2015 00:42:31 +0000 (UTC) (envelope-from gsuryacse7k@gmail.com) Received: by vkaw128 with SMTP id w128so1342268vka.0; Mon, 12 Oct 2015 17:42:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=6ea77exxnU0jLx5qd7wD08kusZoh4V8yr8QvqxfW+DE=; b=ujXGk0+vTu8zrhL4GLfS03xwA0gyPb9lxZp0Dqcg14OS2ilP3LHyQpdMIoMYSvI00u CODMH22ceKz6VoAyg1ARoPq1DeaVPoMKjE1mL7Emn3NHjSqdOWQ1N6V1V8ZKG1P0+G17 ZtmvIGKLIb0U7VJRCHtlQ2rIa3rMWloSdDMb1TmSHWh+J+O8azcXhHESTaDJvgQvmC4W ax1An3FYLsi60FtAenKK8C4m/CCmdgDbuVUV8iA3FlsUHEXvx1fQth+3viPhQS+xbmdZ 01Sn52QEIB94pGMnIbHQ2J/zwnYTG3C8K/SvbF01jkXcvBxH9LVxsNwwYfiNOdMK3V/S 3QPA== MIME-Version: 1.0 X-Received: by 10.31.60.145 with SMTP id j139mr20237991vka.89.1444696950513; Mon, 12 Oct 2015 17:42:30 -0700 (PDT) Received: by 10.103.26.3 with HTTP; Mon, 12 Oct 2015 17:42:30 -0700 (PDT) In-Reply-To: <561C4A26.4000408@rice.edu> References: <561C4A26.4000408@rice.edu> Date: Mon, 12 Oct 2015 20:42:30 -0400 Message-ID: Subject: Re: kernel pages superpage promotion/demotion From: suresh gumpula To: Alan Cox Cc: alc@freebsd.org, "freebsd-hackers@freebsd.org" X-Mailman-Approved-At: Tue, 13 Oct 2015 01:04:58 +0000 Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.20 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Oct 2015 00:42:31 -0000 Thanks so much for the quick reply and inputs Alan. Thanks Suresh On Mon, Oct 12, 2015 at 8:02 PM, Alan Cox wrote: > On 10/12/2015 18:39, suresh gumpula wrote: > > Thanks a lot for quick reply Alan. > The super page promotion/demotion of kernel allocations is done in 9.1 > also I assume . Please confirm. > > > Yes. > > Regarding write protection, I am trying to chase a corruption of uma zone > allocation, so I was looking at pmap_protect(9). > And thinking of using something like pmap_protect(kernel_pmap, sva , eva, > VMPROT_READ); to write protect sva to eva of a zone allocation return > address. > So can pmap_protect(9) be used for this purpose ? > > > Yes. However, you can't reenable write access, or in general upgrade > access, with pmap_protect(). You'll need to use pmap_kextract(), > PHYS_TO_VM_PAGE(), and pmap_enter() to recreate the mapping with write > access. > > > > > On Mon, Oct 12, 2015 at 6:43 PM, Alan Cox wrote: > >> >> >> On Mon, Oct 12, 2015 at 3:11 PM, suresh gumpula < >> gsuryacse7k@gmail.com> wrote: >> >>> Hi, >>> I understand that user space VM map pages dynamically >>> promoted/demoted to super page >>> if the kernel thinks that it gains the performance. >>> The question is , does this apply to kernel map pages too ? >>> >>> >> >> Yes, it applies to memory allocated for UMA zones, malloc(9), and >> contigmalloc(9). >> >> >> >>> And is it possible to write protect kernel address space VA with >>> pmap_protect(9). Since the protection is per 4k page, I see this >>> routine tries to demote to 4k page. >>> Or this is only for user space maps to support mprotect(2) and gdb >>> watchpoints. >>> Do we have any other API to write protect kernel addresses which come >>> from >>> UMA zone allocations ? >>> >>> >> >> No. >> >> Can you please try to describe what are you trying to do at a higher >> level? >> > > >