1. 05 5月, 2020 1 次提交
  2. 02 5月, 2020 1 次提交
    • J
      devlink: fix return value after hitting end in region read · 610a9346
      Jakub Kicinski 提交于
      Commit d5b90e99 ("devlink: report 0 after hitting end in region read")
      fixed region dump, but region read still returns a spurious error:
      
      $ devlink region read netdevsim/netdevsim1/dummy snapshot 0 addr 0 len 128
      0000000000000000 a6 f4 c4 1c 21 35 95 a6 9d 34 c3 5b 87 5b 35 79
      0000000000000010 f3 a0 d7 ee 4f 2f 82 7f c6 dd c4 f6 a5 c3 1b ae
      0000000000000020 a4 fd c8 62 07 59 48 03 70 3b c7 09 86 88 7f 68
      0000000000000030 6f 45 5d 6d 7d 0e 16 38 a9 d0 7a 4b 1e 1e 2e a6
      0000000000000040 e6 1d ae 06 d6 18 00 85 ca 62 e8 7e 11 7e f6 0f
      0000000000000050 79 7e f7 0f f3 94 68 bd e6 40 22 85 b6 be 6f b1
      0000000000000060 af db ef 5e 34 f0 98 4b 62 9a e3 1b 8b 93 fc 17
      devlink answers: Invalid argument
      0000000000000070 61 e8 11 11 66 10 a5 f7 b1 ea 8d 40 60 53 ed 12
      
      This is a minimal fix, I'll follow up with a restructuring
      so we don't have two checks for the same condition.
      
      Fixes: fdd41ec2 ("devlink: Return right error code in case of errors for region read")
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      Reviewed-by: NJacob Keller <jacob.e.keller@intel.com>
      Reviewed-by: NJiri Pirko <jiri@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      610a9346
  3. 31 3月, 2020 6 次提交
  4. 27 3月, 2020 9 次提交
  5. 26 3月, 2020 1 次提交
    • P
      devlink: Rely on driver eswitch thread safety instead of devlink · 98fed6eb
      Parav Pandit 提交于
      devlink_nl_cmd_eswitch_set_doit() doesn't hold devlink->lock mutex while
      invoking driver callback. This is likely due to eswitch mode setting
      involves adding/remove devlink ports, health reporters or
      other devlink objects for a devlink device.
      
      So it is driver responsiblity to ensure thread safe eswitch state
      transition happening via either sriov legacy enablement or via devlink
      eswitch set callback.
      
      Therefore, get() callback should also be invoked without holding
      devlink->lock mutex.
      Vendor driver can use same internal lock which it uses during eswitch
      mode set() callback.
      This makes get() and set() implimentation symmetric in devlink core and
      in vendor drivers.
      
      Hence, remove holding devlink->lock mutex during eswitch get() callback.
      
      Failing to do so results into below deadlock scenario when mlx5_core
      driver is improved to handle eswitch mode set critical section invoked
      by devlink and sriov sysfs interface in subsequent patch.
      
      devlink_nl_cmd_eswitch_set_doit()
         mlx5_eswitch_mode_set()
           mutex_lock(esw->mode_lock) <- Lock A
           [...]
           register_devlink_port()
             mutex_lock(&devlink->lock); <- lock B
      
      mutex_lock(&devlink->lock); <- lock B
      devlink_nl_cmd_eswitch_get_doit()
         mlx5_eswitch_mode_get()
         mutex_lock(esw->mode_lock) <- Lock A
      
      In subsequent patch, mlx5_core driver uses its internal lock during
      get() and set() eswitch callbacks.
      
      Other drivers have been inspected which returns either constant during
      get operations or reads the value from already allocated structure.
      Hence it is safe to remove the lock in get( ) callback and let vendor
      driver handle it.
      Reviewed-by: NJiri Pirko <jiri@mellanox.com>
      Reviewed-by: NMark Bloch <markb@mellanox.com>
      Signed-off-by: NParav Pandit <parav@mellanox.com>
      Signed-off-by: NSaeed Mahameed <saeedm@mellanox.com>
      98fed6eb
  6. 24 3月, 2020 3 次提交
  7. 04 3月, 2020 3 次提交
  8. 29 2月, 2020 1 次提交
  9. 27 2月, 2020 1 次提交
  10. 26 2月, 2020 2 次提交
  11. 25 2月, 2020 1 次提交
  12. 24 2月, 2020 1 次提交
  13. 19 2月, 2020 1 次提交
  14. 05 2月, 2020 1 次提交
    • J
      devlink: report 0 after hitting end in region read · d5b90e99
      Jacob Keller 提交于
      commit fdd41ec2 ("devlink: Return right error code in case of errors
      for region read") modified the region read code to report errors
      properly in unexpected cases.
      
      In the case where the start_offset and ret_offset match, it unilaterally
      converted this into an error. This causes an issue for the "dump"
      version of the command. In this case, the devlink region dump will
      always report an invalid argument:
      
      000000000000ffd0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
      000000000000ffe0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
      devlink answers: Invalid argument
      000000000000fff0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
      
      This occurs because the expected flow for the dump is to return 0 after
      there is no further data.
      
      The simplest fix would be to stop converting the error code to -EINVAL
      if start_offset == ret_offset. However, avoid unnecessary work by
      checking for when start_offset is larger than the region size and
      returning 0 upfront.
      
      Fixes: fdd41ec2 ("devlink: Return right error code in case of errors for region read")
      Signed-off-by: NJacob Keller <jacob.e.keller@intel.com>
      Acked-by: NJiri Pirko <jiri@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d5b90e99
  15. 25 1月, 2020 1 次提交
  16. 19 1月, 2020 3 次提交
  17. 12 1月, 2020 1 次提交
  18. 11 1月, 2020 1 次提交
    • I
      devlink: Wait longer before warning about unset port type · 4c582234
      Ido Schimmel 提交于
      The commit cited below causes devlink to emit a warning if a type was
      not set on a devlink port for longer than 30 seconds to "prevent
      misbehavior of drivers". This proved to be problematic when
      unregistering the backing netdev. The flow is always:
      
      devlink_port_type_clear()	// schedules the warning
      unregister_netdev()		// blocking
      devlink_port_unregister()	// cancels the warning
      
      The call to unregister_netdev() can block for long periods of time for
      various reasons: RTNL lock is contended, large amounts of configuration
      to unroll following dismantle of the netdev, etc. This results in
      devlink emitting a warning despite the driver behaving correctly.
      
      In emulated environments (of future hardware) which are usually very
      slow, the warning can also be emitted during port creation as more than
      30 seconds can pass between the time the devlink port is registered and
      when its type is set.
      
      In addition, syzbot has hit this warning [1] 1974 times since 07/11/19
      without being able to produce a reproducer. Probably because
      reproduction depends on the load or other bugs (e.g., RTNL not being
      released).
      
      To prevent bogus warnings, increase the timeout to 1 hour.
      
      [1] https://syzkaller.appspot.com/bug?id=e99b59e9c024a666c9f7450dc162a4b74d09d9cb
      
      Fixes: 136bf27f ("devlink: add warning in case driver does not set port type")
      Signed-off-by: NIdo Schimmel <idosch@mellanox.com>
      Reported-by: syzbot+b0a18ed7b08b735d2f41@syzkaller.appspotmail.com
      Reported-by: NAlex Veber <alexve@mellanox.com>
      Tested-by: NAlex Veber <alexve@mellanox.com>
      Acked-by: NJiri Pirko <jiri@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      4c582234
  19. 09 1月, 2020 2 次提交