Re: panic in sctp_del_addr_from_vrf() ?

From: Andrey Smagin <samspeed_at_mail.ru>
Date: Wed, 08 May 2013 09:57:13 +0400
I tried by analogy your patch add _padalign in all places where was before r250300, and in stcp. Uptime now 15hours, before - 5min - 3hour max. I waiting for more statistic.
my changes:
Index: sys/netinet/tcp_subr.c
===================================================================
--- sys/netinet/tcp_subr.c      (revision 250330)
+++ sys/netinet/tcp_subr.c      (working copy)
_at__at_ -255,7 +255,7 @@
 #define        V_tcpcb_zone                    VNET(tcpcb_zone)

 MALLOC_DEFINE(M_TCPLOG, "tcplog", "TCP address and flags print buffers");
-static struct mtx isn_mtx;
+static struct mtx_padalign isn_mtx;

 #define        ISN_LOCK_INIT() mtx_init(&isn_mtx, "isn_mtx", NULL, MTX_DEF)
 #define        ISN_LOCK()      mtx_lock(&isn_mtx)
Index: sys/netinet/in_pcb.h
===================================================================
--- sys/netinet/in_pcb.h        (revision 250330)
+++ sys/netinet/in_pcb.h        (working copy)
_at__at_ -330,7 +330,7 _at__at_
        /*
         * Global lock protecting non-pcbgroup hash lookup tables.
         */
-       struct rwlock            ipi_hash_lock;
+       struct rwlock_padalign           ipi_hash_lock;

        /*
         * Global hash of inpcbs, hashed by local and foreign addresses and
Index: sys/netinet/in_var.h
===================================================================
--- sys/netinet/in_var.h        (revision 250330)
+++ sys/netinet/in_var.h        (working copy)
_at__at_ -116,7 +116,7 @@
 #define INADDR_HASH(x) \
        (&V_in_ifaddrhashtbl[INADDR_HASHVAL(x) & V_in_ifaddrhmask])

-extern struct rwlock in_ifaddr_lock;
+extern struct rwlock_padalign in_ifaddr_lock;

 #define        IN_IFADDR_LOCK_ASSERT() rw_assert(&in_ifaddr_lock, RA_LOCKED)
 #define        IN_IFADDR_RLOCK()       rw_rlock(&in_ifaddr_lock)
Index: sys/netinet/sctp_pcb.h
===================================================================
--- sys/netinet/sctp_pcb.h      (revision 250330)
+++ sys/netinet/sctp_pcb.h      (working copy)
_at__at_ -193,11 +193,11 @@
        sctp_zone_t ipi_zone_asconf;
        sctp_zone_t ipi_zone_asconf_ack;

-       struct rwlock ipi_ep_mtx;
-       struct mtx ipi_iterator_wq_mtx;
-       struct rwlock ipi_addr_mtx;
-       struct mtx ipi_pktlog_mtx;
-       struct mtx wq_addr_mtx;
+       struct rwlock_padalign ipi_ep_mtx;
+       struct mtx_padalign ipi_iterator_wq_mtx;
+       struct rwlock_padalign ipi_addr_mtx;
+       struct mtx_padalign ipi_pktlog_mtx;
+       struct mtx_padalign wq_addr_mtx;
        uint32_t ipi_count_ep;

        /* assoc/tcb zone info */
Index: sys/netinet/ip_id.c
===================================================================
--- sys/netinet/ip_id.c (revision 250330)
+++ sys/netinet/ip_id.c (working copy)
_at__at_ -97,7 +97,7 _at__at_
 static int              array_size = 8192;
 static int              random_id_collisions = 0;
 static int              random_id_total = 0;
-static struct mtx       ip_id_mtx;
+static struct mtx_padalign      ip_id_mtx;

 static void    ip_initid(void);
 static int     sysctl_ip_id_change(SYSCTL_HANDLER_ARGS);
Index: sys/netinet/ip_input.c
===================================================================
--- sys/netinet/ip_input.c      (revision 250330)
+++ sys/netinet/ip_input.c      (working copy)
_at__at_ -85,7 +85,7 _at__at_
 CTASSERT(sizeof(struct ip) == 20);
 #endif

-struct rwlock in_ifaddr_lock;
+struct rwlock_padalign in_ifaddr_lock;
 RW_SYSINIT(in_ifaddr_lock, &in_ifaddr_lock, "in_ifaddr_lock");

 VNET_DEFINE(int, rsvp_on);
_at__at_ -155,7 +155,7 _at__at_

 static VNET_DEFINE(uma_zone_t, ipq_zone);
 static VNET_DEFINE(TAILQ_HEAD(ipqhead, ipq), ipq[IPREASS_NHASH]);
-static struct mtx ipqlock;
+static struct mtx_padalign ipqlock;

 #define        V_ipq_zone              VNET(ipq_zone)
 #define        V_ipq                   VNET(ipq)
Index: sys/sys/socketvar.h
===================================================================
--- sys/sys/socketvar.h (revision 250330)
+++ sys/sys/socketvar.h (working copy)
_at__at_ -133,7 +133,7 _at__at_
  * avoid defining a lock order between listen and accept sockets
  * until such time as it proves to be a good idea.
  */
