18 Nov, 2018

1 commit

  • We get the following warning:

    [ 47.926140] 32-bit node address hash set to 2010a0a
    [ 47.927202]
    [ 47.927433] ================================
    [ 47.928050] WARNING: inconsistent lock state
    [ 47.928661] 4.19.0+ #37 Tainted: G E
    [ 47.929346] --------------------------------
    [ 47.929954] inconsistent {SOFTIRQ-ON-W} -> {IN-SOFTIRQ-W} usage.
    [ 47.930116] swapper/3/0 [HC0[0]:SC1[3]:HE1:SE0] takes:
    [ 47.930116] 00000000af8bc31e (&(&ht->lock)->rlock){+.?.}, at: rhashtable_walk_enter+0x36/0xb0
    [ 47.930116] {SOFTIRQ-ON-W} state was registered at:
    [ 47.930116] _raw_spin_lock+0x29/0x60
    [ 47.930116] rht_deferred_worker+0x556/0x810
    [ 47.930116] process_one_work+0x1f5/0x540
    [ 47.930116] worker_thread+0x64/0x3e0
    [ 47.930116] kthread+0x112/0x150
    [ 47.930116] ret_from_fork+0x3a/0x50
    [ 47.930116] irq event stamp: 14044
    [ 47.930116] hardirqs last enabled at (14044): [] __local_bh_enable_ip+0x7a/0xf0
    [ 47.938117] hardirqs last disabled at (14043): [] __local_bh_enable_ip+0x41/0xf0
    [ 47.938117] softirqs last enabled at (14028): [] irq_enter+0x5e/0x60
    [ 47.938117] softirqs last disabled at (14029): [] irq_exit+0xb5/0xc0
    [ 47.938117]
    [ 47.938117] other info that might help us debug this:
    [ 47.938117] Possible unsafe locking scenario:
    [ 47.938117]
    [ 47.938117] CPU0
    [ 47.938117] ----
    [ 47.938117] lock(&(&ht->lock)->rlock);
    [ 47.938117]
    [ 47.938117] lock(&(&ht->lock)->rlock);
    [ 47.938117]
    [ 47.938117] *** DEADLOCK ***
    [ 47.938117]
    [ 47.938117] 2 locks held by swapper/3/0:
    [ 47.938117] #0: 0000000062c64f90 ((&d->timer)){+.-.}, at: call_timer_fn+0x5/0x280
    [ 47.938117] #1: 00000000ee39619c (&(&d->lock)->rlock){+.-.}, at: tipc_disc_timeout+0xc8/0x540 [tipc]
    [ 47.938117]
    [ 47.938117] stack backtrace:
    [ 47.938117] CPU: 3 PID: 0 Comm: swapper/3 Tainted: G E 4.19.0+ #37
    [ 47.938117] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
    [ 47.938117] Call Trace:
    [ 47.938117]
    [ 47.938117] dump_stack+0x5e/0x8b
    [ 47.938117] print_usage_bug+0x1ed/0x1ff
    [ 47.938117] mark_lock+0x5b5/0x630
    [ 47.938117] __lock_acquire+0x4c0/0x18f0
    [ 47.938117] ? lock_acquire+0xa6/0x180
    [ 47.938117] lock_acquire+0xa6/0x180
    [ 47.938117] ? rhashtable_walk_enter+0x36/0xb0
    [ 47.938117] _raw_spin_lock+0x29/0x60
    [ 47.938117] ? rhashtable_walk_enter+0x36/0xb0
    [ 47.938117] rhashtable_walk_enter+0x36/0xb0
    [ 47.938117] tipc_sk_reinit+0xb0/0x410 [tipc]
    [ 47.938117] ? mark_held_locks+0x6f/0x90
    [ 47.938117] ? __local_bh_enable_ip+0x7a/0xf0
    [ 47.938117] ? lockdep_hardirqs_on+0x20/0x1a0
    [ 47.938117] tipc_net_finalize+0xbf/0x180 [tipc]
    [ 47.938117] tipc_disc_timeout+0x509/0x540 [tipc]
    [ 47.938117] ? call_timer_fn+0x5/0x280
    [ 47.938117] ? tipc_disc_msg_xmit.isra.19+0xa0/0xa0 [tipc]
    [ 47.938117] ? tipc_disc_msg_xmit.isra.19+0xa0/0xa0 [tipc]
    [ 47.938117] call_timer_fn+0xa1/0x280
    [ 47.938117] ? tipc_disc_msg_xmit.isra.19+0xa0/0xa0 [tipc]
    [ 47.938117] run_timer_softirq+0x1f2/0x4d0
    [ 47.938117] __do_softirq+0xfc/0x413
    [ 47.938117] irq_exit+0xb5/0xc0
    [ 47.938117] smp_apic_timer_interrupt+0xac/0x210
    [ 47.938117] apic_timer_interrupt+0xf/0x20
    [ 47.938117]
    [ 47.938117] RIP: 0010:default_idle+0x1c/0x140
    [ 47.938117] Code: 90 90 90 90 90 90 90 90 90 90 90 90 90 90 0f 1f 44 00 00 41 54 55 53 65 8b 2d d8 2b 74 65 0f 1f 44 00 00 e8 c6 2c 8b ff fb f4 8b 2d c5 2b 74 65 0f 1f 44 00 00 5b 5d 41 5c c3 65 8b 05 b4 2b
    [ 47.938117] RSP: 0018:ffffaf6ac0207ec8 EFLAGS: 00000206 ORIG_RAX: ffffffffffffff13
    [ 47.938117] RAX: ffff8f5b3735e200 RBX: 0000000000000003 RCX: 0000000000000001
    [ 47.938117] RDX: 0000000000000001 RSI: 0000000000000001 RDI: ffff8f5b3735e200
    [ 47.938117] RBP: 0000000000000003 R08: 0000000000000001 R09: 0000000000000000
    [ 47.938117] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
    [ 47.938117] R13: 0000000000000000 R14: ffff8f5b3735e200 R15: ffff8f5b3735e200
    [ 47.938117] ? default_idle+0x1a/0x140
    [ 47.938117] do_idle+0x1bc/0x280
    [ 47.938117] cpu_startup_entry+0x19/0x20
    [ 47.938117] start_secondary+0x187/0x1c0
    [ 47.938117] secondary_startup_64+0xa4/0xb0

    The reason seems to be that tipc_net_finalize()->tipc_sk_reinit() is
    calling the function rhashtable_walk_enter() within a timer interrupt.
    We fix this by executing tipc_net_finalize() in work queue context.

    Acked-by: Ying Xue
    Signed-off-by: Jon Maloy
    Signed-off-by: David S. Miller

    Jon Maloy
     

