From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DAFB6C56202 for ; Mon, 23 Nov 2020 09:01:06 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 78BF620731 for ; Mon, 23 Nov 2020 09:01:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="N/3WgXho" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 78BF620731 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id A234F6B0071; Mon, 23 Nov 2020 04:01:04 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 9D4BA6B0072; Mon, 23 Nov 2020 04:01:04 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8E9C66B0073; Mon, 23 Nov 2020 04:01:04 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0121.hostedemail.com [216.40.44.121]) by kanga.kvack.org (Postfix) with ESMTP id 607A66B0071 for ; Mon, 23 Nov 2020 04:01:04 -0500 (EST) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id E60D52484 for ; Mon, 23 Nov 2020 09:01:03 +0000 (UTC) X-FDA: 77515088406.25.whip10_1a1464427364 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin25.hostedemail.com (Postfix) with ESMTP id C28271804E3A9 for ; Mon, 23 Nov 2020 09:01:03 +0000 (UTC) X-HE-Tag: whip10_1a1464427364 X-Filterd-Recvd-Size: 3173 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf44.hostedemail.com (Postfix) with ESMTP for ; Mon, 23 Nov 2020 09:01:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=flYiZOk1DDOO3edQvf6Tz2+/+AB101STTfYO1lfvvJ8=; b=N/3WgXhoIf3l9jopQDWfhTq6NU C/ZOAgGe/B4ARIcIcrVx8uQBhyS06iJkU9B3vaUTvKcXd3FqgM81DY/5Qf0yGeJsCBXaKC15BodUR zqqZ4TdqPAZcbVC0++BJmUB6050njxfsfd8mJUe30ymCfPgR3wb0YK46pfpjY0Mb4rAVkEgCxSWDY jXHBOuJZ2tNQ5t9DbEudZ6UFHjaKKawfkSYTkD7sV6PW/qQruEHlAdAkfJBWEVz+fTKQhJBABwSh/ JRAq0qRv1OjED/a1D+8Y0TUsaP+8HzkeP9nqnmmPWztjcfHEV6f7W+qJg3Kz2WimkJvFOhNG73B2y Ypx0g3lw==; Received: from hch by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1kh7iC-0002pP-JH; Mon, 23 Nov 2020 09:00:40 +0000 Date: Mon, 23 Nov 2020 09:00:40 +0000 From: Christoph Hellwig To: Rick Edgecombe Cc: akpm@linux-foundation.org, jeyu@kernel.org, bpf@vger.kernel.org, ast@kernel.org, daniel@iogearbox.net, luto@kernel.org, dave.hansen@linux.intel.com, peterz@infradead.org, x86@kernel.org, rppt@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, dan.j.williams@intel.com, elena.reshetova@intel.com, ira.weiny@intel.com Subject: Re: [PATCH RFC 01/10] vmalloc: Add basic perm alloc implementation Message-ID: <20201123090040.GA6334@infradead.org> References: <20201120202426.18009-1-rick.p.edgecombe@intel.com> <20201120202426.18009-2-rick.p.edgecombe@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201120202426.18009-2-rick.p.edgecombe@intel.com> X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: First thanks for doing this, having a vmalloc variant that starts out with proper permissions has been on my todo list for a while. > +#define PERM_R 1 > +#define PERM_W 2 > +#define PERM_X 4 > +#define PERM_RWX (PERM_R | PERM_W | PERM_X) > +#define PERM_RW (PERM_R | PERM_W) > +#define PERM_RX (PERM_R | PERM_X) Why can't this use the normal pgprot flags? > +typedef u8 virtual_perm; This would need __bitwise annotations to allow sparse to typecheck the flags. > +/* > + * Allocate a special permission kva region. The region may not be mapped > + * until a call to perm_writable_finish(). A writable region will be mapped > + * immediately at the address returned by perm_writable_addr(). The allocation > + * will be made between the start and end virtual addresses. > + */ > +struct perm_allocation *perm_alloc(unsigned long vstart, unsigned long vend, unsigned long page_cnt, > + virtual_perm perms); Please avoid totally pointless overly long line (all over the series) Also I find the unsigned long for kernel virtual address interface strange, but I'll take a look at the callers later.