Meat: future

March 15th, 2014

Why we need? we do, stop asking

How to produce? raise animal, kill animal, process animal, eat flesh.

What side-effects? large land use, water use, disease from close proximity crosses to humans, suffering

Is better way? yes, take cell from animal, grow cells to tissue, process tissue, eat tissue.

really? yes, like interleukin, insulin, beer, only more complex. is cultured meat.

is sci-fi? no, human windpipe transplanted, rat kidney research, modern meadow leather TED, cultured hamburger.

is next year? not quite, is new harvest goal

no hebrew? העמותה לחקלאות מודרנית

Good people not caring

December 11th, 2013

That’s what people always say to explain the lack of momentum for their save the world project. It’s automatic: A is good, A is essential, why isn’t everyone doing A? That’s how I feel about my current pet project, medicine. I recall joining my brother for a visit to the carrot forum, a group of green minded people meeting to advance their goals, and feeling like an outsider, thinking ‘this is cool’ and then going back to my business. How do you get people to cross the divide? it’s an age old question, this short post is not contributing to it, simply giving a point in time when I have started considering that question. Keeping in mind my usual attention span it is probably also the point in time when I stopped considering it. Peace.

Bar Kayma Garden

November 29th, 2013

Today I worked on getting a watering system for the north wall plants. I ended up buying the wrong 1/2-1/2-1/2 two way stop plus external 1/2 hose to 1/2 connector adapter, but it is still installable before the existing faucet instead of after, but we will need to turn off the main since no top floor only stop has been found.

Miditech keyboard with linux

July 4th, 2013

Got a “Garagekey mini” usb midi keyboard of miditech for ~300 nis. It doesn’t google well, but surprisingly alsa wise worked out of the box. My only complaint is that occasionally it will stop producing output (aseqdump -p 20 will produce nothing), solvable by disconnecting and reconnecting the device.

Next I wanted to get a working keyboard automatically after connecting it to my laptop. This turned out to be more complex then I thought. Problems included:

1. (not a problem, just a not very optimal thing) have to edit udev as root to respond to insertion events:

$ cat /etc/udev/rules.d/99-miditech-garagekey.rules
ACTION==”add”, ATTR{idVendor}==”1acc”, ATTR{idProduct}==”1a0f”, RUN+=”/home/alon/bin/miditech”

2. jackd is not actually a daemon, and my feeble understanding of dbus resulted in having to run it with DISPLAY set

3. (not absolutely neccessary) had to setup jackd to run as alon, reading /usr/share/doc/jack-audio-connection-kit-1.9.9.5/README.Fedora and following the instructions to add myself to jackusr group. Edited /etc/security/limits anyway. Currently jackd complains it cannot lock enough memory but it doesn’t seem to bother it (no hickups). It does get realtime scheduling (doesn’t complain).

4. Ran everything under tmux as my daemnizer. Lame. But works, and also got a gnome-terminal for debugging:

(ugly sleeps for debugging)
$ cat ~/bin/miditech

#!/bin/bash

INSTRUMENT=”/usr/share/zynaddsubfx/banks/SynthPiano/0033-Analog Piano 1.xiz”
export DISPLAY=:0.0

if [ $UID == 0 ]; then
su alon -c “tmux new-session -d -s miditech ~alon/bin/miditech”
su alon -c “gnome-terminal -e ‘tmux attach -t miditech’”
exit 0
fi

tries=1
while [ "x`pgrep jackd`" == "x" ]; do
if [ $tries -gt 5 ]; then
echo failed to launch jackd
sleep 10000
exit
fi
jackd -T -ndefault -dalsa -dhw:0 -r48000 -p1024 -n2 &
sleep 2
tries=$((tries+1))
done
sleep 4
if [ x`pgrep zynaddsubfx` == x ]; then
zynaddsubfx -L “$INSTRUMENT” -e $0.zynaddsubfx.init &
else
aconnect 20 128
fi
sleep 1000

#

$ cat ~/bin/miditech.zynaddsubfx.init
#!/bin/bash
jack_connect zynaddsubfx:out_1 system:playback_1
jack_connect zynaddsubfx:out_2 system:playback_2
# aconnect numbers are constant? seem to be
aconnect 20 128

5. (note) to attach from within tmux: (unset TMUX; tmux attach-session -t miditech)

6. determining when jack is ready is annoying. no systemd file either (tried – failed with a dbus error, need to look at that / bug some devel). could use systemd approach of checking for a socket (how would I check for a socket being available? need to lookup what systemd actually does. netstat polling is ugly).