24 Mar, 2018

2 commits

  • Selecting and explicitly configuring a TIPC node identity may be
    unwanted in some cases.

    In this commit we introduce a default setting if the identity has not
    been set at the moment the first bearer is enabled. We do this by
    using a raw copy of a unique identifier from the used interface: MAC
    address in the case of an L2 bearer, IPv4/IPv6 address in the case
    of a UDP bearer.

    Acked-by: Ying Xue
    Signed-off-by: Jon Maloy
    Signed-off-by: David S. Miller

    Jon Maloy
     
  • We add a 128-bit node identity, as an alternative to the currently used
    32-bit node address.

    For the sake of compatibility and to minimize message header changes
    we retain the existing 32-bit address field. When not set explicitly by
    the user, this field will be filled with a hash value generated from the
    much longer node identity, and be used as a shorthand value for the
    latter.

    We permit either the address or the identity to be set by configuration,
    but not both, so when the address value is set by a legacy user the
    corresponding 128-bit node identity is generated based on the that value.

    Acked-by: Ying Xue
    Signed-off-by: Jon Maloy
    Signed-off-by: David S. Miller

    Jon Maloy
     

15 Feb, 2018

1 commit


19 Aug, 2016

1 commit

  • Add TIPC_NL_PEER_REMOVE netlink command. This command can remove
    an offline peer node from the internal data structures.

    This will be supported by the tipc user space tool in iproute2.

    Signed-off-by: Richard Alpe
    Reviewed-by: Jon Maloy
    Acked-by: Ying Xue
    Signed-off-by: David S. Miller

    Richard Alpe
     

13 Jan, 2015

