From owner-freebsd-current@freebsd.org Fri Jan 31 22:47:12 2020 Return-Path: Delivered-To: freebsd-current@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 14B921EF5D2 for ; Fri, 31 Jan 2020 22:47:12 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from CAN01-TO1-obe.outbound.protection.outlook.com (mail-eopbgr670082.outbound.protection.outlook.com [40.107.67.82]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.protection.outlook.com", Issuer "GlobalSign Organization Validation CA - SHA256 - G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 488XR30dsYz4KpG for ; Fri, 31 Jan 2020 22:47:10 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gXb6WDOJDWIg/L1k2nKpu8fwOO6G4tDdkWrz01slz4Wo84oMcZeU3zvgqJCadiQK2Xogc5iLa0osMv+qmmcBFFsQcMb4W+q16uxvHoPpnfvUJk03eBQ6pElnYAycvP0ggkwVVhUjZW2P8li94n8hPSONINQV/GxcxA4tZcvfTogM1sF0oQuF0/2aUIHZrNg5nrEHIKsMPAl48zJlDMLFVfE13wGed4KieAOQJIuMx0o6+9rEhgRVfTr4Xp2Egrpce2RfS76vRMNJkFtLkKPjpm65wpZ/KaKMnRVz5tJA2+cChACxiRK/oMe5pyArXZEUWFXoV/ukXnJAWrectXhnZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8sHHcegAjqjXwSg0HtKXj/pasUpF9nW7ekDoJKrMRaM=; b=eFZYt+vClxwQdSXmFyrdw9YN6/air9KtN7uVeDJhL0GzxuuTs4lnio2QbgRECEQJp10qjcn6tArhHJLwl/TBTR4b0xG6nxIwhNl0n2rjnzYhh8998mymL/imwtmUPlnoKoQDc750+uPKOApEpRZPhyPUDZp92Ua3/dWq+0vhHTedRNITfy1z7yvCJp4Da/EWNGiIPjfOfMTpBGTgCtzJKKUmVIqc5iFm8BTa8LieXNoeNXBQsvnkdqGj0766ub6saCvFuQa3+uwz4g52QY1IVG8zSbBgJkBVXoolxkBW48CL+u/Od/4gyJWQF3AONxIyMTOjS5Ytei2FUP7nIZB09A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=uoguelph.ca; dmarc=pass action=none header.from=uoguelph.ca; dkim=pass header.d=uoguelph.ca; arc=none Received: from YTBPR01MB3374.CANPRD01.PROD.OUTLOOK.COM (10.255.46.82) by YTBPR01MB3503.CANPRD01.PROD.OUTLOOK.COM (10.255.12.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2686.28; Fri, 31 Jan 2020 22:47:09 +0000 Received: from YTBPR01MB3374.CANPRD01.PROD.OUTLOOK.COM ([fe80::410e:652b:6fbc:9aa4]) by YTBPR01MB3374.CANPRD01.PROD.OUTLOOK.COM ([fe80::410e:652b:6fbc:9aa4%3]) with mapi id 15.20.2686.028; Fri, 31 Jan 2020 22:47:09 +0000 From: Rick Macklem To: Konstantin Belousov , Hans Petter Selasky CC: "freebsd-current@FreeBSD.org" Subject: Re: easy way to work around a lack of a direct map on i386 Thread-Topic: easy way to work around a lack of a direct map on i386 Thread-Index: AQHV18KXJBNJQhyzKEGjuJj0X3dTjKgD3PkAgAChCwCAADdBAIAAq2nW Date: Fri, 31 Jan 2020 22:47:09 +0000 Message-ID: References: <20200130233734.GV4808@kib.kiev.ua> , <20200131123144.GW4808@kib.kiev.ua> In-Reply-To: <20200131123144.GW4808@kib.kiev.ua> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: f39e91f2-0c24-48d8-c9d4-08d7a69f8153 x-ms-traffictypediagnostic: YTBPR01MB3503: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-forefront-prvs: 029976C540 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(136003)(366004)(346002)(376002)(39860400002)(199004)(189003)(4326008)(33656002)(91956017)(9686003)(55016002)(66476007)(66946007)(76116006)(26005)(2906002)(64756008)(66446008)(66556008)(8936002)(71200400001)(86362001)(186003)(81156014)(8676002)(81166006)(966005)(52536014)(5660300002)(6506007)(53546011)(110136005)(786003)(7696005)(316002)(478600001)(43043002); DIR:OUT; SFP:1101; SCL:1; SRVR:YTBPR01MB3503; H:YTBPR01MB3374.CANPRD01.PROD.OUTLOOK.COM; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: uoguelph.ca does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: cMmmLEEdqZIWB1xDsI8trP3VAuqOVg/lxzCTqCP5re9s9eiYkeyPthmhh69U30d7WtsRkk8NVLARb2LK/LRKJuuOOgiR9bugSpR3bJCUNyKo1J9cz9f+qGVdwQMRC82+QjGDlhWR3EuIU28Ks/OQytJQBkx/BhRVodGilttI08ZhzpS4TKN/n8pw1ss5G99g2JodTD2nj77nAgkM3VMUDABexeH0hNl1Nd01a+X439GudRVQWweLSpQ5UFow3dwBqzJLYpKmdqxqYnBlJ58eJPbNpTlEoCNbtTChKYBU3D+oT0MxCTJtHzTGwBJc7ZbIPnfVldL+K5WXClnF9tTqTSdkgVETPECirWd9/a4DLB5XtnWGiAz3JKKfKOCvT+2Y8WrAxKxWFiiKJMCgTsf5dQ8EYhrDLK4W69nmokXh18T/qPq7wadNaegkgziINoakapm/wnKcomgpiKNFPvhcwnybCpZOtrVAbZ+K+vssWGxORgKJwNt6a2qAKWKcJ9LpmzW2H/q5XCa8ooNiXqp0RZkjySuKEOUpSoGjK9w9KydjSKLBdcInAGkzHGv0joAL x-ms-exchange-antispam-messagedata: 6UQNjwenYU6FIpxFJ6p+feyRmyZmyJmee7vOhqobaRNLdnfwGt2HCEHW2AbfAUoPOJrSUZ2mXlY4unurPp5+8Z+eVferpX2cFWqW/luDpDvZdoXVYDgIergvzk47HUTYinX09k/y/XNK9kxe8nHcvg== x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: uoguelph.ca X-MS-Exchange-CrossTenant-Network-Message-Id: f39e91f2-0c24-48d8-c9d4-08d7a69f8153 X-MS-Exchange-CrossTenant-originalarrivaltime: 31 Jan 2020 22:47:09.5587 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: be62a12b-2cad-49a1-a5fa-85f4f3156a7d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: thrmAmesrsLLgd9VgcpVdOVXl0XHGV4tycV7ei3ZBrAYjF5yNshTykZJaekPXZBnuHeCt8i0ojhpVK6WMCejFg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: YTBPR01MB3503 X-Rspamd-Queue-Id: 488XR30dsYz4KpG X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of rmacklem@uoguelph.ca designates 40.107.67.82 as permitted sender) smtp.mailfrom=rmacklem@uoguelph.ca X-Spamd-Result: default: False [-4.69 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; R_SPF_ALLOW(-0.20)[+ip4:40.107.0.0/16]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[]; DMARC_NA(0.00)[uoguelph.ca]; TO_DN_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[82.67.107.40.list.dnswl.org : 127.0.3.0]; IP_SCORE(-1.39)[ipnet: 40.64.0.0/10(-3.86), asn: 8075(-3.06), country: US(-0.05)]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:8075, ipnet:40.64.0.0/10, country:US]; ARC_ALLOW(-1.00)[i=1] X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jan 2020 22:47:12 -0000 Thanks everyone. I should have waited a day, since jhb@ responded w.r.t. using sf_bufs as well. For now, we are sticking with a 64bit only solution, since work on the receive side of KERN_TLS is more critical to getting this going. rick ________________________________________ From: owner-freebsd-current@freebsd.org = on behalf of Konstantin Belousov Sent: Friday, January 31, 2020 7:31 AM To: Hans Petter Selasky Cc: Rick Macklem; freebsd-current@FreeBSD.org Subject: Re: easy way to work around a lack of a direct map on i386 On Fri, Jan 31, 2020 at 10:13:58AM +0100, Hans Petter Selasky wrote: > On 2020-01-31 00:37, Konstantin Belousov wrote: > > On Thu, Jan 30, 2020 at 11:23:02PM +0000, Rick Macklem wrote: > > > Hi, > > > > > > The current code for KERN_TLS uses PHYS_TO_DMAP() > > > to access unmapped external pages on m_ext.ext_pgs > > > mbufs. > > > I also need to do this to implement RPC-over-TLS. > > > > > > The problem is that some arches, like i386, don't > > > support PHYS_TO_DMAP(). > > > > > > Since it appears that there will be at most 4 pages on > > > one of these mbufs, my thinking was... > > > - Acquire four pages of kva from the kernel_map during > > > booting. > > > - Then just use pmap_qenter() to fill in the physical page > > > mappings for long enough to copy the data. > > > > > > Does this sound reasonable? > > > Is there a better way? > > > > Use sfbufs, they should work on all arches. In essence, they provide M= I > > interface to DMAP where possible. I do not remember did I bumped the > > limit for i386 after 4/4 went in. > > > > There is currently no limits for sfbufs use per subsystem, but I think = it > > is not very likely to cause too much troubles. Main rule is to not sle= ep > > waiting for more sfbufs if you already own one.. > > In the DRM-KMS LinuxKPI we have: > > void * > kmap(vm_page_t page) > { > #ifdef LINUXKPI_HAVE_DMAP > vm_offset_t daddr; > > daddr =3D PHYS_TO_DMAP(VM_PAGE_TO_PHYS(page)); > > return ((void *)daddr); > #else > struct sf_buf *sf; > > sched_pin(); > sf =3D sf_buf_alloc(page, SFB_NOWAIT | SFB_CPUPRIVATE); > if (sf =3D=3D NULL) { > sched_unpin(); > return (NULL); > } > return ((void *)sf_buf_kva(sf)); > #endif > } > > void > kunmap(vm_page_t page) > { > #ifdef LINUXKPI_HAVE_DMAP > /* NOP */ > #else > struct sf_buf *sf; > > /* lookup SF buffer in list */ > sf =3D sf_buf_alloc(page, SFB_NOWAIT | SFB_CPUPRIVATE); > > /* double-free */ > sf_buf_free(sf); > sf_buf_free(sf); > > sched_unpin(); > #endif > } > > I think that is the fastest way to do this. So the kmap address is only valid on the CPU that called the function ? This is strange, I was not able to find mention of it in references to kmap. _______________________________________________ freebsd-current@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"