1. 09 12月, 2022 2 次提交
    • M
      ice: Remove the E822 vernier "bypass" logic · 0357d5ca
      Milena Olech 提交于
      The E822 devices support an extended "vernier" calibration which enables
      higher precision timestamps by accounting for delays in the PHY, and
      compensating for them. These delays are measured by hardware as part of its
      vernier calibration logic.
      
      The driver currently starts the PHY in "bypass" mode which skips
      the compensation. Then it later attempts to switch from bypass to vernier.
      This unfortunately does not work as expected. Instead of properly
      compensating for the delays, the hardware continues operating in bypass
      without the improved precision expected.
      
      Because we cannot dynamically switch between bypass and vernier mode,
      refactor the driver to always operate in vernier mode. This has a slight
      downside: Tx timestamp and Rx timestamp requests that occur as the very
      first packet set after link up will not complete properly and may be
      reported to applications as missing timestamps.
      
      This occurs frequently in test environments where traffic is light or
      targeted specifically at testing PTP. However, in practice most
      environments will have transmitted or received some data over the network
      before such initial requests are made.
      Signed-off-by: NMilena Olech <milena.olech@intel.com>
      Signed-off-by: NJacob Keller <jacob.e.keller@intel.com>
      Tested-by: Gurucharan G <gurucharanx.g@intel.com> (A Contingent worker at Intel)
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      0357d5ca
    • S
      ice: Use more generic names for ice_ptp_tx fields · 6b5cbc8c
      Sergey Temerkhanov 提交于
      Some supported devices have per-port timestamp memory blocks while
      others have shared ones within quads. Rename the struct ice_ptp_tx
      fields to reflect the block entities it works with
      Signed-off-by: NSergey Temerkhanov <sergey.temerkhanov@intel.com>
      Tested-by: Gurucharan G <gurucharanx.g@intel.com> (A Contingent worker at Intel)
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      6b5cbc8c
  2. 22 11月, 2022 1 次提交
    • J
      ice: fix handling of burst Tx timestamps · 30f15874
      Jacob Keller 提交于
      Commit 1229b339 ("ice: Add low latency Tx timestamp read") refactored
      PTP timestamping logic to use a threaded IRQ instead of a separate kthread.
      
      This implementation introduced ice_misc_intr_thread_fn and redefined the
      ice_ptp_process_ts function interface to return a value of whether or not
      the timestamp processing was complete.
      
      ice_misc_intr_thread_fn would take the return value from ice_ptp_process_ts
      and convert it into either IRQ_HANDLED if there were no more timestamps to
      be processed, or IRQ_WAKE_THREAD if the thread should continue processing.
      
      This is not correct, as the kernel does not re-schedule threaded IRQ
      functions automatically. IRQ_WAKE_THREAD can only be used by the main IRQ
      function.
      
      This results in the ice_ptp_process_ts function (and in turn the
      ice_ptp_tx_tstamp function) from only being called exactly once per
      interrupt.
      
      If an application sends a burst of Tx timestamps without waiting for a
      response, the interrupt will trigger for the first timestamp. However,
      later timestamps may not have arrived yet. This can result in dropped or
      discarded timestamps. Worse, on E822 hardware this results in the interrupt
      logic getting stuck such that no future interrupts will be triggered. The
      result is complete loss of Tx timestamp functionality.
      
      Fix this by modifying the ice_misc_intr_thread_fn to perform its own
      polling of the ice_ptp_process_ts function. We sleep for a few microseconds
      between attempts to avoid wasting significant CPU time. The value was
      chosen to allow time for the Tx timestamps to complete without wasting so
      much time that we overrun application wait budgets in the worst case.
      
      The ice_ptp_process_ts function also currently returns false in the event
      that the Tx tracker is not initialized. This would result in the threaded
      IRQ handler never exiting if it gets started while the tracker is not
      initialized.
      
      Fix the function to appropriately return true when the tracker is not
      initialized.
      
      Note that this will not reproduce with default ptp4l behavior, as the
      program always synchronously waits for a timestamp response before sending
      another timestamp request.
      Reported-by: NSiddaraju DH <siddaraju.dh@intel.com>
      Fixes: 1229b339 ("ice: Add low latency Tx timestamp read")
      Signed-off-by: NJacob Keller <jacob.e.keller@intel.com>
      Tested-by: Gurucharan G <gurucharanx.g@intel.com> (A Contingent worker at Intel)
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      Link: https://lore.kernel.org/r/20221118222729.1565317-1-anthony.l.nguyen@intel.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      30f15874
  3. 31 10月, 2022 1 次提交
    • J
      ptp: introduce helpers to adjust by scaled parts per million · 1060707e
      Jacob Keller 提交于
      Many drivers implement the .adjfreq or .adjfine PTP op function with the
      same basic logic:
      
        1. Determine a base frequency value
        2. Multiply this by the abs() of the requested adjustment, then divide by
           the appropriate divisor (1 billion, or 65,536 billion).
        3. Add or subtract this difference from the base frequency to calculate a
           new adjustment.
      
      A few drivers need the difference and direction rather than the combined
      new increment value.
      
      I recently converted the Intel drivers to .adjfine and the scaled parts per
      million (65.536 parts per billion) logic. To avoid overflow with minimal
      loss of precision, mul_u64_u64_div_u64 was used.
      
      The basic logic used by all of these drivers is very similar, and leads to
      a lot of duplicate code to perform the same task.
      
      Rather than keep this duplicate code, introduce diff_by_scaled_ppm and
      adjust_by_scaled_ppm. These helper functions calculate the difference or
      adjustment necessary based on the scaled parts per million input.
      
      The diff_by_scaled_ppm function returns true if the difference should be
      subtracted, and false otherwise.
      
      Update the Intel drivers to use the new helper functions. Other vendor
      drivers will be converted to .adjfine and this helper function in the
      following changes.
      Signed-off-by: NJacob Keller <jacob.e.keller@intel.com>
      Acked-by: NRichard Cochran <richardcochran@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      1060707e
  4. 29 9月, 2022 1 次提交
  5. 21 9月, 2022 1 次提交
  6. 07 9月, 2022 1 次提交
  7. 17 8月, 2022 4 次提交
    • J
      ice: introduce ice_ptp_reset_cached_phctime function · b1a582e6
      Jacob Keller 提交于
      If the PTP hardware clock is adjusted, the ice driver must update the
      cached PHC timestamp. This is required in order to perform timestamp
      extension on the shorter timestamps captured by the PHY.
      
      Currently, we simply call ice_ptp_update_cached_phctime in the settime and
      adjtime callbacks. This has a few issues:
      
      1) if ICE_CFG_BUSY is set because another thread is updating the Rx rings,
         we will exit with an error. This is not checked, and the functions do
         not re-schedule the update. This could leave the cached timestamp
         incorrect until the next scheduled work item execution.
      
      2) even if we did handle an update, any currently outstanding Tx timestamp
         would be extended using the wrong cached PHC time. This would produce
         incorrect results.
      
      To fix these issues, introduce a new ice_ptp_reset_cached_phctime function.
      This function calls the ice_ptp_update_cached_phctime, and discards
      outstanding Tx timestamps.
      
      If the ice_ptp_update_cached_phctime function fails because ICE_CFG_BUSY is
      set, we log a warning and schedule the thread to execute soon. The update
      function is modified so that it always updates the cached copy in the PF
      regardless. This ensures we have the most up to date values possible and
      minimizes the risk of a packet timestamp being extended with the wrong
      value.
      
      It would be nice if we could skip reporting Rx timestamps until the cached
      values are up to date. However, we can't access the Rx rings while
      ICE_CFG_BUSY is set because they are actively being updated by another
      thread.
      Signed-off-by: NJacob Keller <jacob.e.keller@intel.com>
      Tested-by: Gurucharan <gurucharanx.g@intel.com> (A Contingent worker at Intel)
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      b1a582e6
    • J
      ice: re-arrange some static functions in ice_ptp.c · 4b1251bd
      Jacob Keller 提交于
      A following change is going to want to make use of ice_ptp_flush_tx_tracker
      earlier in the ice_ptp.c file. To make this work, move the Tx timestamp
      tracking functions higher up in the file, and pull the
      ice_ptp_update_cached_timestamp function below them. This should have no
      functional change.
      Signed-off-by: NJacob Keller <jacob.e.keller@intel.com>
      Tested-by: Gurucharan <gurucharanx.g@intel.com> (A Contingent worker at Intel)
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      4b1251bd
    • J
      ice: track and warn when PHC update is late · cd25507a
      Jacob Keller 提交于
      The ice driver requires a cached copy of the PHC time in order to perform
      timestamp extension on Tx and Rx hardware timestamp values. This cached PHC
      time must always be updated at least once every 2 seconds. Otherwise, the
      math used to perform the extension would produce invalid results.
      
      The updates are supposed to occur periodically in the PTP kthread work
      item, which is scheduled to run every half second. Thus, we do not expect
      an update to be delayed for so long. However, there are error conditions
      which can cause the update to be delayed.
      
      Track this situation by using jiffies to determine approximately how long
      ago the last update occurred. Add a new statistic and a dev_warn when we
      have failed to update the cached PHC time. This makes the error case more
      obvious.
      Signed-off-by: NJacob Keller <jacob.e.keller@intel.com>
      Tested-by: Gurucharan <gurucharanx.g@intel.com> (A Contingent worker at Intel)
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      cd25507a
    • J
      ice: track Tx timestamp stats similar to other Intel drivers · f020481b
      Jacob Keller 提交于
      Several Intel networking drivers which support PTP track when Tx timestamps
      are skipped or when they timeout without a timestamp from hardware. The
      conditions which could cause these events are rare, but it can be useful to
      know when and how often they occur.
      
      Implement similar statistics for the ice driver, tx_hwtstamp_skipped,
      tx_hwtstamp_timeouts, and tx_hwtstamp_flushed.
      Signed-off-by: NJacob Keller <jacob.e.keller@intel.com>
      Tested-by: Gurucharan <gurucharanx.g@intel.com> (A Contingent worker at Intel)
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      f020481b
  8. 29 7月, 2022 1 次提交
    • J
      ice: implement adjfine with mul_u64_u64_div_u64 · 4488df14
      Jacob Keller 提交于
      The PTP frequency adjustment code needs to determine an appropriate
      adjustment given an input scaled_ppm adjustment.
      
      We calculate the adjustment to the register by multiplying the base
      (nominal) increment value by the scaled_ppm and then dividing by the
      scaled one million value.
      
      For very large adjustments, this might overflow. To avoid this, both the
      scaled_ppm and divisor values are downshifted.
      
      We can avoid that on X86 architectures by using mul_u64_u64_div_u64. This
      helper function will perform the multiplication and division with 128bit
      intermediate values. We know that scaled_ppm is never larger than the
      divisor so this operation will never result in an overflow.
      
      This improves the accuracy of the calculations for large adjustment values
      on X86. It is likely an improvement on other architectures as well because
      the default implementation of mul_u64_u64_div_u64 is smarter than the
      original approach taken in the ice code.
      
      Additionally, this implementation is easier to read, using fewer local
      variables and lines of code to implement.
      Signed-off-by: NJacob Keller <jacob.e.keller@intel.com>
      Tested-by: Gurucharan <gurucharanx.g@intel.com> (A Contingent worker at Intel)
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      4488df14
  9. 16 7月, 2022 1 次提交
  10. 15 6月, 2022 1 次提交
    • M
      ice: Fix PTP TX timestamp offset calculation · 71a579f0
      Michal Michalik 提交于
      The offset was being incorrectly calculated for E822 - that led to
      collisions in choosing TX timestamp register location when more than
      one port was trying to use timestamping mechanism.
      
      In E822 one quad is being logically split between ports, so quad 0 is
      having trackers for ports 0-3, quad 1 ports 4-7 etc. Each port should
      have separate memory location for tracking timestamps. Due to error for
      example ports 1 and 2 had been assigned to quad 0 with same offset (0),
      while port 1 should have offset 0 and 1 offset 16.
      
      Fix it by correctly calculating quad offset.
      
      Fixes: 3a749623 ("ice: implement basic E822 PTP support")
      Signed-off-by: NMichal Michalik <michal.michalik@intel.com>
      Tested-by: Gurucharan <gurucharanx.g@intel.com> (A Contingent worker at Intel)
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      71a579f0
  11. 18 5月, 2022 1 次提交
    • A
      ice: fix crash when writing timestamp on RX rings · 4503cc7f
      Arkadiusz Kubalewski 提交于
      Do not allow to write timestamps on RX rings if PF is being configured.
      When PF is being configured RX rings can be freed or rebuilt. If at the
      same time timestamps are updated, the kernel will crash by dereferencing
      null RX ring pointer.
      
      PID: 1449   TASK: ff187d28ed658040  CPU: 34  COMMAND: "ice-ptp-0000:51"
       #0 [ff1966a94a713bb0] machine_kexec at ffffffff9d05a0be
       #1 [ff1966a94a713c08] __crash_kexec at ffffffff9d192e9d
       #2 [ff1966a94a713cd0] crash_kexec at ffffffff9d1941bd
       #3 [ff1966a94a713ce8] oops_end at ffffffff9d01bd54
       #4 [ff1966a94a713d08] no_context at ffffffff9d06bda4
       #5 [ff1966a94a713d60] __bad_area_nosemaphore at ffffffff9d06c10c
       #6 [ff1966a94a713da8] do_page_fault at ffffffff9d06cae4
       #7 [ff1966a94a713de0] page_fault at ffffffff9da0107e
          [exception RIP: ice_ptp_update_cached_phctime+91]
          RIP: ffffffffc076db8b  RSP: ff1966a94a713e98  RFLAGS: 00010246
          RAX: 16e3db9c6b7ccae4  RBX: ff187d269dd3c180  RCX: ff187d269cd4d018
          RDX: 0000000000000000  RSI: 0000000000000000  RDI: 0000000000000000
          RBP: ff187d269cfcc644   R8: ff187d339b9641b0   R9: 0000000000000000
          R10: 0000000000000002  R11: 0000000000000000  R12: ff187d269cfcc648
          R13: ffffffff9f128784  R14: ffffffff9d101b70  R15: ff187d269cfcc640
          ORIG_RAX: ffffffffffffffff  CS: 0010  SS: 0018
       #8 [ff1966a94a713ea0] ice_ptp_periodic_work at ffffffffc076dbef [ice]
       #9 [ff1966a94a713ee0] kthread_worker_fn at ffffffff9d101c1b
       #10 [ff1966a94a713f10] kthread at ffffffff9d101b4d
       #11 [ff1966a94a713f50] ret_from_fork at ffffffff9da0023f
      
      Fixes: 77a78115 ("ice: enable receive hardware timestamping")
      Signed-off-by: NArkadiusz Kubalewski <arkadiusz.kubalewski@intel.com>
      Reviewed-by: NMichal Schmidt <mschmidt@redhat.com>
      Tested-by: NDave Cain <dcain@redhat.com>
      Tested-by: Gurucharan <gurucharanx.g@intel.com> (A Contingent worker at Intel)
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      4503cc7f
  12. 07 5月, 2022 1 次提交
  13. 17 3月, 2022 1 次提交
    • J
      ice: add trace events for tx timestamps · 4c120218
      Jacob Keller 提交于
      We've previously run into many issues related to the latency of a Tx
      timestamp completion with the ice hardware. It can be difficult to
      determine the root cause of a slow Tx timestamp. To aid in this,
      introduce new trace events which capture timing data about when the
      driver reaches certain points while processing a transmit timestamp
      
       * ice_tx_tstamp_request: Trace when the stack initiates a new timestamp
         request.
      
       * ice_tx_tstamp_fw_req: Trace when the driver begins a read of the
         timestamp register in the work thread.
      
       * ice_tx_tstamp_fw_done: Trace when the driver finishes reading a
         timestamp register in the work thread.
      
       * ice_tx_tstamp_complete: Trace when the driver submits the skb back to
         the stack with a completed Tx timestamp.
      
      These trace events can be enabled using the standard trace event
      subsystem exposed by the ice driver. If they are disabled, they become
      no-ops with no run time cost.
      
      The following is a simple GNU AWK script which can highlight one
      potential way to use the trace events to capture latency data from the
      trace buffer about how long the driver takes to process a timestamp:
      
      -----
        BEGIN {
            PREC=256
        }
      
        # Detect requests
        /tx_tstamp_request/ {
            time=strtonum($4)
            skb=$7
      
            # Store the time of request for this skb
            requests[skb] = time
            printf("skb %s: idx %d at %.6f\n", skb, idx, time)
        }
      
        # Detect completions
        /tx_tstamp_complete/ {
            time=strtonum($4)
            skb=$7
            idx=$9
      
            if (skb in requests) {
                latency = (time - requests[skb]) * 1000
                printf("skb %s: %.3f to complete\n", skb, latency)
                if (latency > 4) {
                    printf(">>> HIGH LATENCY <<<\n")
                }
                printf("\n")
            } else {
                printf("!!! skb %s (idx %d) at %.6f\n", skb, idx, time)
            }
        }
      -----
      Signed-off-by: NJacob Keller <jacob.e.keller@intel.com>
      Tested-by: Gurucharan <gurucharanx.g@intel.com> (A Contingent worker at Intel)
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      4c120218
  14. 19 2月, 2022 1 次提交
    • T
      ice: check the return of ice_ptp_gettimex64 · ed22d9c8
      Tom Rix 提交于
      Clang static analysis reports this issue
      time64.h:69:50: warning: The left operand of '+'
        is a garbage value
        set_normalized_timespec64(&ts_delta, lhs.tv_sec + rhs.tv_sec,
                                             ~~~~~~~~~~ ^
      In ice_ptp_adjtime_nonatomic(), the timespec64 variable 'now'
      is set by ice_ptp_gettimex64().  This function can fail
      with -EBUSY, so 'now' can have a gargbage value.
      So check the return.
      
      Fixes: 06c16d89 ("ice: register 1588 PTP clock device object for E810 devices")
      Signed-off-by: NTom Rix <trix@redhat.com>
      Tested-by: Gurucharan G <gurucharanx.g@intel.com> (A Contingent worker at Intel)
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      ed22d9c8
  15. 07 1月, 2022 1 次提交
  16. 22 12月, 2021 7 次提交
  17. 15 12月, 2021 2 次提交
  18. 14 12月, 2021 1 次提交
    • H
      net_tstamp: add new flag HWTSTAMP_FLAG_BONDED_PHC_INDEX · 9c9211a3
      Hangbin Liu 提交于
      Since commit 94dd016a ("bond: pass get_ts_info and SIOC[SG]HWTSTAMP
      ioctl to active device") the user could get bond active interface's
      PHC index directly. But when there is a failover, the bond active
      interface will change, thus the PHC index is also changed. This may
      break the user's program if they did not update the PHC timely.
      
      This patch adds a new hwtstamp_config flag HWTSTAMP_FLAG_BONDED_PHC_INDEX.
      When the user wants to get the bond active interface's PHC, they need to
      add this flag and be aware the PHC index may be changed.
      
      With the new flag. All flag checks in current drivers are removed. Only
      the checking in net_hwtstamp_validate() is kept.
      Suggested-by: NJakub Kicinski <kuba@kernel.org>
      Signed-off-by: NHangbin Liu <liuhangbin@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      9c9211a3
  19. 26 10月, 2021 1 次提交
    • Y
      ice: check whether PTP is initialized in ice_ptp_release() · fd1b5beb
      Yongxin Liu 提交于
      PTP is currently only supported on E810 devices, it is checked
      in ice_ptp_init(). However, there is no check in ice_ptp_release().
      For other E800 series devices, ice_ptp_release() will be wrongly executed.
      
      Fix the following calltrace.
      
        INFO: trying to register non-static key.
        The code is fine but needs lockdep annotation, or maybe
        you didn't initialize this object before use?
        turning off the locking correctness validator.
        Workqueue: ice ice_service_task [ice]
        Call Trace:
         dump_stack_lvl+0x5b/0x82
         dump_stack+0x10/0x12
         register_lock_class+0x495/0x4a0
         ? find_held_lock+0x3c/0xb0
         __lock_acquire+0x71/0x1830
         lock_acquire+0x1e6/0x330
         ? ice_ptp_release+0x3c/0x1e0 [ice]
         ? _raw_spin_lock+0x19/0x70
         ? ice_ptp_release+0x3c/0x1e0 [ice]
         _raw_spin_lock+0x38/0x70
         ? ice_ptp_release+0x3c/0x1e0 [ice]
         ice_ptp_release+0x3c/0x1e0 [ice]
         ice_prepare_for_reset+0xcb/0xe0 [ice]
         ice_do_reset+0x38/0x110 [ice]
         ice_service_task+0x138/0xf10 [ice]
         ? __this_cpu_preempt_check+0x13/0x20
         process_one_work+0x26a/0x650
         worker_thread+0x3f/0x3b0
         ? __kthread_parkme+0x51/0xb0
         ? process_one_work+0x650/0x650
         kthread+0x161/0x190
         ? set_kthread_struct+0x40/0x40
         ret_from_fork+0x1f/0x30
      
      Fixes: 4dd0d5c3 ("ice: add lock around Tx timestamp tracker flush")
      Signed-off-by: NYongxin Liu <yongxin.liu@windriver.com>
      Reviewed-by: NJacob Keller <jacob.e.keller@intel.com>
      Tested-by: NGurucharan G <gurucharanx.g@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      fd1b5beb
  20. 15 10月, 2021 1 次提交
    • M
      ice: split ice_ring onto Tx/Rx separate structs · e72bba21
      Maciej Fijalkowski 提交于
      While it was convenient to have a generic ring structure that served
      both Tx and Rx sides, next commits are going to introduce several
      Tx-specific fields, so in order to avoid hurting the Rx side, let's
      pull out the Tx ring onto new ice_tx_ring and ice_rx_ring structs.
      
      Rx ring could be handled by the old ice_ring which would reduce the code
      churn within this patch, but this would make things asymmetric.
      
      Make the union out of the ring container within ice_q_vector so that it
      is possible to iterate over newly introduced ice_tx_ring.
      
      Remove the @size as it's only accessed from control path and it can be
      calculated pretty easily.
      
      Change definitions of ice_update_ring_stats and
      ice_fetch_u64_stats_per_ring so that they are ring agnostic and can be
      used for both Rx and Tx rings.
      
      Sizes of Rx and Tx ring structs are 256 and 192 bytes, respectively. In
      Rx ring xdp_rxq_info occupies its own cacheline, so it's the major
      difference now.
      Signed-off-by: NMaciej Fijalkowski <maciej.fijalkowski@intel.com>
      Tested-by: NGurucharan G <gurucharanx.g@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      e72bba21
  21. 14 10月, 2021 1 次提交
  22. 12 10月, 2021 1 次提交
    • J
      ice: fix locking for Tx timestamp tracking flush · 4d4a223a
      Jacob Keller 提交于
      Commit 4dd0d5c3 ("ice: add lock around Tx timestamp tracker flush")
      added a lock around the Tx timestamp tracker flow which is used to
      cleanup any left over SKBs and prepare for device removal.
      
      This lock is problematic because it is being held around a call to
      ice_clear_phy_tstamp. The clear function takes a mutex to send a PHY
      write command to firmware. This could lead to a deadlock if the mutex
      actually sleeps, and causes the following warning on a kernel with
      preemption debugging enabled:
      
      [  715.419426] BUG: sleeping function called from invalid context at kernel/locking/mutex.c:573
      [  715.427900] in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 3100, name: rmmod
      [  715.435652] INFO: lockdep is turned off.
      [  715.439591] Preemption disabled at:
      [  715.439594] [<0000000000000000>] 0x0
      [  715.446678] CPU: 52 PID: 3100 Comm: rmmod Tainted: G        W  OE     5.15.0-rc4+ #42 bdd7ec3018e725f159ca0d372ce8c2c0e784891c
      [  715.458058] Hardware name: Intel Corporation S2600STQ/S2600STQ, BIOS SE5C620.86B.02.01.0010.010620200716 01/06/2020
      [  715.468483] Call Trace:
      [  715.470940]  dump_stack_lvl+0x6a/0x9a
      [  715.474613]  ___might_sleep.cold+0x224/0x26a
      [  715.478895]  __mutex_lock+0xb3/0x1440
      [  715.482569]  ? stack_depot_save+0x378/0x500
      [  715.486763]  ? ice_sq_send_cmd+0x78/0x14c0 [ice 9a7e1ec00971c89ecd3fe0d4dc7da2b3786a421d]
      [  715.494979]  ? kfree+0xc1/0x520
      [  715.498128]  ? mutex_lock_io_nested+0x12a0/0x12a0
      [  715.502837]  ? kasan_set_free_info+0x20/0x30
      [  715.507110]  ? __kasan_slab_free+0x10b/0x140
      [  715.511385]  ? slab_free_freelist_hook+0xc7/0x220
      [  715.516092]  ? kfree+0xc1/0x520
      [  715.519235]  ? ice_deinit_lag+0x16c/0x220 [ice 9a7e1ec00971c89ecd3fe0d4dc7da2b3786a421d]
      [  715.527359]  ? ice_remove+0x1cf/0x6a0 [ice 9a7e1ec00971c89ecd3fe0d4dc7da2b3786a421d]
      [  715.535133]  ? pci_device_remove+0xab/0x1d0
      [  715.539318]  ? __device_release_driver+0x35b/0x690
      [  715.544110]  ? driver_detach+0x214/0x2f0
      [  715.548035]  ? bus_remove_driver+0x11d/0x2f0
      [  715.552309]  ? pci_unregister_driver+0x26/0x250
      [  715.556840]  ? ice_module_exit+0xc/0x2f [ice 9a7e1ec00971c89ecd3fe0d4dc7da2b3786a421d]
      [  715.564799]  ? __do_sys_delete_module.constprop.0+0x2d8/0x4e0
      [  715.570554]  ? do_syscall_64+0x3b/0x90
      [  715.574303]  ? entry_SYSCALL_64_after_hwframe+0x44/0xae
      [  715.579529]  ? start_flush_work+0x542/0x8f0
      [  715.583719]  ? ice_sq_send_cmd+0x78/0x14c0 [ice 9a7e1ec00971c89ecd3fe0d4dc7da2b3786a421d]
      [  715.591923]  ice_sq_send_cmd+0x78/0x14c0 [ice 9a7e1ec00971c89ecd3fe0d4dc7da2b3786a421d]
      [  715.599960]  ? wait_for_completion_io+0x250/0x250
      [  715.604662]  ? lock_acquire+0x196/0x200
      [  715.608504]  ? do_raw_spin_trylock+0xa5/0x160
      [  715.612864]  ice_sbq_rw_reg+0x1e6/0x2f0 [ice 9a7e1ec00971c89ecd3fe0d4dc7da2b3786a421d]
      [  715.620813]  ? ice_reset+0x130/0x130 [ice 9a7e1ec00971c89ecd3fe0d4dc7da2b3786a421d]
      [  715.628497]  ? __debug_check_no_obj_freed+0x1e8/0x3c0
      [  715.633550]  ? trace_hardirqs_on+0x1c/0x130
      [  715.637748]  ice_write_phy_reg_e810+0x70/0xf0 [ice 9a7e1ec00971c89ecd3fe0d4dc7da2b3786a421d]
      [  715.646220]  ? do_raw_spin_trylock+0xa5/0x160
      [  715.650581]  ? ice_ptp_release+0x910/0x910 [ice 9a7e1ec00971c89ecd3fe0d4dc7da2b3786a421d]
      [  715.658797]  ? ice_ptp_release+0x255/0x910 [ice 9a7e1ec00971c89ecd3fe0d4dc7da2b3786a421d]
      [  715.667013]  ice_clear_phy_tstamp+0x2c/0x110 [ice 9a7e1ec00971c89ecd3fe0d4dc7da2b3786a421d]
      [  715.675403]  ice_ptp_release+0x408/0x910 [ice 9a7e1ec00971c89ecd3fe0d4dc7da2b3786a421d]
      [  715.683440]  ice_remove+0x560/0x6a0 [ice 9a7e1ec00971c89ecd3fe0d4dc7da2b3786a421d]
      [  715.691037]  ? _raw_spin_unlock_irqrestore+0x46/0x73
      [  715.696005]  pci_device_remove+0xab/0x1d0
      [  715.700018]  __device_release_driver+0x35b/0x690
      [  715.704637]  driver_detach+0x214/0x2f0
      [  715.708389]  bus_remove_driver+0x11d/0x2f0
      [  715.712489]  pci_unregister_driver+0x26/0x250
      [  715.716857]  ice_module_exit+0xc/0x2f [ice 9a7e1ec00971c89ecd3fe0d4dc7da2b3786a421d]
      [  715.724637]  __do_sys_delete_module.constprop.0+0x2d8/0x4e0
      [  715.730210]  ? free_module+0x6d0/0x6d0
      [  715.733963]  ? task_work_run+0xe1/0x170
      [  715.737803]  ? exit_to_user_mode_loop+0x17f/0x1d0
      [  715.742509]  ? rcu_read_lock_sched_held+0x12/0x80
      [  715.747215]  ? trace_hardirqs_on+0x1c/0x130
      [  715.751401]  do_syscall_64+0x3b/0x90
      [  715.754981]  entry_SYSCALL_64_after_hwframe+0x44/0xae
      [  715.760033] RIP: 0033:0x7f4dfe59000b
      [  715.763612] Code: 73 01 c3 48 8b 0d 6d 1e 0c 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa b8 b0 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 3d 1e 0c 00 f7 d8 64 89 01 48
      [  715.782357] RSP: 002b:00007ffe8c891708 EFLAGS: 00000206 ORIG_RAX: 00000000000000b0
      [  715.789923] RAX: ffffffffffffffda RBX: 00005558a20468b0 RCX: 00007f4dfe59000b
      [  715.797054] RDX: 000000000000000a RSI: 0000000000000800 RDI: 00005558a2046918
      [  715.804189] RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
      [  715.811319] R10: 00007f4dfe603ac0 R11: 0000000000000206 R12: 00007ffe8c891940
      [  715.818455] R13: 00007ffe8c8920a3 R14: 00005558a20462a0 R15: 00005558a20468b0
      
      Notice that this is the only case where we use the lock in this way. In
      the cleanup kthread and work kthread the lock is only taken around the
      bit accesses. This was done intentionally to avoid this kind of issue.
      The way the lock is used, we only protect ordering of bit sets vs bit
      clears. The Tx writers in the hot path don't need to be protected
      against the entire kthread loop. The Tx queues threads only need to
      ensure that they do not re-use an index that is currently in use. The
      cleanup loop does not need to block all new set bits, since it will
      re-queue itself if new timestamps are present.
      
      Fix the tracker flow so that it uses the same flow as the standard
      cleanup thread. In addition, ensure the in_use bitmap actually gets
      cleared properly.
      
      This fixes the warning and also avoids the potential deadlock that might
      have occurred otherwise.
      
      Fixes: 4dd0d5c3 ("ice: add lock around Tx timestamp tracker flush")
      Signed-off-by: NJacob Keller <jacob.e.keller@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      4d4a223a
  23. 28 8月, 2021 3 次提交
  24. 27 8月, 2021 1 次提交
  25. 14 8月, 2021 1 次提交
  26. 26 6月, 2021 1 次提交
  27. 18 6月, 2021 1 次提交