2 commits

  • Global variables associated with node table are below:
    - node table list (node_htable)
    - node hash table list (tipc_node_list)
    - node table lock (node_list_lock)
    - node number counter (tipc_num_nodes)
    - node link number counter (tipc_num_links)

    To make node table support namespace, above global variables must be
    moved to tipc_net structure in order to keep secret for different
    namespaces. As a consequence, these variables are allocated and
    initialized when namespace is created, and deallocated when namespace
    is destroyed. After the change, functions associated with these
    variables have to utilize a namespace pointer to access them. So
    adding namespace pointer as a parameter of these functions is the
    major change made in the commit.

    Signed-off-by: Ying Xue
    Tested-by: Tero Aho
    Reviewed-by: Jon Maloy
    Signed-off-by: David S. Miller

    Ying Xue
     
  • Involve namespace infrastructure, make the "tipc_net_id" global
    variable aware of per namespace, and rename it to "net_id". In
    order that the conversion can be successfully done, an instance
    of networking namespace must be passed to relevant functions,
    allowing them to access the "net_id" variable of per namespace.

    Signed-off-by: Ying Xue
    Tested-by: Tero Aho
    Reviewed-by: Jon Maloy
    Signed-off-by: David S. Miller

    Ying Xue
     

22 Nov, 2014

2 commits

  • Add TIPC_NL_NET_SET command to the new tipc netlink API.

    This command can set the network id and network (tipc) address.

    Netlink logical layout of network set message:
    -> net
    [ -> id ]
    [ -> address ]

    Signed-off-by: Richard Alpe
    Reviewed-by: Erik Hugne
    Reviewed-by: Jon Maloy
    Acked-by: Ying Xue
    Signed-off-by: David S. Miller

    Richard Alpe
     
  • Add TIPC_NL_NET_GET command to the new tipc netlink API.

    This command dumps the network id of the node.

    Netlink logical layout of returned network data:
    -> net
    -> id

    Signed-off-by: Richard Alpe
    Reviewed-by: Erik Hugne
    Reviewed-by: Jon Maloy
    Acked-by: Ying Xue
    Signed-off-by: David S. Miller

    Richard Alpe
     

28 Jun, 2014

1 commit

  • As a preparation to eliminate port_lock we need to bring reception
    of connection protocol messages under proper protection of bh_lock_sock
    or socket owner.

    We fix this by letting those messages follow the same code path as
    incoming data messages.

    As a side effect of this change, the last reference to the function
    net_route_msg() disappears, and we can eliminate that function.

    Signed-off-by: Jon Maloy
    Reviewed-by: Erik Hugne
    Reviewed-by: Ying Xue
    Signed-off-by: David S. Miller

    Jon Paul Maloy
     

06 May, 2014

1 commit


23 Apr, 2014

1 commit

  • Now tipc routing hierarchy comprises the structures 'node', 'link'and
    'bearer'. The whole hierarchy is protected by a big read/write lock,
    tipc_net_lock, to ensure that nothing is added or removed while code
    is accessing any of these structures. Obviously the locking policy
    makes node, link and bearer components closely bound together so that
    their relationship becomes unnecessarily complex. In the worst case,
    such locking policy not only has a negative influence on performance,
    but also it's prone to lead to deadlock occasionally.

    In order o decouple the complex relationship between bearer and node
    as well as link, the locking policy is adjusted as follows:

    - Bearer level
    RTNL lock is used on update side, and RCU is used on read side.
    Meanwhile, all bearer instances including broadcast bearer are
    saved into bearer_list array.

    - Node and link level
    All node instances are saved into two tipc_node_list and node_htable
    lists. The two lists are protected by node_list_lock on write side,
    and they are guarded with RCU lock on read side. All members in node
    structure including link instances are protected by node spin lock.

    - The relationship between bearer and node
    When link accesses bearer, it first needs to find the bearer with
    its bearer identity from the bearer_list array. When bearer accesses
    node, it can iterate the node_htable hash list with the node
    address to find the corresponding node.

    In the new locking policy, every component has its private locking
    solution and the relationship between bearer and node is very simple,
    that is, they can find each other with node address or bearer identity
    from node_htable hash list or bearer_list array.

    Until now above all changes have been done, so tipc_net_lock can be
    removed safely.

    Signed-off-by: Ying Xue
    Reviewed-by: Jon Maloy
    Reviewed-by: Erik Hugne
    Tested-by: Erik Hugne
    Signed-off-by: David S. Miller

    Ying Xue
     

20 Aug, 2012

1 commit

  • Since now tipc_net_start() always returns a success code - 0, its
    return value type should be changed from integer to void, which can
    avoid unnecessary check for its return value.

    Signed-off-by: Ying Xue
    Signed-off-by: Jon Maloy
    Signed-off-by: Paul Gortmaker
    Signed-off-by: David S. Miller

    Ying Xue
     

