From owner-soc-status@freebsd.org Tue Aug 4 16:40:35 2015 Return-Path: Delivered-To: soc-status@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 6417F9B30D5 for ; Tue, 4 Aug 2015 16:40:35 +0000 (UTC) (envelope-from stefanogarzarella@gmail.com) Received: from mail-lb0-x236.google.com (mail-lb0-x236.google.com [IPv6:2a00:1450:4010:c04::236]) (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 05C171377; Tue, 4 Aug 2015 16:40:34 +0000 (UTC) (envelope-from stefanogarzarella@gmail.com) Received: by lbbud7 with SMTP id ud7so9452654lbb.3; Tue, 04 Aug 2015 09:40:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:cc:content-type; bh=CHJVvPp0vb2jI0Aw8HBOaxn0vw6kLYDMWdbP8zxjaiU=; b=LOeZdlmowynlVWJvoBHAGaawd5B15nnEFTjMvq3Tr0WWA2SumGJyd86Kra0FFVURx9 OpVZ/h+qDuSVih5mJIP02uQMH1u4+PuYgDOpnuqJhy1XZl8LRhcPWGPSSbcQ1LNYc/rP WZB8ymmUiYKUu+coPUcxodW7HenJODI/nuqpTZyYiKPrD4WGt5eHmKQraImHLEGG++c1 HYu2fr9rU3tH0hGtUwgVN1xynIUGLOqSRiP1bHTm91MRStY7uY+8kBb5DfdYP6OSARWB aw0ZsnVt0U6VGYf6Y3vAN3tfBw1B0AFrtl8bOzm3hsozrj+vT2KH7Sgz6MAvwqtgOeM0 o09A== X-Received: by 10.152.120.198 with SMTP id le6mr4533106lab.38.1438706432858; Tue, 04 Aug 2015 09:40:32 -0700 (PDT) MIME-Version: 1.0 Received: by 10.25.216.3 with HTTP; Tue, 4 Aug 2015 09:40:13 -0700 (PDT) From: Stefano Garzarella Date: Tue, 4 Aug 2015 18:40:13 +0200 Message-ID: Subject: ptnetmap on bhyve status report To: soc-status@freebsd.org Cc: Luigi Rizzo , Peter Grehan , Neel Natu Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.20 X-BeenThere: soc-status@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Summer of Code Status Reports and Discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Aug 2015 16:40:35 -0000 Dear All, I recently ended the implementation of notification mechanism between vm and ptnetmap kernel threads. I needed two methods: 1) notification from ptnetmap kthread to guest VM (interrupt/irq) rx (host -> guest): new packets tx (guest - > host): new free slots vmm.ko already has IOCTL to send interrupt to the guest and I used it in the kernel thread. The bhyve user-space, during netmap configuration, passes the ioctl parameters (fd, com, data) to ptnetmap kthreads. The ptnetmap kthread (attached to bhyve process) uses kern_ioctl() with these parameters to notify the guest VM. 2) notification from guest VM to ptnetmap kthread (write into the specific register) rx (host -> guest): new free slots tx (guest - > host): new packets I added new IOCTL on vmm.ko (VM_IO_REG_HANDLER) to catch write/read on specific I/O address and send notification. These are the parameters: struct vm_io_reg_handler { uint16_t port; /* I/O address */ uint16_t in; /* 0 out (write) - 1 in (read) */ uint32_t mask_data; /* 0 means match anything */ uint32_t data; /* data to match */ enum vm_io_regh_type type; /* type of handler */ void *arg; /* argument used from handler */ }; For now I've implemented only 1 type of handler (VM_IO_REGH_KWEVENTS) to use events in the kernel through wakeup() and tsleep()/msleep(), but I wrote the code to be easily extended to support other type of handler (cond_signal, write/ioctl on fd, etc). With this new IOCTL, when the guest writes on specific register, the vmm.ko invokes wakeup() on the parameter (arg / chan) specified from bhyve user-space application. The same parameter is passed to the ptnetmap kthreads that call tsleep(chan, ...) to wait the event. In this way the netmap.ko and vmm.ko are independent and the event is propagated in the kernel, without passing through the user space. Before the GSoC deadline, I'll do some performance experiments, code cleanup and bug fixing. The code is available on https://svnweb.freebsd.org/socsvn/soc2015/stefano/ptnetmap/stable/10/ Any suggestions are appreciated. Thanks, Stefano Garzarella.