From owner-freebsd-hackers@freebsd.org Thu Mar 23 04:22:00 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 716EAD192A0 for ; Thu, 23 Mar 2017 04:22:00 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x244.google.com (mail-io0-x244.google.com [IPv6:2607:f8b0:4001:c06::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 40F361D18 for ; Thu, 23 Mar 2017 04:22:00 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x244.google.com with SMTP id f103so12084051ioi.2 for ; Wed, 22 Mar 2017 21:22:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=OivUfRBp1YtL2VgSd+OSECIZCgzyMqNZo6UtgPeglaI=; b=2Jf/KMxEvnm7rikV5MmHXjiF3AZa4Gd9mFDPeTsFN40WVUAuiwh65iDKXo5PDMMhH9 BeSyUksUGuDKqtFxSsbCoKIvwjqcYvo6Ci3Yai61bueRrG0S/3dqxXbId5vegMKCDaWR 0RI0Ix0wrY+6fmQpSPf/6sYzJvfBSfxcPaboavT25lx+uzcGxahw+vwvcQt+cWJHMKs/ 8aVxHr+eryfx/UGd5xk7Y63f0pnl6yStmEAUolP8amKgfE4qvSwRRT259J+eVcLk43IM 0N3uyAoLdDwX33HMfYUdnLe6CbzJdTwW72rQ5waWWRR/pCcsw0lgj4rDIvJYujJByLAD GAdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=OivUfRBp1YtL2VgSd+OSECIZCgzyMqNZo6UtgPeglaI=; b=j6sbeKa5Lk9kxNu4MQW/MzqT7LOfWvSlGLsusGtIBPp5RuPdFKZlAsLeUfDGU8AguY szeL5m6UDsrIWhPVsyKddrHQLBeY/1yHrPSjTGTxOOfauM/2NEH02DZPEYLPMazcFhwk Kq5ou+mafL3BiFWBaTdJqQqfMbvwrEiazvxPf0vmRfrKGH94eHbmsEcVFh0/vkNkh+HP Kl0PkV39T7fr2rYyi2hc/JN3Xd0qlX0z1Vcwr16gKPi78YGJigbYHRtnXP6V7Jp6D5+j PVPUSuIIA0Yj9hy1eR/cmtTfJQ60hE3kVAv8lJ5I6bGrbzbR/T7NS14NOrtyoQo6hYdT 8hOA== X-Gm-Message-State: AFeK/H2O7k0SVIGpYf3YP+h6L6uLtWKBroQ+cnUjazYfohZZ0MgB88h6HV8TNETlh0YfbpOPkOTxKouzleityA== X-Received: by 10.107.174.220 with SMTP id n89mr905257ioo.166.1490242919131; Wed, 22 Mar 2017 21:21:59 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.146.24 with HTTP; Wed, 22 Mar 2017 21:21:58 -0700 (PDT) X-Originating-IP: [2607:fb10:7021:1::3224] In-Reply-To: <9db670f6-54d1-7862-bcd2-7c80df92e724@freebsd.org> References: <244231A2-EB18-4E58-A2B2-927F55D54950@FreeBSD.org> <9db670f6-54d1-7862-bcd2-7c80df92e724@freebsd.org> From: Warner Losh Date: Wed, 22 Mar 2017 21:21:58 -0700 X-Google-Sender-Auth: Tf9Oc8llO6QLTb6JShLjGY7B9Lk Message-ID: Subject: Re: [GSoC 2017] Original proposal: Port kernel Lua to FreeBSD To: Julian Elischer Cc: Allan Jude , "freebsd-hackers@freebsd.org" , Saurav Sachidanand Content-Type: text/plain; charset=UTF-8 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: Thu, 23 Mar 2017 04:22:00 -0000 I just did exactly the same thing last night.... Warner On Wed, Mar 22, 2017 at 8:03 PM, Julian Elischer wrote: > On 1/3/17 4:14 pm, Julian Elischer wrote: >> >> On 28/2/17 2:01 am, Warner Losh wrote: >>> >>> On Mon, Feb 27, 2017 at 8:26 AM, Allan Jude >>> wrote: >>>> >>>> On February 27, 2017 5:28:41 AM PST, Saurav Sachidanand >>>> wrote: >>>>> >>>>> Hello FreeBSD community, >>>>> >>>>> I'm >>>>> Saurav Sachidanand, and I'm >>>>> a CS sophomore studying in India >>>>> . >>>>> I have an interest in operating systems development and wish to >>>>> contribute >>>>> to the FreeBSD community. I'm proficient with C and have some >>>>> experience in >>>>> kernel programming. Hence, I'd like to propose an original project for >>>>> GSoC >>>>> 2017 that I feel would benefit this community. >>>>> >>>>> In past years, the Lua interpreter was ported to run inside the Linux >>>>> and >>>>> NetBSD kernel [1]. 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. A working demonstration of it is a packet filtering >>>>> algorithm >>>>> written entirely in kernel Lua [2]. >>>>> >>>>> 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. [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. 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. And it would be interesting to carry out it out >>>>> in >>>>> FreeBSD as well since it has a larger community than NetBSD. >>>>> >>>>> I humbly request anyone who is interested in this project to be my >>>>> potential mentor(s) for GSoC. >>>>> >>>>> More slides on kernel Lua in NetBSD - [9], [10]. >>>>> >>>>> Thanks, >>>>> Saurav >>>>> >>>>> [1] - http://www.netbsd.org/~lneto/dls14.pdf >>>>> [2] - https://www.netbsd.org/~lneto/eurobsdcon14.pdf >>>>> [3] - https://github.com/jsonn/src/tree/trunk/external/mit/lua/dist/src >>>>> [4] - >>>>> https://github.com/IIJ-NetBSD/netbsd-src/tree/master/sys/modules/lua >>>>> [5] - >>>>> >>>>> https://github.com/IIJ-NetBSD/netbsd-src/tree/master/sys/modules/luasystm >>>>> [6] - https://github.com/IIJ-NetBSD/netbsd-src/tree/master/sbin/luactl >>>>> [7] - http://netbsd.gw.com/cgi-bin/man-cgi?lua+4+NetBSD-current >>>>> [8] - http://www.lua.org/tests/ >>>>> [9] - >>>>> >>>>> https://www.netbsd.org/gallery/presentations/mbalmer/fosdem2012/kernel_mode_lua.pdf >>>>> [10] - https://www.lua.org/wshop13/Cormack.pdf >>>>> _______________________________________________ >>>>> freebsd-hackers@freebsd.org mailing list >>>>> https://lists.freebsd.org/mailman/listinfo/freebsd-hackers >>>>> To unsubscribe, send any mail to >>>>> "freebsd-hackers-unsubscribe@freebsd.org" >>>> >>>> This may be quite a nice thing to have. Another upcoming use for LUA in >>>> the kernel is ZFS Channel Programs. These allow a number of ZFS operations >>>> to be completed as a single atomic transaction. >>>> >>>> I would hope we could structure this in such a way as to not end up with >>>> two copies of Lua in the kernel. >>> >>> There's also a 3/4 finished lua in the boot loader that you might be >>> able to leverage as well.... >> >> >> I'd like to see that finished. While Devin has done Heroic work with the >> forth in the loader, I think it's time has come. >> It' be nice to have something a little less '60s. > > some news: Pedro Arthur who did the project just mailed me: > > =================== > > Hi, > I've just finished getting the lua-bootloader code on top of HEAD, it should > compile and run fine. > The code can be found in [1]. > > [1] - https://github.com/grandao/freebsd/tree/projects/lua-bootloader > > =================== > so it's up to date and we should look at it again > > >> >>> >>> Warner >>> _______________________________________________ >>> freebsd-hackers@freebsd.org mailing list >>> https://lists.freebsd.org/mailman/listinfo/freebsd-hackers >>> To unsubscribe, send any mail to >>> "freebsd-hackers-unsubscribe@freebsd.org" >>> >> >