14 Mar, 2011

4 commits

  • Relocates network-related variables into the subsystem files where
    they are now primarily used (following the recent rework of TIPC's
    node table), and converts globals into locals where possible. Changes
    the initialization of tipc_num_links from run-time to compile-time,
    and eliminates the net_start routine that becomes empty as a result.
    Also eliminates the corresponding net_stop routine by moving its
    (trivial) content into the one location that called the routine.

    Signed-off-by: Allan Stephens
    Signed-off-by: Paul Gortmaker

    Allan Stephens
     
  • Replaces the dynamically allocated array of pointers to the cluster's
    node objects with a static hash table. Hash collisions are resolved
    using chaining, with a typical hash chain having only a single node,
    to avoid degrading performance during processing of incoming packets.
    The conversion to a hash table reduces the memory requirements for
    TIPC's node table to approximately the same size it had prior to
    the previous commit.

    In addition to the hash table itself, TIPC now also maintains a
    linked list for the node objects, sorted by ascending network address.
    This list allows TIPC to continue sending responses to user space
    applications that request node and link information in sorted order.
    The list also improves performance when name table update messages are
    sent by making it easier to identify the nodes that must be notified.

    Signed-off-by: Allan Stephens
    Signed-off-by: Paul Gortmaker

    Allan Stephens
     
  • Converts the fields of the global "tipc_net" structure into individual
    variables. Since the struct was never referenced as a complete unit,
    its existence was pointless. This will facilitate upcoming changes to
    TIPC's node table and simpify upcoming relocation of the variables so
    they are only visible to the files that actually use them.

    This change is essentially cosmetic in nature, and doesn't affect the
    operation of TIPC.

    Signed-off-by: Allan Stephens
    Signed-off-by: Paul Gortmaker

    Allan Stephens
     
  • Removes a race condition that could cause TIPC's internal counter
    of the number of links it has to neighboring nodes to have the
    incorrect value if two independent threads of control simultaneously
    create new link endpoints connecting to two different nodes using two
    different bearers. Such under counting would result in TIPC failing to
    list the final link(s) in its response to a configuration request to
    list all of the node's links. The counter is now updated atomically
    to ensure that simultaneous increments do not interfere with each
    other.

    Thanks go to Peter Butler for his assistance in
    diagnosing and fixing this problem.

    Signed-off-by: Allan Stephens
    Signed-off-by: Paul Gortmaker

    Allan Stephens
     

02 Jan, 2011

3 commits

  • Eliminates routines, data structures, and files that were intended
    to allow TIPC to support a network containing multiple clusters.
    Currently, TIPC supports only networks consisting of a single cluster
    within a single zone, so this code is unnecessary.

    Signed-off-by: Allan Stephens
    Signed-off-by: Paul Gortmaker
    Signed-off-by: David S. Miller

    Allan Stephens
     
  • Eliminates routines and data structures that were intended to allow
    TIPC to route messages to other clusters. Currently, TIPC supports only
    networks consisting of a single cluster within a single zone, so this
    code is unnecessary.

    Signed-off-by: Allan Stephens
    Signed-off-by: Paul Gortmaker
    Signed-off-by: David S. Miller

    Allan Stephens
     
  • Eliminates routines, data structures, and files that were intended
    to allows TIPC to support a network containing multiple zones.
    Currently, TIPC supports only networks consisting of a single cluster
    within a single zone, so this code is unnecessary.

    Signed-off-by: Allan Stephens
    Signed-off-by: Paul Gortmaker
    Signed-off-by: David S. Miller

    Allan Stephens
     

03 Sep, 2008

1 commit


22 May, 2008

1 commit

  • This patch ensures that TIPC's topology service and configuration
    service are shut down before switching into "network mode". This
    ensures that TIPC does not mistakenly try to send unnecessary
    "publication withdraw" messages to other nodes before it is fully
    initialized for sending off-node messages. Note that the node's
    current network address is now updated only after the two services
    are shut down; this ensures that any existing connections to the
    topology server are terminated correctly using the old address.

    Signed-off-by: Allan Stephens
    Signed-off-by: David S. Miller

    Allan Stephens
     

11 Feb, 2007

1 commit


18 Jan, 2006

1 commit


13 Jan, 2006

4 commits