From owner-freebsd-hackers@freebsd.org Mon Feb 27 15:26:17 2017 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 B6F51CF0711 for ; Mon, 27 Feb 2017 15:26:17 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from mx1.scaleengine.net (mx1.scaleengine.net [209.51.186.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7E9D3F44; Mon, 27 Feb 2017 15:26:17 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from [10.145.2.129] (unknown [209.171.88.129]) (Authenticated sender: allanjude.freebsd@scaleengine.com) by mx1.scaleengine.net (Postfix) with ESMTPSA id B6D1C13517; Mon, 27 Feb 2017 15:26:14 +0000 (UTC) Date: Mon, 27 Feb 2017 07:26:09 -0800 User-Agent: K-9 Mail for Android In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [GSoC 2017] Original proposal: Port kernel Lua to FreeBSD To: freebsd-hackers@freebsd.org, Saurav Sachidanand , soc-admins@freebsd.org From: Allan Jude Message-ID: <244231A2-EB18-4E58-A2B2-927F55D54950@FreeBSD.org> X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Feb 2017 15:26:17 -0000 On February 27, 2017 5:28:41 AM PST, Saurav Sachidanand wrote: >Hello FreeBSD community, > >I'm >=E2=80=8B Saurav Sachidanand, and I'm=E2=80=8B > a CS sophomore studying in India >=E2=80=8B=2E >I have an interest in operating systems development and wish to >contribute >to the FreeBSD community=2E I'm proficient with C and have some >experience in >kernel programming=2E Hence, I'd like to propose an original project for >GSoC >2017 that I feel would benefit this community=2E > >In past years, the Lua interpreter was ported to run inside the Linux >and >NetBSD kernel [1]=2E Lua was chosen because it's interpreter is very >small (~240 >KB) compared to that of Python or Ruby, it's MIT licensed, and is >almost >freestanding=2E A working demonstration of it is a packet filtering >algorithm >written entirely in kernel Lua [2]=2E > >Specifically, my proposal would be to port the following that are >currently >written for NetBSD: >- the modified Lua VM source code with _KERNEL preprocessor directives >to >exclude user-space functionality like floating point, the io and os >module >in the standard library, etc=2E [3] >- the kernel module device driver for /dev/lua, to which Lua scripts >are >fed to be executed [4], [5] >- the luactl user-space program to control the Lua device and a couple >of >sysctl variables which serve similar purpose [6], [7] > >And then: >- run the Lua test suite targeting whatever we support in the kernel to >make sure it works [8] >- and write Lua bindings to the kernel interfaces that would interest >the >FreeBSD community > >Since NetBSD and FreeBSD have similar kernel interfaces (mutexes, >linked >lists, device switch interface), the porting shouldn't involve too much >code refactoring=2E Also, this would all be an experiment in that we >don't >fully know what the real world use cases might be, but it would attract >more people to writing kernel code who otherwise wouldn't because of >having >to do everything in C=2E And it would be interesting to carry out it out >in >FreeBSD as well since it has a larger community than NetBSD=2E > >I humbly request anyone who is interested in this project to be my >potential mentor(s) for GSoC=2E > >More slides on kernel Lua in NetBSD - [9], [10]=2E > >Thanks, >Saurav > >[1] - http://www=2Enetbsd=2Eorg/~lneto/dls14=2Epdf >[2] - https://www=2Enetbsd=2Eorg/~lneto/eurobsdcon14=2Epdf >[3] - https://github=2Ecom/jsonn/src/tree/trunk/external/mit/lua/dist/src >[4] - >https://github=2Ecom/IIJ-NetBSD/netbsd-src/tree/master/sys/modules/lua >[5] - >https://github=2Ecom/IIJ-NetBSD/netbsd-src/tree/master/sys/modules/luasys= tm >[6] - https://github=2Ecom/IIJ-NetBSD/netbsd-src/tree/master/sbin/luactl >[7] - http://netbsd=2Egw=2Ecom/cgi-bin/man-cgi?lua+4+NetBSD-current >[8] - http://www=2Elua=2Eorg/tests/ >[9] - >https://www=2Enetbsd=2Eorg/gallery/presentations/mbalmer/fosdem2012/kerne= l_mode_lua=2Epdf >[10] - https://www=2Elua=2Eorg/wshop13/Cormack=2Epdf >_______________________________________________ >freebsd-hackers@freebsd=2Eorg mailing list >https://lists=2Efreebsd=2Eorg/mailman/listinfo/freebsd-hackers >To unsubscribe, send any mail to >"freebsd-hackers-unsubscribe@freebsd=2Eorg" This may be quite a nice thing to have=2E Another upcoming use for LUA in = the kernel is ZFS Channel Programs=2E These allow a number of ZFS operation= s to be completed as a single atomic transaction=2E I would hope we could structure this in such a way as to not end up with t= wo copies of Lua in the kernel=2E --=20 Allan Jude