Skip to content
Snippets Groups Projects
  1. Sep 20, 2022
  2. Sep 16, 2022
  3. Sep 12, 2022
  4. Sep 07, 2022
  5. Sep 06, 2022
    • Randy Dunlap's avatar
      drm/scheduler: quieten kernel-doc warnings · f8ad757e
      Randy Dunlap authored
      
      Fix kernel-doc warnings in gpu_scheduler.h and sched_main.c.
      
      Quashes these warnings:
      
      include/drm/gpu_scheduler.h:332: warning: missing initial short description on line:
       * struct drm_sched_backend_ops
      include/drm/gpu_scheduler.h:412: warning: missing initial short description on line:
       * struct drm_gpu_scheduler
      include/drm/gpu_scheduler.h:461: warning: Function parameter or member 'dev' not described in 'drm_gpu_scheduler'
      
      drivers/gpu/drm/scheduler/sched_main.c:201: warning: missing initial short description on line:
       * drm_sched_dependency_optimized
      drivers/gpu/drm/scheduler/sched_main.c:995: warning: Function parameter or member 'dev' not described in 'drm_sched_init'
      
      Fixes: 2d33948e ("drm/scheduler: add documentation")
      Fixes: 8ab62eda ("drm/sched: Add device pointer to drm_gpu_scheduler")
      Fixes: 542cff78 ("drm/sched: Avoid lockdep spalt on killing a processes")
      Signed-off-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Cc: David Airlie <airlied@linux.ie>
      Cc: Daniel Vetter <daniel@ffwll.ch>
      Cc: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
      Cc: Nayan Deshmukh <nayan26deshmukh@gmail.com>
      Cc: Alex Deucher <alexander.deucher@amd.com>
      Cc: Christian König <christian.koenig@amd.com>
      Cc: Jiawei Gu <Jiawei.Gu@amd.com>
      Cc: dri-devel@lists.freedesktop.org
      Acked-by: default avatarChristian König <christian.koenig@amd.com>
      Signed-off-by: default avatarAndrey Grodzovsky <andrey.grodzovsky@amd.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20220404213040.12912-1-rdunlap@infradead.org
      f8ad757e
  6. Sep 05, 2022
  7. Sep 04, 2022
  8. Sep 03, 2022
  9. Sep 02, 2022
    • Hans de Goede's avatar
      ACPI: video: Make backlight class device registration a separate step (v2) · 3dbc80a3
      Hans de Goede authored
      On x86/ACPI boards the acpi_video driver will usually initialize before
      the kms driver (except i915). This causes /sys/class/backlight/acpi_video0
      to show up and then the kms driver registers its own native backlight
      device after which the drivers/acpi/video_detect.c code unregisters
      the acpi_video0 device (when acpi_video_get_backlight_type()==native).
      
      This means that userspace briefly sees 2 devices and the disappearing of
      acpi_video0 after a brief time confuses the systemd backlight level
      save/restore code, see e.g.:
      https://bbs.archlinux.org/viewtopic.php?id=269920
      
      
      
      To fix this make backlight class device registration a separate step
      done by a new acpi_video_register_backlight() function. The intend is for
      this to be called by the drm/kms driver *after* it is done setting up its
      own native backlight device. So that acpi_video_get_backlight_type() knows
      if a native backlight will be available or not at acpi_video backlight
      registration time, avoiding the add + remove dance.
      
      Note the new acpi_video_register_backlight() function is also called from
      a delayed work to ensure that the acpi_video backlight devices does get
      registered if necessary even if there is no drm/kms driver or when it is
      disabled.
      
      Changes in v2:
      - Make register_backlight_delay a module parameter, mainly so that it can
        be disabled by Nvidia binary driver users
      
      Acked-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      3dbc80a3
  10. Aug 30, 2022
  11. Aug 23, 2022
    • Lyude Paul's avatar
      drm/display/dp_mst: Move all payload info into the atomic state · 4d07b0bc
      Lyude Paul authored
      
      Now that we've finally gotten rid of the non-atomic MST users leftover in
      the kernel, we can finally get rid of all of the legacy payload code we
      have and move as much as possible into the MST atomic state structs. The
      main purpose of this is to make the MST code a lot less confusing to work
      on, as there's a lot of duplicated logic that doesn't really need to be
      here. As well, this should make introducing features like fallback link
      retraining and DSC support far easier.
      
      Since the old payload code was pretty gnarly and there's a Lot of changes
      here, I expect this might be a bit difficult to review. So to make things
      as easy as possible for reviewers, I'll sum up how both the old and new
      code worked here (it took me a while to figure this out too!).
      
      The old MST code basically worked by maintaining two different payload
      tables - proposed_vcpis, and payloads. proposed_vcpis would hold the
      modified payload we wanted to push to the topology, while payloads held the
      payload table that was currently programmed in hardware. Modifications to
      proposed_vcpis would be handled through drm_dp_allocate_vcpi(),
      drm_dp_mst_deallocate_vcpi(), and drm_dp_mst_reset_vcpi_slots(). Then, they
      would be pushed via drm_dp_mst_update_payload_step1() and
      drm_dp_mst_update_payload_step2().
      
      Furthermore, it's important to note how adding and removing VC payloads
      actually worked with drm_dp_mst_update_payload_step1(). When a VC payload
      is removed from the VC table, all VC payloads which come after the removed
      VC payload's slots must have their time slots shifted towards the start of
      the table. The old code handles this by looping through the entire payload
      table and recomputing the start slot for every payload in the topology from
      scratch. While very much overkill, this ends up doing the right thing
      because we always order the VCPIs for payloads from first to last starting
      timeslot.
      
      It's important to also note that drm_dp_mst_update_payload_step2() isn't
      actually limited to updating a single payload - the driver can use it to
      queue up multiple payload changes so that as many of them can be sent as
      possible before waiting for the ACT. This is -technically- not against
      spec, but as Wayne Lin has pointed out it's not consistently implemented
      correctly in hubs - so it might as well be.
      
      drm_dp_mst_update_payload_step2() is pretty self explanatory and basically
      the same between the old and new code, save for the fact we don't have a
      second step for deleting payloads anymore -and thus rename it to
      drm_dp_mst_add_payload_step2().
      
      The new payload code stores all of the current payload info within the MST
      atomic state and computes as much of the state as possible ahead of time.
      This has the one exception of the starting timeslots for payloads, which
      can't be determined at atomic check time since the starting time slots will
      vary depending on what order CRTCs are enabled in the atomic state - which
      varies from driver to driver. These are still stored in the atomic MST
      state, but are only copied from the old MST state during atomic commit
      time. Likewise, this is when new start slots are determined.
      
      Adding/removing payloads now works much more closely to how things are
      described in the spec. When we delete a payload, we loop through the
      current list of payloads and update the start slots for any payloads whose
      time slots came after the payload we just deleted. Determining the starting
      time slots for new payloads being added is done by simply keeping track of
      where the end of the VC table is in
      drm_dp_mst_topology_mgr->next_start_slot. Additionally, it's worth noting
      that we no longer have a single update_payload() function. Instead, we now
      have drm_dp_mst_add_payload_step1|2() and drm_dp_mst_remove_payload(). As
      such, it's now left it up to the driver to figure out when to add or remove
      payloads. The driver already knows when it's disabling/enabling CRTCs, so
      it also already knows when payloads should be added or removed.
      
      Changes since v1:
      * Refactor around all of the completely dead code changes that are
        happening in amdgpu for some reason when they really shouldn't even be
        there in the first place… :\
      * Remove mention of sending one ACT per series of payload updates. As Wayne
        Lin pointed out, there are apparently hubs on the market that don't work
        correctly with this scheme and require a separate ACT per payload update.
      * Fix accidental drop of mst_mgr.lock - Wayne Lin
      * Remove mentions of allowing multiple ACT updates per payload change,
        mention that this is a result of vendors not consistently supporting this
        part of the spec and requiring a unique ACT for each payload change.
      * Get rid of reference to drm_dp_mst_port in DC - turns out I just got
        myself confused by DC and we don't actually need this.
      Changes since v2:
      * Get rid of fix for not sending payload deallocations if ddps=0 and just
        go back to wayne's fix
      
      Signed-off-by: default avatarLyude Paul <lyude@redhat.com>
      Cc: Wayne Lin <Wayne.Lin@amd.com>
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Cc: Fangzhi Zuo <Jerry.Zuo@amd.com>
      Cc: Jani Nikula <jani.nikula@intel.com>
      Cc: Imre Deak <imre.deak@intel.com>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: Sean Paul <sean@poorly.run>
      Acked-by: default avatarJani Nikula <jani.nikula@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20220817193847.557945-18-lyude@redhat.com
      4d07b0bc
    • Lyude Paul's avatar
      drm/display/dp_mst: Maintain time slot allocations when deleting payloads · 6366fc70
      Lyude Paul authored
      
      Currently, we set drm_dp_atomic_payload->time_slots to 0 in order to
      indicate that we're about to delete a payload in the current atomic state.
      Since we're going to be dropping all of the legacy code for handling the
      payload table however, we need to be able to ensure that we still keep
      track of the current time slot allocations for each payload so we can reuse
      this info when asking the root MST hub to delete payloads. We'll also be
      using it to recalculate the start slots of each VC.
      
      So, let's keep track of the intent of a payload in drm_dp_atomic_payload by
      adding ->delete, which we set whenever we're planning on deleting a payload
      during the current atomic commit.
      
      Signed-off-by: default avatarLyude Paul <lyude@redhat.com>
      Cc: Wayne Lin <Wayne.Lin@amd.com>
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Cc: Fangzhi Zuo <Jerry.Zuo@amd.com>
      Cc: Jani Nikula <jani.nikula@intel.com>
      Cc: Imre Deak <imre.deak@intel.com>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: Sean Paul <sean@poorly.run>
      Acked-by: default avatarJani Nikula <jani.nikula@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20220817193847.557945-16-lyude@redhat.com
      6366fc70
    • Lyude Paul's avatar
      drm/display/dp_mst: Add helpers for serializing SST <-> MST transitions · a76eb429
      Lyude Paul authored
      
      There's another kind of situation where we could potentially race with
      nonblocking modesets and MST, especially if we were to only use the locking
      provided by atomic modesetting:
      
      * Display 1 begins as enabled on DP-1 in SST mode
      * Display 1 switches to MST mode, exposes one sink in MST mode
      * Userspace does non-blocking modeset to disable the SST display
      * Userspace does non-blocking modeset to enable the MST display with a
        different CRTC, but the SST display hasn't been fully taken down yet
      * Execution order between the last two commits isn't guaranteed since they
        share no drm resources
      
      We can fix this however, by ensuring that we always pull in the atomic
      topology state whenever a connector capable of driving an MST display
      performs its atomic check - and then tracking CRTC commits happening on the
      SST connector in the MST topology state. So, let's add some simple helpers
      for doing that and hook them up in various drivers.
      
      v2:
      * Use intel_dp_mst_source_support() to check for MST support in i915, fixes
        CI failures
      
      Signed-off-by: default avatarLyude Paul <lyude@redhat.com>
      Cc: Wayne Lin <Wayne.Lin@amd.com>
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Cc: Fangzhi Zuo <Jerry.Zuo@amd.com>
      Cc: Jani Nikula <jani.nikula@intel.com>
      Cc: Imre Deak <imre.deak@intel.com>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: Sean Paul <sean@poorly.run>
      Acked-by: default avatarJani Nikula <jani.nikula@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20220817193847.557945-14-lyude@redhat.com
      a76eb429
    • Lyude Paul's avatar
      drm/display/dp_mst: Add nonblocking helpers for DP MST · a5c2c0d1
      Lyude Paul authored
      
      As Daniel Vetter pointed out, if we only use the atomic modesetting locks
      with MST it's technically possible for a driver with non-blocking modesets
      to race when it comes to MST displays - as we make the mistake of not doing
      our own CRTC commit tracking in the topology_state object.
      
      This could potentially cause problems if something like this happens:
      
      * User starts non-blocking commit to disable CRTC-1 on MST topology 1
      * User starts non-blocking commit to enable CRTC-2 on MST topology 1
      
      There's no guarantee here that the commit for disabling CRTC-2 will only
      occur after CRTC-1 has finished, since neither commit shares a CRTC - only
      the private modesetting object for MST. Keep in mind this likely isn't a
      problem for blocking modesets, only non-blocking.
      
      So, begin fixing this by keeping track of which CRTCs on a topology have
      changed by keeping track of which CRTCs we release or allocate timeslots
      on. As well, add some helpers for:
      
      * Setting up the drm_crtc_commit structs in the ->commit_setup hook
      * Waiting for any CRTC dependencies from the previous topology state
      
      v2:
      * Use drm_dp_mst_atomic_setup_commit() directly - Jani
      
      Signed-off-by: default avatarLyude Paul <lyude@redhat.com>
      Cc: Wayne Lin <Wayne.Lin@amd.com>
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Cc: Fangzhi Zuo <Jerry.Zuo@amd.com>
      Cc: Jani Nikula <jani.nikula@intel.com>
      Cc: Imre Deak <imre.deak@intel.com>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: Sean Paul <sean@poorly.run>
      Acked-by: default avatarJani Nikula <jani.nikula@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20220817193847.557945-9-lyude@redhat.com
      a5c2c0d1
    • Lyude Paul's avatar
      drm/display/dp_mst: Add some missing kdocs for atomic MST structs · 0bee2ae2
      Lyude Paul authored
      
      Since we're about to start adding some stuff here, we may as well fill in
      any missing documentation that we forgot to write.
      
      Signed-off-by: default avatarLyude Paul <lyude@redhat.com>
      Cc: Wayne Lin <Wayne.Lin@amd.com>
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Cc: Fangzhi Zuo <Jerry.Zuo@amd.com>
      Cc: Jani Nikula <jani.nikula@intel.com>
      Cc: Imre Deak <imre.deak@intel.com>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: Sean Paul <sean@poorly.run>
      Acked-by: default avatarJani Nikula <jani.nikula@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20220817193847.557945-7-lyude@redhat.com
      0bee2ae2
    • Lyude Paul's avatar
      drm/display/dp_mst: Call them time slots, not VCPI slots · df78f7f6
      Lyude Paul authored
      
      VCPI is only sort of the correct term here, originally the majority of this
      code simply referred to timeslots vaguely as "slots" - and since I started
      working on it and adding atomic functionality, the name "VCPI slots" has
      been used to represent time slots.
      
      Now that we actually have consistent access to the DisplayPort spec thanks
      to VESA, I now know this isn't actually the proper term - as the
      specification refers to these as time slots.
      
      Since we're trying to make this code as easy to figure out as possible,
      let's take this opportunity to correct this nomenclature and call them by
      their proper name - timeslots. Likewise, we rename various functions
      appropriately, along with replacing references in the kernel documentation
      and various debugging messages.
      
      It's important to note that this patch series leaves the legacy MST code
      untouched for the most part, which is fine since we'll be removing it soon
      anyhow. There should be no functional changes in this series.
      
      v2:
      * Add note that Wayne Lin from AMD suggested regarding slots being between
        the source DP Tx and the immediate downstream DP Rx
      
      Signed-off-by: default avatarLyude Paul <lyude@redhat.com>
      Cc: Wayne Lin <Wayne.Lin@amd.com>
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Cc: Fangzhi Zuo <Jerry.Zuo@amd.com>
      Cc: Jani Nikula <jani.nikula@intel.com>
      Cc: Imre Deak <imre.deak@intel.com>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: Sean Paul <sean@poorly.run>
      Acked-by: default avatarJani Nikula <jani.nikula@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20220817193847.557945-5-lyude@redhat.com
      df78f7f6
    • Lyude Paul's avatar
      drm/display/dp_mst: Rename drm_dp_mst_vcpi_allocation · 48b6b372
      Lyude Paul authored
      
      In retrospect, the name I chose for this originally is confusing, as
      there's a lot more info in here then just the VCPI. This really should be
      called a payload. Let's make it more obvious that this is meant to be
      related to the atomic state and is about payloads by renaming it to
      drm_dp_mst_atomic_payload. Also, rename various variables throughout the
      code that use atomic payloads.
      
      Signed-off-by: default avatarLyude Paul <lyude@redhat.com>
      Cc: Wayne Lin <Wayne.Lin@amd.com>
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Cc: Fangzhi Zuo <Jerry.Zuo@amd.com>
      Cc: Jani Nikula <jani.nikula@intel.com>
      Cc: Imre Deak <imre.deak@intel.com>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: Sean Paul <sean@poorly.run>
      Acked-by: default avatarJani Nikula <jani.nikula@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20220817193847.557945-4-lyude@redhat.com
      48b6b372
  12. Aug 22, 2022
  13. Aug 20, 2022
  14. Aug 19, 2022
    • Chao Peng's avatar
      KVM: Rename mmu_notifier_* to mmu_invalidate_* · 20ec3ebd
      Chao Peng authored
      
      The motivation of this renaming is to make these variables and related
      helper functions less mmu_notifier bound and can also be used for non
      mmu_notifier based page invalidation. mmu_invalidate_* was chosen to
      better describe the purpose of 'invalidating' a page that those
      variables are used for.
      
        - mmu_notifier_seq/range_start/range_end are renamed to
          mmu_invalidate_seq/range_start/range_end.
      
        - mmu_notifier_retry{_hva} helper functions are renamed to
          mmu_invalidate_retry{_hva}.
      
        - mmu_notifier_count is renamed to mmu_invalidate_in_progress to
          avoid confusion with mn_active_invalidate_count.
      
        - While here, also update kvm_inc/dec_notifier_count() to
          kvm_mmu_invalidate_begin/end() to match the change for
          mmu_notifier_count.
      
      No functional change intended.
      
      Signed-off-by: default avatarChao Peng <chao.p.peng@linux.intel.com>
      Message-Id: <20220816125322.1110439-3-chao.p.peng@linux.intel.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      20ec3ebd
    • Chao Peng's avatar
      KVM: Rename KVM_PRIVATE_MEM_SLOTS to KVM_INTERNAL_MEM_SLOTS · bdd1c37a
      Chao Peng authored
      
      KVM_INTERNAL_MEM_SLOTS better reflects the fact those slots are KVM
      internally used (invisible to userspace) and avoids confusion to future
      private slots that can have different meaning.
      
      Signed-off-by: default avatarChao Peng <chao.p.peng@linux.intel.com>
      Message-Id: <20220816125322.1110439-2-chao.p.peng@linux.intel.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      bdd1c37a
  15. Aug 18, 2022
    • Yu Kuai's avatar
      blk-mq: remove unused function blk_mq_queue_stopped() · a8239f03
      Yu Kuai authored
      
      blk_mq_queue_stopped() doesn't have any caller, which was found by
      code coverage test, thus remove it.
      
      Signed-off-by: default avatarYu Kuai <yukuai3@huawei.com>
      Link: https://lore.kernel.org/r/20220818063555.3741222-1-yukuai1@huaweicloud.com
      
      
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      a8239f03
    • Vladimir Oltean's avatar
      net: mscc: ocelot: keep ocelot_stat_layout by reg address, not offset · d4c36765
      Vladimir Oltean authored
      
      With so many counter addresses recently discovered as being wrong, it is
      desirable to at least have a central database of information, rather
      than two: one through the SYS_COUNT_* registers (used for
      ndo_get_stats64), and the other through the offset field of struct
      ocelot_stat_layout elements (used for ethtool -S).
      
      The strategy will be to keep the SYS_COUNT_* definitions as the single
      source of truth, but for that we need to expand our current definitions
      to cover all registers. Then we need to convert the ocelot region
      creation logic, and stats worker, to the read semantics imposed by going
      through SYS_COUNT_* absolute register addresses, rather than offsets
      of 32-bit words relative to SYS_COUNT_RX_OCTETS (which should have been
      SYS_CNT, by the way).
      
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      d4c36765
    • Vladimir Oltean's avatar
      net: mscc: ocelot: make struct ocelot_stat_layout array indexable · 91904600
      Vladimir Oltean authored
      
      The ocelot counters are 32-bit and require periodic reading, every 2
      seconds, by ocelot_port_update_stats(), so that wraparounds are
      detected.
      
      Currently, the counters reported by ocelot_get_stats64() come from the
      32-bit hardware counters directly, rather than from the 64-bit
      accumulated ocelot->stats, and this is a problem for their integrity.
      
      The strategy is to make ocelot_get_stats64() able to cherry-pick
      individual stats from ocelot->stats the way in which it currently reads
      them out from SYS_COUNT_* registers. But currently it can't, because
      ocelot->stats is an opaque u64 array that's used only to feed data into
      ethtool -S.
      
      To solve that problem, we need to make ocelot->stats indexable, and
      associate each element with an element of struct ocelot_stat_layout used
      by ethtool -S.
      
      This makes ocelot_stat_layout a fat (and possibly sparse) array, so we
      need to change the way in which we access it. We no longer need
      OCELOT_STAT_END as a sentinel, because we know the array's size
      (OCELOT_NUM_STATS). We just need to skip the array elements that were
      left unpopulated for the switch revision (ocelot, felix, seville).
      
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      91904600
    • Vladimir Oltean's avatar
      net: mscc: ocelot: turn stats_lock into a spinlock · 22d842e3
      Vladimir Oltean authored
      
      ocelot_get_stats64() currently runs unlocked and therefore may collide
      with ocelot_port_update_stats() which indirectly accesses the same
      counters. However, ocelot_get_stats64() runs in atomic context, and we
      cannot simply take the sleepable ocelot->stats_lock mutex. We need to
      convert it to an atomic spinlock first. Do that as a preparatory change.
      
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      22d842e3
    • Vladimir Oltean's avatar
      net: mscc: ocelot: fix incorrect ndo_get_stats64 packet counters · 5152de7b
      Vladimir Oltean authored
      
      Reading stats using the SYS_COUNT_* register definitions is only used by
      ocelot_get_stats64() from the ocelot switchdev driver, however,
      currently the bucket definitions are incorrect.
      
      Separately, on both RX and TX, we have the following problems:
      - a 256-1023 bucket which actually tracks the 256-511 packets
      - the 1024-1526 bucket actually tracks the 512-1023 packets
      - the 1527-max bucket actually tracks the 1024-1526 packets
      
      => nobody tracks the packets from the real 1527-max bucket
      
      Additionally, the RX_PAUSE, RX_CONTROL, RX_LONGS and RX_CLASSIFIED_DROPS
      all track the wrong thing. However this doesn't seem to have any
      consequence, since ocelot_get_stats64() doesn't use these.
      
      Even though this problem only manifests itself for the switchdev driver,
      we cannot split the fix for ocelot and for DSA, since it requires fixing
      the bucket definitions from enum ocelot_reg, which makes us necessarily
      adapt the structures from felix and seville as well.
      
      Fixes: 84705fc1 ("net: dsa: felix: introduce support for Seville VSC9953 switch")
      Fixes: 56051948 ("net: dsa: ocelot: add driver for Felix switch family")
      Fixes: a556c76a ("net: mscc: Add initial Ocelot switch support")
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      5152de7b
  16. Aug 17, 2022
    • David Howells's avatar
      net: Fix suspicious RCU usage in bpf_sk_reuseport_detach() · fc4aaf9f
      David Howells authored
      
      bpf_sk_reuseport_detach() calls __rcu_dereference_sk_user_data_with_flags()
      to obtain the value of sk->sk_user_data, but that function is only usable
      if the RCU read lock is held, and neither that function nor any of its
      callers hold it.
      
      Fix this by adding a new helper, __locked_read_sk_user_data_with_flags()
      that checks to see if sk->sk_callback_lock() is held and use that here
      instead.
      
      Alternatively, making __rcu_dereference_sk_user_data_with_flags() use
      rcu_dereference_checked() might suffice.
      
      Without this, the following warning can be occasionally observed:
      
      =============================
      WARNING: suspicious RCU usage
      6.0.0-rc1-build2+ #563 Not tainted
      -----------------------------
      include/net/sock.h:592 suspicious rcu_dereference_check() usage!
      
      other info that might help us debug this:
      
      rcu_scheduler_active = 2, debug_locks = 1
      5 locks held by locktest/29873:
       #0: ffff88812734b550 (&sb->s_type->i_mutex_key#9){+.+.}-{3:3}, at: __sock_release+0x77/0x121
       #1: ffff88812f5621b0 (sk_lock-AF_INET){+.+.}-{0:0}, at: tcp_close+0x1c/0x70
       #2: ffff88810312f5c8 (&h->lhash2[i].lock){+.+.}-{2:2}, at: inet_unhash+0x76/0x1c0
       #3: ffffffff83768bb8 (reuseport_lock){+...}-{2:2}, at: reuseport_detach_sock+0x18/0xdd
       #4: ffff88812f562438 (clock-AF_INET){++..}-{2:2}, at: bpf_sk_reuseport_detach+0x24/0xa4
      
      stack backtrace:
      CPU: 1 PID: 29873 Comm: locktest Not tainted 6.0.0-rc1-build2+ #563
      Hardware name: ASUS All Series/H97-PLUS, BIOS 2306 10/09/2014
      Call Trace:
       <TASK>
       dump_stack_lvl+0x4c/0x5f
       bpf_sk_reuseport_detach+0x6d/0xa4
       reuseport_detach_sock+0x75/0xdd
       inet_unhash+0xa5/0x1c0
       tcp_set_state+0x169/0x20f
       ? lockdep_sock_is_held+0x3a/0x3a
       ? __lock_release.isra.0+0x13e/0x220
       ? reacquire_held_locks+0x1bb/0x1bb
       ? hlock_class+0x31/0x96
       ? mark_lock+0x9e/0x1af
       __tcp_close+0x50/0x4b6
       tcp_close+0x28/0x70
       inet_release+0x8e/0xa7
       __sock_release+0x95/0x121
       sock_close+0x14/0x17
       __fput+0x20f/0x36a
       task_work_run+0xa3/0xcc
       exit_to_user_mode_prepare+0x9c/0x14d
       syscall_exit_to_user_mode+0x18/0x44
       entry_SYSCALL_64_after_hwframe+0x63/0xcd
      
      Fixes: cf8c1e96 ("net: refactor bpf_sk_reuseport_detach()")
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      cc: Hawkins Jiawei <yin31149@gmail.com>
      Link: https://lore.kernel.org/r/166064248071.3502205.10036394558814861778.stgit@warthog.procyon.org.uk
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      fc4aaf9f
    • Hans de Goede's avatar
      ACPI: video: Add acpi_video_backlight_use_native() helper · 2600bfa3
      Hans de Goede authored
      
      ATM on x86 laptops where we want userspace to use the acpi_video backlight
      device we often register both the GPU's native backlight device and
      acpi_video's firmware acpi_video# backlight device. This relies on
      userspace preferring firmware type backlight devices over native ones, but
      registering 2 backlight devices for a single display really is undesirable.
      
      On x86 laptops where the native GPU backlight device should be used,
      the registering of other backlight devices is avoided by their drivers
      using acpi_video_get_backlight_type() and only registering their backlight
      if the return value matches their type.
      
      acpi_video_get_backlight_type() uses
      backlight_device_get_by_type(BACKLIGHT_RAW) to determine if a native
      driver is available and will never return native if this returns
      false. This means that the GPU's native backlight registering code
      cannot just call acpi_video_get_backlight_type() to determine if it
      should register its backlight, since acpi_video_get_backlight_type() will
      never return native until the native backlight has already registered.
      
      To fix this add a new internal native function parameter to
      acpi_video_get_backlight_type(), which when set to true will make
      acpi_video_get_backlight_type() behave as if a native backlight has
      already been registered.
      
      And add a new acpi_video_backlight_use_native() helper, which sets this
      to true, for use in native GPU backlight code.
      
      Changes in v2:
      - Replace adding a native parameter to acpi_video_get_backlight_type() with
        adding a new acpi_video_backlight_use_native() helper.
      
      Acked-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      2600bfa3
  17. Aug 16, 2022
Loading