-extern struct mtx accept_mtx;
+extern struct mtx_padalign accept_mtx;
 #define        ACCEPT_LOCK_ASSERT()            mtx_assert(&accept_mtx, MA_OWNED)
 #define        ACCEPT_UNLOCK_ASSERT()          mtx_assert(&accept_mtx, MA_NOTOWNED)
 #define        ACCEPT_LOCK()                   mtx_lock(&accept_mtx)
Index: sys/kern/uipc_socket.c
===================================================================
--- sys/kern/uipc_socket.c      (revision 250330)
+++ sys/kern/uipc_socket.c      (working copy)
_at__at_ -240,14 +240,14 @@
  * accept_mtx locks down per-socket fields relating to accept queues.  See
  * socketvar.h for an annotation of the protected fields of struct socket.
  */
-struct mtx accept_mtx;
+struct mtx_padalign accept_mtx;
 MTX_SYSINIT(accept_mtx, &accept_mtx, "accept", MTX_DEF);

 /*
  * so_global_mtx protects so_gencnt, numopensockets, and the per-socket
  * so_gencnt field.
  */
-static struct mtx so_global_mtx;
+static struct mtx_padalign so_global_mtx;
 MTX_SYSINIT(so_global_mtx, &so_global_mtx, "so_glabel", MTX_DEF);

 /*
Index: sys/net/if.c
===================================================================
--- sys/net/if.c        (revision 250330)
+++ sys/net/if.c        (working copy)
_at__at_ -206,7 +206,7 @@
  * also to stablize it over long-running ioctls, without introducing priority
  * inversions and deadlocks.
  */
-struct rwlock ifnet_rwlock;
+struct rwlock_padalign ifnet_rwlock;
 struct sx ifnet_sxlock;

 /*
Index: sys/net/if_var.h
===================================================================
--- sys/net/if_var.h    (revision 250330)
+++ sys/net/if_var.h    (working copy)
_at__at_ -191,9 +191,9 _at__at_
        void    *if_unused[2];
        void    *if_afdata[AF_MAX];
        int     if_afdata_initialized;
-       struct  rwlock if_afdata_lock;
+       struct  rwlock_padalign if_afdata_lock;
        struct  task if_linktask;       /* task for link change events */
-       struct  rwlock if_addr_lock;    /* lock to protect address lists */
+       struct  rwlock_padalign if_addr_lock;   /* lock to protect address lists */

        LIST_ENTRY(ifnet) if_clones;    /* interfaces of a cloner */
        TAILQ_HEAD(, ifg_list) if_groups; /* linked list of groups per if */
_at__at_ -832,7 +832,7 _at__at_

 #ifdef _KERNEL

-extern struct rwlock ifnet_rwlock;
+extern struct rwlock_padalign ifnet_rwlock;
 extern struct sx ifnet_sxlock;

 #define        IFNET_LOCK_INIT() do {                                          \
Index: sys/net/if_llatbl.c
===================================================================
--- sys/net/if_llatbl.c (revision 250330)
+++ sys/net/if_llatbl.c (working copy)
_at__at_ -67,7 +67,7 _at__at_

 static void vnet_lltable_init(void);

