bcc-lua: 64 bit addresses and Lua numbers

Created on 15 Apr 2016  路  3Comments  路  Source: iovisor/bcc

I ported stacksnoop to Lua. It was easy and works but its stacks are misleading:

146355.560800000   submit_bio
        ffffffff813bd800 blk_init_queue
        ffffffff812b1800 ext4_writepages
        ffffffff811a3800 do_writepages
        ffffffff8124e000 wbc_detach_inode
        ffffffff8124e800 writeback_inodes_wb.constprop.59
        ffffffff8124e800 writeback_inodes_wb.constprop.59
        ffffffff8124f000 wb_start_writeback
        ffffffff8124f800 dirtytime_interval_handler
        ffffffff8109c800 create_worker
        ffffffff8109d000 rescuer_thread
        ffffffff810a3000 flush_kthread_work
        ffffffff8183a000 _raw_read_lock

Note the addresses all end 00 (and the symbols are probably wrong). This is because Lua's number type is double and can't represent all > 52 bit integers:

$ luajit -e 'print(string.format("%x", tonumber("20000000000000", 16)))'
20000000000000
$ luajit -e 'print(string.format("%x", tonumber("20000000000001", 16)))'
20000000000000
$ luajit -e 'print(string.format("%x", tonumber("20000000000002", 16)))'
20000000000002

@vmg, do you have any handy workarounds planned for this? It looks like Lua 5.3 has a 64 bit integer type but as far as I can see that hasn't made it to LuaJIT.

Other than this the Lua integration is amazing :)

All 3 comments

Well, that throws quite a wrench in my plans. Thanks for bringing this to my attention... Let me research and figure out how can we work around this. I can't believe I didn't spot the issue during production testing. :sweat:

Other than this the Lua integration is amazing :)

馃槏

OK, I have an attack plan. I'll work on this during the weekend. :)

This was less painful than I thought! Check out https://github.com/iovisor/bcc/issues/490

Was this page helpful?
0 / 5 - 0 ratings

Related issues

butterl picture butterl  路  6Comments

computer5student picture computer5student  路  7Comments

banh-gao picture banh-gao  路  8Comments

brendangregg picture brendangregg  路  4Comments

brendangregg picture brendangregg  路  4Comments