[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20171218131842.h72dvlc42dgv4fdu@hirez.programming.kicks-ass.net>
Date: Mon, 18 Dec 2017 14:18:42 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Thomas Gleixner <tglx@...utronix.de>
Cc: LKML <linux-kernel@...r.kernel.org>, x86@...nel.org,
Linus Torvalds <torvalds@...ux-foundation.org>,
Andy Lutomirsky <luto@...nel.org>,
Dave Hansen <dave.hansen@...el.com>,
Borislav Petkov <bpetkov@...e.de>,
Greg KH <gregkh@...uxfoundation.org>, keescook@...gle.com,
hughd@...gle.com, Brian Gerst <brgerst@...il.com>,
Josh Poimboeuf <jpoimboe@...hat.com>,
Denys Vlasenko <dvlasenk@...hat.com>,
Rik van Riel <riel@...hat.com>,
Boris Ostrovsky <boris.ostrovsky@...cle.com>,
Juergen Gross <jgross@...e.com>,
David Laight <David.Laight@...lab.com>,
Eduardo Valentin <eduval@...zon.com>, aliguori@...zon.com,
Will Deacon <will.deacon@....com>, daniel.gruss@...k.tugraz.at,
Dave Hansen <dave.hansen@...ux.intel.com>,
Ingo Molnar <mingo@...nel.org>, Borislav Petkov <bp@...en8.de>,
"H. Peter Anvin" <hpa@...or.com>
Subject: Re: [patch V163 37/51] x86/events/intel/ds: Map debug buffers in
fixmap
On Mon, Dec 18, 2017 at 12:42:52PM +0100, Thomas Gleixner wrote:
> +static u64 ds_update_fixmap(int idx, void *addr, size_t size, pgprot_t prot)
> {
> + phys_addr_t pa, va;
> + size_t msz = 0;
> +
> + va = __fix_to_virt(idx);
> + pa = virt_to_phys(addr);
> + for (; msz < size; idx--, msz += PAGE_SIZE, pa += PAGE_SIZE)
> + __set_fixmap(idx, pa, prot);
> + return va;
> +}
> +
> +static void *dsalloc_pages(size_t size, gfp_t flags, int cpu)
> +{
> + unsigned int order = get_order(size);
> int node = cpu_to_node(cpu);
> + struct page *page;
> +
> + page = __alloc_pages_node(node, flags | __GFP_ZERO, order);
> + return page ? page_address(page) : NULL;
> +}
> +
> +static void dsfree_pages(const void *buffer, size_t size)
> +{
> + if (buffer)
> + free_pages((unsigned long)buffer, get_order(size));
> +}
Note to self: since we're now using a virtual mapping for this stuff, we
can avoid the high order page allocs.
Powered by blists - more mailing lists