reviewed-by and signed-off-by

April 24th, 2013

This took me a whole day: it adds sorted Signed-of-by and Reviewed-by to a bunch of git commits using the –exec option and overriding the EDITOR environment variable.

Half of the code is from my misspelling of Signed-off as Signed-of, and using the script to fix the resulting mess instead of using a hard reset.

Usage:

REVIEWED_BY="Some One " git rebase -i --exec git-add-review.exec qemu/master

Script 1: git-add-review.exec

#!/usr/bin/python
# coding: utf-8

import os

author_replacements = {
'Some One Alias ':
'Some One '
}

lines = os.popen('git show HEAD').readlines()

author = [l for l in lines if 'Author:' in l]
author = author[0].split('Author: ', 1)[1].strip()

if author in author_replacements:
os.environ['EDITOR'] = 'true'
os.system('git commit --amend --author "%s"' % author_replacements[author])

os.environ['EDITOR'] = 'git-add-review.helper'
os.system('git commit --amend')

Script 2: git-add-review.helper

#!/usr/bin/python

import os
import sys

with open(sys.argv[-1]) as fd:
lines = fd.readlines()

i_last = -1
for i, l in enumerate(lines):
if l[:1] == '#':
i_last = i
break

author = [l for l in lines if 'Author:' in l]
if len(author) == 0:
author = os.popen('git show HEAD | grep Author').readlines()
author = author[0].split('Author: ', 1)[1].strip()

reviewed_by = os.environ.get('REVIEWED_BY', 'Anonymous').strip()
print 'AUTHOR*** ', repr(author)
print 'REVIEWER* ', repr(reviewed_by)

author_is_reviewer = reviewed_by[:5] == author[:5] # hack

if author_is_reviewer:
print "author is reviewer"

new_lines = []
signed_lines = []
reviewed_lines = []

for l in lines:
if l.startswith('Signed-of-by:') or l.startswith('Signed-off-by:'):
signed_lines.append(l)
elif l.startswith('Reviewed-by:'):
reviewed_lines.append(l)
else:
new_lines.append(l)

print "=== Reviewed-by ==="
print ''.join(reviewed_lines)
print "=== Signed-off-by ==="
print ''.join(signed_lines)
def is_valid_email(x):
return '@' in x
reviewers = set([l.split(':', 1)[1].strip() for l in reviewed_lines
if is_valid_email(l.split(':', 1)[1])])
signers = set([l.split(':', 1)[1].strip() for l in signed_lines
if is_valid_email(l.split(':', 1)[1])])
reviewers -= set([''])
signers -= set([''])

if author_is_reviewer:
reviewers -= set([author])
else:
reviewers |= set([reviewed_by])

signers.add(author)

new_lines.extend(['Signed-off-by: %s\n' % s for s in sorted(signers)])
new_lines.extend(['Reviewed-by: %s\n' % r for r in sorted(reviewers)])

with open(sys.argv[-1], 'w+') as fd:
fd.writelines(new_lines)

Mini post – Going to GUADEC 2012 Coruña

July 21st, 2012

I am attending GUADEC at A Coruña, Spain

I’ve been in the spice team for more then two years. I’ve come to work for Red Hat because I believe in open source, and as such I always appreciated being a part of a larger team, the desktop team, inside Red Hat. So going to GUADEC is something personally rewarding to me, like going to FOSDEM was. I’m hoping to attend pdf related talks (I’m interested in better pdf to text hebrew support, and might need to go higher level for that), and actually I’ve already mapped out my talks and am really happy to be going!

moon maps

May 3rd, 2012

Lunar Reconnaissance Orbiter map using openlayers for display and mapaplanet (based on isis3) data:


Xspice talk given at FOSDEM 2012

February 28th, 2012

I gave a talk about the hack that is Xspice during the last awesome-if-you-aren’t-distracted-by-a-pending-talk-or-second-guessing-a-given-talk FOSDEM.

Slides, are in multitalk, also in html. Patches for multitalk used.

Things learned:

  • homework should include debunking assumption that the W thing is probably just a fad that is going away.
  • practicing to not talk fast doesn’t always work.
  • spice is not the greatest thing since sliced bread.

More positive lessons learned:

  • Wspice would be more interesting to the X-turning-W crowd, and in general for the future.
  • Perhaps rendering at the server and that’s it for 3D is a good idea.

DRM progress 1

November 30th, 2011

Hi,

