2012-01-23
■[linux]git上の開発版カーネルをビルドするとバージョン番号に+が付く件
これのせいで、いくつかのブート時に走るスクリプトとかが発狂したりするので大変うざい。
LOCALVERSIONを指定しておけば、それらと一緒くたの文字列として扱われるので問題なくなるのだが。
意味としては、3.2.0がリリースされているとしたら、リリース時のtagから進んだ開発中バージョンって事のように思う。
diff --git a/Makefile b/Makefile index adddd11..5b4f533 100644 --- a/Makefile +++ b/Makefile @@ -947,7 +947,8 @@ $(vmlinux-dirs): prepare scripts # Store (new) KERNELRELASE string in include/config/kernel.release include/config/kernel.release: include/config/auto.conf FORCE $(Q)rm -f $@ - $(Q)echo "$(KERNELVERSION)$$($(CONFIG_SHELL) $(srctree)/scripts/setlocalversion $(srctree))" > $@ +# $(Q)echo "$(KERNELVERSION)$$($(CONFIG_SHELL) $(srctree)/scripts/setlocalversion $(srctree))" > $@ + $(Q)echo "$(KERNELVERSION)" > $@
2012-01-21
■[iOS][JailBreak]Cydiaが落ちまくる
iOS 5.0.1をPwnageToolでJBしてCydiaでパッケージいれよー、とか思ったらSourcesでAddとかSearchとか選んだ瞬間に再現率100%で落ちる。
何でこんなんでリリースされてんのかなぁと思いつつクラッシュログ取ってみた。
syuu1228’s gist: 1653946 — Gist
まぁ、誰が見ても一目で分かると思うんだが、日本語入力が問題なのな、これ。
どうも辞書開く所でassertかかってabortしてる。
Thread 0 Crashed: 0 libsystem_kernel.dylib 0x3625532c 0x36244000 + 70444 // __pthread_kill + 0x8 1 libsystem_c.dylib 0x34b01f54 0x34ab4000 + 319316 // pthread_kill + 0x30 2 libsystem_c.dylib 0x34afafe4 0x34ab4000 + 290788 // abort + 0x58 3 libsystem_c.dylib 0x34b120d6 0x34ab4000 + 385238 // __assert_rtn + 0xae 4 libmecabra.dylib 0x356ee7c4 0x35688000 + 419780 // IDXUserDictionaryOpen + 0x174 5 libmecabra.dylib 0x356f609a 0x35688000 + 450714 // InputEngine::MecabraEngine::openLearningDic(__CFURL const*, __CFString const*, __CFString const*) + 0x1e 6 libmecabra.dylib 0x356f93be 0x35688000 + 463806 // InputEngine::MecabraJapanese::open(__CFURL const*, __CFArray const*, unsigned long) + 0x136 7 libmecabra.dylib 0x356f7c3e 0x35688000 + 457790 // InputEngine::MecabraJapanese::create(__CFURL const*, __CFArray const*, unsigned long) + 0x92 8 libmecabra.dylib 0x356fbc70 0x35688000 + 474224 // InputEngine::MecabraInputEngineDispatcher<InputEngine::MecabraJapanese, InputEngine::NoopPredictionComponent>::MecabraInputEngineDispatcher(MecabraInputMethodType, __CFURL const*, __CFArray const*, unsigned long) + 0x70 9 libmecabra.dylib 0x356fb58e 0x35688000 + 472462 // MecabraCreateWithAdditionalDictionariesAndOptions(MecabraInputMethodType, __CFURL const*, __CFArray const*, unsigned long) + 0x92 10 libmecabra.dylib 0x356fb76e 0x35688000 + 472942 // MecabraCreateWithAdditionalDictionaries + 0x72 11 TextInput_ja 0x304297c8 0x30427000 + 10184 // -[TIWordSearchKana initTIWordSearch] + 0xac 12 TextInput_ja 0x3042c092 0x30427000 + 20626 // -[TIKeyboardInputManager_ja_JP_Inline50OnKana setInHardwareKeyboardMode:] + 0xce 13 UIKit 0x34d70e88 0x34cf2000 + 519816 // -[UIKeyboardImpl setInputMode:userInitiated:] + 0x354 14 UIKit 0x34d7098a 0x34cf2000 + 518538 // -[UIKeyboardImpl setInputModeFromPreferences] + 0xba 15 UIKit 0x34d6c58e 0x34cf2000 + 501134 // -[UIKeyboardImpl initWithFrame:] + 0x1aa 16 UIKit 0x34d6c17e 0x34cf2000 + 500094 // +[UIKeyboardImpl sharedInstance] + 0x9a 17 UIKit 0x34e52ee2 0x34cf2000 + 1445602 // -[UIAlertView(Private) _updateFrameForDisplay] + 0x176 18 UIKit 0x34e4fac8 0x34cf2000 + 1432264 // -[UIAlertView(Private) layoutAnimated:] + 0x224 19 UIKit 0x34e4f89a 0x34cf2000 + 1431706 // -[UIAlertView(Private) _layoutPopupAlertWithOrientation:animated:] + 0x5a 20 UIKit 0x34e4f7b4 0x34cf2000 + 1431476 // -[UIAlertView(Private) _layoutIfNeeded] + 0x150 21 UIKit 0x34e4e57e 0x34cf2000 + 1426814 // -[UIAlertView(Private) _performPopup:animationType:] + 0x1a2 22 UIKit 0x34e4de90 0x34cf2000 + 1425040 // -[UIAlertView(Private) popupAlertAnimated:animationType:] + 0x1c 23 MobileCydia 0x00020178 0x1000 + 127352 24 MobileCydia 0x000201f8 0x1000 + 127480
試しに、LanguageをEnglishにしてKeyboardsからJapaneseを削除するとちゃんと動くようになる。
まぁ、そういう事なんだが、で、どうしたらいいんだろうな。
2012-01-19
■[linux]Tracサーバで複数のgitリポジトリを管理
Tracには0.12から1つのTracインスタンスで複数リポジトリを管理する機能が入っている( MultipleRepositorySupport ? The Trac Project )。
これを使って複数のgitリポジトリを管理できるようにしてみた。
git pluginを入れる
gitを有効にするにはGitPlugin - Trac Hacks - Plugins Macros etc. - Tracを入れる必要がある。
# easy_install http://github.com/hvr/trac-git-plugin/tarball/master
こんだけ。
trac.iniの設定
git pluginの有効化
[components] # for plugin version 0.11.0.1+ tracext.git.* = enabled
git pluginの詳細設定
[git] ## let Trac cache meta-data via CachedRepository wrapper; default: false cached_repository = true ## disable automatic garbage collection for in-memory commit-tree cache; default: false persistent_cache = true ## length revision sha-sums should be tried to be abbreviated to (must be >= 4 and <= 40); default: 7 shortrev_len = 7 ## (0.12.0.3+) minimum length for which hex-strings will be interpreted as commit ids in wiki context; default: 40 wiki_shortrev_len = 40 ## executable file name (in case of doubt use absolute path!) of git binary; default: 'git' git_bin = /usr/bin/git ## (0.12.0.5+) define charset encoding of paths stored within git repository; default: 'utf-8' git_fs_encoding = utf-8 ## (0.12.0.3+) enable reverse mapping of git email addresses to trac user ids; default: false trac_user_rlookup = true ## (0.12.0.3+) use git-committer id instead of git-author id as changeset owner; default: true use_committer_id = true ## (0.12.0.3+) use git-committer timestamp instead of git-author timestamp as changeset time; default: true use_committer_time = true
メインリポジトリの設定
メインリポジトリとセカンダリリポジトリみたいな扱いになるので、複数管理したい場合もこっちをきちんと設定する必要がある。
最初ここをデフォルト値で放置してたらリポジトリブラウザ自体が出てこなかった。
[trac] 〜中略〜 repository_dir = /var/trac/git/default.git/ repository_sync_per_request = (default) repository_type = git
セカンダリリポジトリの設定
[repositories] hoge.dir = /var/trac/git/hoge.git/ hoge.type = git huga.dir = /var/trac/git/huga.git/ huga.type = git
デバッグログの設定
設定が何かおかしい時にはこれを有効にして、ログを読む必要がある。
[logging] log_file = trac.log log_level = DEBUG log_type = file
gitリポジトリの作成
# mkdir /var/trac/git # chown www-data:www-data /var/trac/git # sudo -u www-data git init --bare default.git # sudo -u www-data git init --bare hoge.git # sudo -u www-data git init --bare huga.git # cd default.git # sudo -u www-data git update-server-info # cd ../hoge.git # sudo -u www-data git update-server-info # cd ../huga.git # sudo -u www-data git update-server-info
resyncテスト
# trac-admin /var/trac/projects/<project name> repository resync '(default)' # trac-admin /var/trac/projects/<project name> repository resync 'hoge' # trac-admin /var/trac/projects/<project name> repository resync 'huga'
trac.iniが間違えてたりgitリポジトリが壊れて無ければresyncが成功するはず。
tracテスト
# /etc/init.d/apache2 restart
tracの画面を確認してリポジトリブラウザがちゃんと動いているか確認。
ダメならログを読んで設定を直す。
WebDAV経由のgitリポジトリ
# a2enmod dav_fs # a2enmod dav # a2enmod dav_lock # emacs /etc/apache2/sites-available/<site>
tracの認証用に設定しておいたhtdigestを流用してみる。
Alias /git /var/trac/git
<Location /git>
Options Indexes
DAV on
AuthType Digest
AuthName "git repository"
AuthDigestDomain /git/
AuthDigestProvider file
AuthUserFile /var/trac/projects/<project name>/htdigest
<Limitexcept GET PUT DELETE MOVE COPY HEAD PROPFIND OPTIONS REPORT MKCOL LOCK UNLOCK>
Require valid-user
</Limitexcept>
</Location>
# /etc/init.d/apache2 restart
$ git clone https://server/git/hoge.git $ cd hoge $ echo test > test $ git add test $ git commit -a -m "add test" $ git push origin master
ちゃんとclone, pushが動くのを確認する。
2012-01-07
■[linux][Network][SMP]CONFIG_RFS_ACCELはsfc(SolarflareのNIC)専用だという話
CONFIG_RFS_ACCELは一言でいうとRFSをMultiqueue NIC上で実現する機能で、もう少し説明すると、あるパケットが届いたら宛先プロセスの所属するCPUに対して割り込めるようNICにヒントを出す、というものなのだが、どれくらいの範囲のNICに対応しているのかと思って少し調べてみた。
set_rps_cpuで、NICへのヒントを出しているようだ。
更に見ていくと、dev->netdev_ops->ndo_rx_flow_steerがNICドライバ側の関数を呼び出しているところで、ここから実際にNICへヒント情報を書きこむようだ。
しかしこの関数、検索してみるとdrivers/net/ethernet/sfc/efx.cの中で設定されてる例しか見つからないではないか。
まぁその時点でこのデバイスにしか対応してないのはほぼ確定な訳だが、念の為非対応デバイスではどう動くのか確認しよう。
この辺のif文とかとても臭う。ここがfalseだったら上述の関数を叩かずに抜けるようだ。
じゃあこのdev->rx_cpu_rmapを設定している場所は?と見てみる。
ビンゴだ。ここでもこのメンバを初期化しているのはdrivers/net/ethernet/sfc/efx.cだけなようだ。
かくして、この機能って多くのMultiqueue NICへRFSの機能を提供する為のインタフェースとおもいきや、現状ではsfc専用なのだと分かった。
ちなみにixgbeはこの手のフィルタも備えているのに何故対応していないのかと思ったのだが、どうもドライバ側から独自に同等の機能を実現しているように見える(Flow Director)。
となると、まだこの手の機能をきちんと実現しているNICは殆ど無い上に、現状ではNIC毎に実現方法が違ってインタフェースも違いますよ、という事なのではないかな。まあ、無くても致命的ではないからね。
2012-01-06
■[x86][SMP][linux]/proc/irq/<IRQ>/smp_affinityの書き換えでPCIコンフィグレーション空間はどのように書き換わるか
※追記:実際にはカーネルにprintkを突っ込みまくるという、ずっと泥臭い方法で調査をしてました。多分役にたたないと思うけど、一応その時のdiffも併せて公開しておきます。Linux 3.2.0+用なので、他のバージョンだと当たらないかもしれません。
Debug print for trace MSI Interrupt routing settings, Linux-3.2.0+ — Gist
例えば僕のThinkpad x200にはこんなデバイスがあります。
e1000e: Intel(R) PRO/1000 Network Driver - 1.5.1-k e1000e: Copyright(c) 1999 - 2011 Intel Corporation. e1000e 0000:00:19.0: PCI INT A -> GSI 20 (level, low) -> IRQ 20 e1000e 0000:00:19.0: setting latency timer to 64 e1000e 0000:00:19.0: irq 44 for MSI/MSI-X e1000e 0000:00:19.0: eth0: (PCI Express:2.5GT/s:Width x1) 00:1f:16:2a:a4:59 e1000e 0000:00:19.0: eth0: Intel(R) PRO/1000 Network Connection e1000e 0000:00:19.0: eth0: MAC: 7, PHY: 8, PBA No: 1008FF-0FF udev[16200]: renamed network interface eth0 to eth4
IRQ44のMSI割り込みを一つ持つe1000eで、PCIのアドレスは00:19.0ですね。
※同時にIRQ20のLegacy割り込みを一つ持ってるのはなんででしょうね?分かる人居たら教えて下さい。
# cat /proc/irq/44/smp_affinity 3
CPUはcpu0とcpu1なので、全てのCPUのビットを立ててるから3。
# grep eth4 /proc/interrupts 44: 50037 49330 PCI-MSI-edge eth4
設定通り、両側のCPUに割り込んでますね。
この時、MSI Address RegisterとMSI Data Registerにはどのような値が設定されているか確認してみます。
# lspci -vvvv -s 00:19.0 00:19.0 Ethernet controller: Intel Corporation 82567LM Gigabit Network Connection (rev 03) Subsystem: Lenovo Device 20ee Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR+ FastB2B- DisINTx+ Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx- Latency: 0 Interrupt: pin A routed to IRQ 44 Region 0: Memory at f2600000 (32-bit, non-prefetchable) [size=128K] Region 1: Memory at f2625000 (32-bit, non-prefetchable) [size=4K] Region 2: I/O ports at 1840 [size=32] Capabilities: [c8] Power Management version 2 Flags: PMEClk- DSI+ D1- D2- AuxCurrent=0mA PME(D0+,D1-,D2-,D3hot+,D3cold+) Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=1 PME- Capabilities: [d0] MSI: Enable+ Count=1/1 Maskable- 64bit+ Address: 00000000fee0300c Data: 41b9 Capabilities: [e0] PCI Advanced Features AFCap: TP+ FLR+ AFCtrl: FLR- AFStatus: TP- Kernel driver in use: e1000e Kernel modules: e1000e
「Capabilities: [d0] MSI」の「Address」と「Data」の所ですが、これを前回説明したビットフィールドと突き合わせて読まないといけません。
分かりにくいですね。
なので、lspciを改造してわかり易く表示出来るようにしてみます。
早速実行してみます。
# gcc -lpci msireg.c # ./a.out 00:19.0 Message Signalled Interrupts: 64bit+ Queue=0/0 Enable+ address_hi=0 address_lo=fee0300c dest_mode=logical redirection=lowpri dest_id=3 data=41b9 trigger=edge level=assert delivery_mode=lowpri vector=185
Logical modeでLowpri、destid=3、vector=185になってるのが分かります。
ここでsmp_affinityを変えてみましょう。
# echo 1 > /proc/irq/44/smp_affinity # ./a.out 00:19.0 Message Signalled Interrupts: 64bit+ Queue=0/0 Enable+ address_hi=0 address_lo=fee0100c dest_mode=logical redirection=lowpri dest_id=1 data=41b9 trigger=edge level=assert delivery_mode=lowpri vector=185
dest_idが1に書き換わったのが見て取れます。
