'2014/02'에 해당하는 글 3건



NMI watchdog 을 이용한 커널 디버깅

출처 : http://www.imaso.co.kr/?doc=bbs/gnuboard.php&bo_table=article&wr_id=37626




커널 디버깅 kgdb

출처 : http://studyfoss.egloos.com/tag/gdb/page/2




WRITTEN BY
RootFriend
개인적으로... 나쁜 기억력에 도움되라고 만들게되었습니다.

,

cache disable

카테고리 없음 2014. 2. 16. 22:13

출처 : http://www.df.lth.se/~john_e/gems/gem000b.html

출처 : http://stackoverflow.com/questions/21265785/enable-disable-cache-on-intel-64bit-machine-cd-bit-always-set




My question is:

Is the CD bit(30bit) of CR0 register always set 1 when cache is disabled?

If not, there must be something wrong with my code, could you please help me point out the error I made?

ANSWER:

The above code only set the CD bit of the CR0 register on the core where the code is running. We need to use the smp_call_function() to call the code on all cores!


; Disable the Cache(s)
;
; input:
;   none
;
; output:
;   none
;
; destroys:
;   noting - (except switching flags)
;

CR0_CD  EQU     040000000h      ; Cache Disable bit of CR0
CR0_NW  EQU     020000000h      ; Not Write-through bit of CR0

        pushf                   ; save the flags
        push    eax             ; save eax
        cli                     ; disable interrupts while we do this
        mov     eax,cr0         ; read CR0
        or      eax,CR0_CD      ; set CD but not NW bit of CR0
        mov     cr0,eax         ; cache is now disabled
        wbinvd                  ; flush and invalidate cache

        ; the cache is effectively disabled at this point, but memory
        ; consistency will be maintained. To completely disable cache,
        ; the following two lines may used as well:

        or      eax,CR0_NW      ; now set the NW bit
        mov     cr0,eax         ; turn off the cache entirely
        pop     eax             ; restore eax
        popf                    ; restore the flags
        ret                     ; return to caller



WRITTEN BY
RootFriend
개인적으로... 나쁜 기억력에 도움되라고 만들게되었습니다.

,

출처 : http://benlimmer.com/2013/11/06/os-x-mavericks-arp-issue/


Maverick (10.9.x) 부터  인터넷연결이 잘안된다.


router 와 OS 사이의 문제같다.




Working Around Mac OS X Mavericks ARP Issue


At ReadyTalk, we recently uncovered an interesting issue related to how OS X Maverickshandles caching ARP responses.

On our corporate network, we have a floating Virtual IP Address to load balance the traffic on our subnets. In previous versions of OS X, if the OS couldn’t reach out and find the specified host, it would immediately send an ARP Request to find the machine and complete the request.

However, in Mavericks, we saw an issue where we would get a pattern of packet loss when pinging or SSHing to or from a Mavericks machine. It looked something like this:

ping blimmer
PING blimmer (192.168.x.x): 56 data bytes
64 bytes from 192.168.x.x: icmp_seq=0 ttl=62 time=87.337 ms
64 bytes from 192.168.x.x: icmp_seq=1 ttl=62 time=86.973 ms
64 bytes from 192.168.x.x: icmp_seq=2 ttl=62 time=86.651 ms
64 bytes from 192.168.x.x: icmp_seq=3 ttl=62 time=86.147 ms
64 bytes from 192.168.x.x: icmp_seq=4 ttl=62 time=86.103 ms
64 bytes from 192.168.x.x: icmp_seq=5 ttl=62 time=86.553 ms
64 bytes from 192.168.x.x: icmp_seq=15 ttl=62 time=89.345 ms
64 bytes from 192.168.x.x: icmp_seq=16 ttl=62 time=88.399 ms
64 bytes from 192.168.x.x: icmp_seq=17 ttl=62 time=88.005 ms
64 bytes from 192.168.x.x: icmp_seq=18 ttl=62 time=88.078 ms
64 bytes from 192.168.x.x: icmp_seq=19 ttl=62 time=86.651 ms
64 bytes from 192.168.x.x: icmp_seq=20 ttl=62 time=196.765 ms
64 bytes from 192.168.x.x: icmp_seq=21 ttl=62 time=87.073 ms
64 bytes from 192.168.x.x: icmp_seq=22 ttl=62 time=87.097 ms
64 bytes from 192.168.x.x: icmp_seq=23 ttl=62 time=87.913 ms
Request timeout for icmp_seq 16
Request timeout for icmp_seq 17
Request timeout for icmp_seq 18
Request timeout for icmp_seq 19
Request timeout for icmp_seq 20
64 bytes from 192.168.x.x: icmp_seq=21 ttl=62 time=87.073 ms
64 bytes from 192.168.x.x: icmp_seq=22 ttl=62 time=87.097 ms
64 bytes from 192.168.x.x: icmp_seq=23 ttl=62 time=87.913 ms

Notice the the packet loss. This was incredibly unfortunate when we would SSH to our machines and have to wait while the packets were retransmitted (causing at least a five second delay in transmission).

After some digging, we disocovered that other folks were having this issue, especially within corporate networks. We stumbled upon this Apple Support Forum post and discovered the fix.

Essentially, you need to tell OS X that it should reach out as soon as it couldn’t discover the host anymore. Poster Lunaweb graciously provided a workaround by setting a kernal parameter, specifically net.link.ether.inet.arp_unicast_lim=0

The folks over at MacMiniVault provided a script that fixes the issue by writing out an/etc/sysctl.conf file, which sets the kernal parameter on startup. Since we are confident that Apple will provide a fix in a coming update, we wanted a way to set this variable that did not survive a reboot.

So, I wrote a shell script that does just that. It sets the kernal parameter, but it does not survive a reboot.

For what it’s worth, Cisco has provided a fix for AnyConnect for Mac which also resolves the issue.

Hopefully the script written by myself (or MacMiniVault) helps other early adopters resolve obnoxious latency issues caused by Mavericks!



WRITTEN BY
RootFriend
개인적으로... 나쁜 기억력에 도움되라고 만들게되었습니다.

,