I’m planning on this being the first of many updates on my ongoing work on adding 3D support to Spice. Right now I have a three stage plan and stage one is adding a DRM driver for linux. Our current linux driver is an X one, adding a DRM driver will allow us to use KMS and have an interrupt handler, and later provide direct rendering of course.

I’ve setup a working environment for developing the DRM driver to it’s current state. I hope that when I look back at this post I’ll notice all the things I missed, but in order to do that I need to write them in the first place:

  1. fedora host, with kernel checkout to /home/alon/src/linux
  2. fedora vm, with 9pfs mount pointing to /home/alon/src, with ttyS0 console (should be hvc0 but this failed for some reason). vm setup with password less login (should be autologin, but still multiuser init level since ssh is helpful). vm boot time is also too long – 10 seconds (was 40-50 before I noticed I was using ide instead of virtio, thanks to writing this blog post), turned off one thing I can’t remember, but a lot more to tweak there.
  3. make install once in vm, get /boot/grub2/grub.cfg to boot the new kernel by default, no quiet, and tty=ttyS0 (again – should be hvc0, not sure why it doesn’t work).

Development iteration:

    1. change code, build driver (make drivers/gpu/drm/qxl/qxl.ko)
    2. reboot vm (can be in parallel to 1)
    3. login and modprobe the new modules. actual keyboard: root<enter> . qxl<enter>.
      qxl is a script that does:
      ifup eth0 # didn’t figure out how to set this up – too used to /etc/network/interfaces. RHCE next week :) This starts sshd
      nc 192.168.122.1 5678 # knock on host side script that does ssh here
      insmod {ttm.ko,qxl.ko}
      on the host I have complementary script.

Most work so far was in figuring out TTM memory management enough to get memory allocated on the PCI BAR 0 for the commands. Initially I also had to figure out kernel debugging and building – building an individual module is much faster then building the whole kernel, and after trying to debug via qemu’s gdbserver (couldn’t find some symbols) gave up for now and am using printk / DRM_INFO’s, and making sure any module I touch (so far just ttm.ko and qxl.ko) is insmod’ed instead of modprobe’d to be sure I get the fresh one (already got bitten by this a few times – this time by just forgetting to build the specific module. inotify eclipse like instant build?). Reread the coding style, last time I read it was for fun, now I actually need to use it.

qxl:

#!/bin/bash
ifup eth0
iptables -F
echo go | nc 192.168.122.1 3456
nc -l 3456
# insmod everything to remove the "make modules_install" slow stage
ROOT=/mnt/src/linux/drivers/gpu/drm
# defaults to 10, doubled for soft lockup thresh, 22 seconds in reality,
# too long
#echo 1 &gt; /proc/sys/kernel/watchdog_thresh
cd $ROOT
insmod drm_kms_helper.ko
insmod ttm/ttm.ko
insmod qxl/qxl.ko

do-ssh:

#!/bin/bash</code>

while [ 1 == 1 ]; do
nc -l 3456
#gnome-terminal -e "ssh root@192.168.122.89"
#screen ssh root@192.168.122.89
xterm -e "ssh root@192.168.122.89" &amp;
sleep 1
echo go | nc 192.168.122.89 3456
done

nc-6666:

#!/bin/bash
i=0
while [ 1 == 1 ]; do
filename=/tmp/nc6666.$i.txt
i=$((i+1))
echo ====================== $filename ======================
(nc -l 6666 | tee $filename)
done

Started the practice of having a ~/tmp-bin with snippets that do not deserve to be in ~/bin but are currently useful. do-ssh, nc-6666 and f16-qxl-drm-6666 are there:

vm command line (need to switch to libvirt, this is done by spice-launcher):

x86_64 garlic:linux alon (qxl)$ cat ~/tmp-bin/f16-qxl-drm-6666
f16-qxl-drm --serial socket,host=127.0.0.1,port=6666 --qxldebug 1 --guestdebug 1 $*
x86_64 garlic:linux alon (qxl)$ ls -l ~/bin/f16-qxl-drm
lrwxrwxrwx. 1 alon alon 6 Nov 11 16:49 /home/alon/bin/f16-qxl-drm -&gt; spice2</code>

f16-qxl-drm --serial socket,host=127.0.0.1,port=6666 --qxldebug 1 --guestdebug 1

x86_64 garlic:linux alon (qxl)$ . ~/tmp-bin/f16-qxl-drm-6666 --print-commandline-only