-struct rwlock lltable_rwlock;
+struct rwlock_padalign lltable_rwlock;
 RW_SYSINIT(lltable_rwlock, &lltable_rwlock, "lltable_rwlock");

 /*
Index: sys/net/if_llatbl.h
===================================================================
--- sys/net/if_llatbl.h (revision 250330)
+++ sys/net/if_llatbl.h (working copy)
_at__at_ -43,7 +43,7 _at__at_
 struct llentry;
 LIST_HEAD(llentries, llentry);

-extern struct rwlock lltable_rwlock;
+extern struct rwlock_padalign lltable_rwlock;
 #define        LLTABLE_RLOCK()         rw_rlock(&lltable_rwlock)
 #define        LLTABLE_RUNLOCK()       rw_runlock(&lltable_rwlock)
 #define        LLTABLE_WLOCK()         rw_wlock(&lltable_rwlock)




Понедельник,  6 мая 2013, 20:50 -07:00 от kit <ktsin_at_acm.org>:
>ah, it's should be fixed now as per r250300. changes that caused this panic have been backed out.
>
>kit
>
>--- On Tue, 5/7/13, kit < ktsin_at_acm.org > wrote:
>
>From: kit < ktsin_at_acm.org >
>Subject: Re: panic in sctp_del_addr_from_vrf() ?
>To: "Andrey Smagin" < samspeed_at_mail.ru >,  freebsd-current_at_freebsd.org
>Date: Tuesday, May 7, 2013, 8:59 AM
>
>not sure why. for my case, padaligining one of the rwlocks solved it.
>you may want to try the patch attached and see if it works for you.
>
>anyway, i'm filing a PR if nobody has done so already.
>
>thanks
>kit
>
>On Sat, May 04, 2013 at 09:22:23PM +0400, Andrey Smagin wrote:
>>  
>> I have panic like your but in sctp_add_addr_to_vrf. I think need PR.  My panic screenshoot  http://vvtlan.ru/panic1.jpg and second one  http://vvtlan.ru/panic2.jpg
>> 
>> Суббота,  4 мая 2013, 20:55 +08:00 от kit < ktsin_at_acm.org >:
>> > 
>> got this panic when network interfaces were being unconfigured during
>> system shutdown. has anyone seen this? should i file a PR?
>> 
>> thanks
>> kit
>> 
>> test.yahoo.com dumped core - see /home/crash/vmcore.2
>> 
>> Sat May  4 20:43:55 MYT 2013
>> 
>> FreeBSD test.yahoo.com 10.0-CURRENT FreeBSD 10.0-CURRENT #0 r250229: Sat May  4 20:30:17 MYT 2013     ktsin_at_test.yahoo.com:/tmp/obj/usr/src/sys/SHUTTLE  amd64
>> 
>> panic: page fault
>> 
>> GNU gdb 6.1.1 [FreeBSD]
>> Copyright 2004 Free Software Foundation, Inc.
>> GDB is free software, covered by the GNU General Public License, and you are
>> welcome to change it and/or distribute copies of it under certain conditions.
>> Type "show copying" to see the conditions.
>> There is absolutely no warranty for GDB.  Type "show warranty" for details.
>> This GDB was configured as "amd64-marcel-freebsd"...
>> 
>> Unread portion of the kernel message buffer:
>> .
>> <118>Writing entropy file:.
>> <118>.
>> <118>Terminated
>> <118>May  4 20:42:00 test syslogd: exiting on signal 15
>> 
>> Fatal trap 12: page fault while in kernel mode
>> cpuid = 4; apic id = 04
>> fault virtual address   = 0x8c
>> fault code              = supervisor read data, page not present
>> instruction pointer     = 0x20:0xffffffff8066e71c
>> stack pointer           = 0x28:0xffffff82187fb5d0
>> frame pointer           = 0x28:0xffffff82187fb620
>> code segment            = base 0x0, limit 0xfffff, type 0x1b
>>                         = DPL 0, pres 1, long 1, def32 0, gran 1
>> processor eflags        = interrupt enabled, resume, IOPL = 0
>> current process         = 474 (wpa_supplicant)
>> trap number             = 12
>> panic: page fault
>> cpuid = 4
>> KDB: stack backtrace:
>> db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xffffff82187fb190
>> kdb_backtrace() at kdb_backtrace+0x39/frame 0xffffff82187fb240
>> panic() at panic+0x155/frame 0xffffff82187fb2c0
>> trap_fatal() at trap_fatal+0x37a/frame 0xffffff82187fb320
>> trap_pfault() at trap_pfault+0x257/frame 0xffffff82187fb3c0
>> trap() at trap+0x43a/frame 0xffffff82187fb510
>> calltrap() at calltrap+0x8/frame 0xffffff82187fb510
>> --- trap 0xc, rip = 0xffffffff8066e71c, rsp = 0xffffff82187fb5d0, rbp = 0xffffff82187fb620 ---
>> sctp_del_addr_from_vrf() at sctp_del_addr_from_vrf+0x7c/frame 0xffffff82187fb620
>> rt_newaddrmsg_fib() at rt_newaddrmsg_fib+0x44/frame 0xffffff82187fb6e0
>> rtinit1() at rtinit1+0x57b/frame 0xffffff82187fb860
>> in_scrubprefix() at in_scrubprefix+0x376/frame 0xffffff82187fb900
>> rip_ctlinput() at rip_ctlinput+0x143/frame 0xffffff82187fb930
>> pfctlinput() at pfctlinput+0x5c/frame 0xffffff82187fb960
>> ifioctl() at ifioctl+0x7f2/frame 0xffffff82187fba20
>> kern_ioctl() at kern_ioctl+0x22e/frame 0xffffff82187fba90
>> sys_ioctl() at sys_ioctl+0x142/frame 0xffffff82187fbae0
>> amd64_syscall() at amd64_syscall+0x2b4/frame 0xffffff82187fbbf0
>> Xfast_syscall() at Xfast_syscall+0xfb/frame 0xffffff82187fbbf0
>> --- syscall (54, FreeBSD ELF64, sys_ioctl), rip = 0x80122c26a, rsp = 0x7fffffffdb18, rbp = 0x7fffffffdb90 ---
>> Uptime: 4m55s
>> 
>> _______________________________________________
>>  freebsd-current_at_freebsd.org mailing list
>>  http://lists.freebsd.org/mailman/listinfo/freebsd-current
>> To unsubscribe, send any mail to "freebsd-current-unsubscribe_at_freebsd.org"
>> > 
>> 
>> Отправлено из мобильной Почты Mail.Ru
>_______________________________________________
>freebsd-current_at_freebsd.org mailing list
>http://lists.freebsd.org/mailman/listinfo/freebsd-current
>To unsubscribe, send any mail to "freebsd-current-unsubscribe_at_freebsd.org"
Received on Wed May 08 2013 - 03:57:25 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:37 UTC