Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 27 Feb 2017 07:26:09 -0800
From:      Allan Jude <allanjude@FreeBSD.org>
To:        freebsd-hackers@freebsd.org, Saurav Sachidanand <sauravsachidanand@gmail.com>, soc-admins@freebsd.org
Subject:   Re: [GSoC 2017] Original proposal: Port kernel Lua to FreeBSD
Message-ID:  <244231A2-EB18-4E58-A2B2-927F55D54950@FreeBSD.org>
In-Reply-To: <CACKq%2BiX_V2MY9sNf-buEOO1S87dbhDv%2BPGbUEqRUVkvzz3pdvw@mail.gmail.com>
References:  <CACKq%2BiX_V2MY9sNf-buEOO1S87dbhDv%2BPGbUEqRUVkvzz3pdvw@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On February 27, 2017 5:28:41 AM PST, Saurav Sachidanand <sauravsachidanand@=
gmail=2Ecom> 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?244231A2-EB18-4E58-A2B2-927F55D54950>