/home/alon/spice/upstream/bin/qemu-system-x86_64 -chardev stdio,id=muxstdio,mux=on -mon chardev=muxstdio,mode=readline -vga qxl -drive file=/var/lib/libvirt/images/F16-qxl-drm.img,cache=unsafe,if=virtio,readonly=off -enable-kvm -L /home/alon/spice/upstream/share/qemu -m 1024 -cpu host -spice disable-ticketing,port=10006 -chardev socket,id=qmpmon,host=127.0.0.1,port=20006,server,nowait,ipv4 -mon chardev=qmpmon,mode=control -snapshot -no-shutdown -global qxl-vga.guestdebug=1 -global qxl-vga.debug=1 -usb -device virtio-serial,multifunction=on -chardev spicevmc,name=vdagent,id=vdagent -device virtserialport,chardev=vdagent,name=com.redhat.spice.0 -chardev socket,server,path=/tmp/tmpCYCBQ1/virtconsole,nowait,id=virtconsole -device virtconsole,chardev=virtconsole,name=org.alon.console -netdev tap,id=hostnet0,ifname=tap0,script=no,downscript=no -device virtio-net-pci,netdev=hostnet0,id=net0 -chardev socket,host=127.0.0.1,port=6666,id=serial -serial chardev:serial -virtfs local,path=/home/alon/src/,mount_tag=src,security_model=mapped,writeout=immediate

qxl DRM driver after insmod and ls

Announcing Xspice

July 23rd, 2011

An X server and a Spice server. Yes, the idea that X is not a good enough networking protocol for WAN has been investigated already many times. Why yet another one? In the end because it seemed like a cool thing to do. And it’s easier to test the qxl driver without the guest/host split.

What I think would be really useful is to be able to use it side by side with an existing X server, i.e. having two drivers both receiving all X operations (vnc doesn’t have this problem because it isn’t implemented as a driver). Sadly this is not yet doable. But happily it is being worked on, mainly due to the relatively-new dual GPU laptops (I don’t know the ETA. I think it’s called sharding, or at least is related to that).

So right now, if you are tired of Xvnc, or Xrdp, or NX, or just want to compare and tell us again that we need to improve SPICE (*) (**)

The source release is one and the same as the xorg qxl driver: xspice source aka xf86-video-qxl-0.0.16.tar.bz2 (see spice-space for the latest)

Building requires the same dependencies as any X video driver, plus spice-server. See README.xspice for details.

XSpice installation as a normal user is a bit of a hassle, since it requires one to build their own X server. If you want to do it, see README.xspice for details. On the other hand, installing as root requires just three things:
* spiceqxl_drv.so -> with all other xorg video drivers.
* xspice -> /usr/bin
* spiceqxl.xorg.conf.example -> /etc/X11/spiceqxl.xorg.conf (this is the default config file xspice looks for, you can change that with –config)

sudo make install will do the first two for you (assuming you did ./configure –prefix=/usr). The third you’ll have to do by hand.

To summarize, this should get you going:

./configure --prefix=/usr
make
sudo make install
sudo cp examples/spiceqxl.xorg.conf.example /etc/X11/spiceqxl.xorg.conf

Alternatively, somewhere in the near future I hope this will be enough

yum install xspice

Running is easier:

xspice --disable-ticketing --port 5900 --tls-port 0 :1.0 2>&1 > /dev/null &
spicy -h localhost -p 5900
DISPLAY=:1.0 favorite-window-manager-that-doesnt-need-dbus # i.e. icewm

Note: you don’t have to redirect, there is just a lot of spew, so you might want to run spicec/spicy in another terminal.

Note 2: that –tls-port 0 is weird, right? bug. But I already used one paper bag (0.0.15 never saw daylight), so I’ll just leave this for the next release.

Most of the options familiar from qemu’s -spice option are there, with some exceptions: no sound yet (do a pulseaudio proxy? not sure), no agent implementation (probably a good idea to reuse spice-vdagent for this), and no per channel secure/unsecure port selection (just laziness). The internal mechanism for passing those options is a bit of a hack – XSPICE_* environment variables are set by xspice and read by spiceqxl_drv.so.

I hope someone finds this useful, if you do, do let me know!

*) we know! but thanks for telling us! no, really! :)
**) Compared to VNC I don’t think there is a question that Spice is a better (***) protocol. Compared to the rest, it has it’s shortcomings. But it will be ;)
***) ok, I can’t write “better” without saying that it is a function of the optimization criteria. But you know what I mean.

p.s. also, we already had spice-x, so xspice was inevitable. Next, ispice!