Skip to content
  1. Oct 28, 2022
    • Peter Zijlstra's avatar
      perf: Rewrite core context handling · bd275681
      Peter Zijlstra authored
      
      
      There have been various issues and limitations with the way perf uses
      (task) contexts to track events. Most notable is the single hardware
      PMU task context, which has resulted in a number of yucky things (both
      proposed and merged).
      
      Notably:
       - HW breakpoint PMU
       - ARM big.little PMU / Intel ADL PMU
       - Intel Branch Monitoring PMU
       - AMD IBS PMU
       - S390 cpum_cf PMU
       - PowerPC trace_imc PMU
      
      *Current design:*
      
      Currently we have a per task and per cpu perf_event_contexts:
      
        task_struct::perf_events_ctxp[] <-> perf_event_context <-> perf_cpu_context
             ^                                 |    ^     |           ^
             `---------------------------------'    |     `--> pmu ---'
                                                    v           ^
                                               perf_event ------'
      
      Each task has an array of pointers to a perf_event_context. Each
      perf_event_context has a direct relation to a PMU and a group of
      events for that PMU. The task related perf_event_context's have a
      pointer back to that task.
      
      Each PMU has a per-cpu pointer to a per-cpu perf_cpu_context, which
      includes a perf_event_context, which again has a direct relation to
      that PMU, and a group of events for that PMU.
      
      The perf_cpu_context also tracks which task context is currently
      associated with that CPU and includes a few other things like the
      hrtimer for rotation etc.
      
      Each perf_event is then associated with its PMU and one
      perf_event_context.
      
      *Proposed design:*
      
      New design proposed by this patch reduce to a single task context and
      a single CPU context but adds some intermediate data-structures:
      
        task_struct::perf_event_ctxp -> perf_event_context <- perf_cpu_context
             ^                           |   ^ ^
             `---------------------------'   | |
                                             | |    perf_cpu_pmu_context <--.
                                             | `----.    ^                  |
                                             |      |    |                  |
                                             |      v    v                  |
                                             | ,--> perf_event_pmu_context  |
                                             | |                            |
                                             | |                            |
                                             v v                            |
                                        perf_event ---> pmu ----------------'
      
      With the new design, perf_event_context will hold all events for all
      pmus in the (respective pinned/flexible) rbtrees. This can be achieved
      by adding pmu to rbtree key:
      
        {cpu, pmu, cgroup, group_index}
      
      Each perf_event_context carries a list of perf_event_pmu_context which
      is used to hold per-pmu-per-context state. For example, it keeps track
      of currently active events for that pmu, a pmu specific task_ctx_data,
      a flag to tell whether rotation is required or not etc.
      
      Additionally, perf_cpu_pmu_context is used to hold per-pmu-per-cpu
      state like hrtimer details to drive the event rotation, a pointer to
      perf_event_pmu_context of currently running task and some other
      ancillary information.
      
      Each perf_event is associated to it's pmu, perf_event_context and
      perf_event_pmu_context.
      
      Further optimizations to current implementation are possible. For
      example, ctx_resched() can be optimized to reschedule only single pmu
      events.
      
      Much thanks to Ravi for picking this up and pushing it towards
      completion.
      
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Co-developed-by: default avatarRavi Bangoria <ravi.bangoria@amd.com>
      Signed-off-by: default avatarRavi Bangoria <ravi.bangoria@amd.com>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Link: https://lkml.kernel.org/r/20221008062424.313-1-ravi.bangoria@amd.com
      bd275681
  2. Oct 24, 2022
  3. Oct 23, 2022
    • Linus Torvalds's avatar
      Merge tag 'hwmon-for-v6.1-rc2' of... · d47136c2
      Linus Torvalds authored
      Merge tag 'hwmon-for-v6.1-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging
      
      Pull hwmon fixes from Guenter Roeck:
      
       - corsair-psu: Fix typo in USB id description, and add USB ID for new
         PSU
      
       - pwm-fan: Fix fan power handling when disabling fan control
      
      * tag 'hwmon-for-v6.1-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging:
        hwmon: (corsair-psu) Add USB id of the new HX1500i psu
        hwmon: (pwm-fan) Explicitly switch off fan power when setting pwm1_enable to 0
        hwmon: (corsair-psu) fix typo in USB id description
      d47136c2
    • Linus Torvalds's avatar
      Merge tag 'i2c-for-6.1-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux · cda5d920
      Linus Torvalds authored
      Pull i2c fixes from Wolfram Sang:
       "RPM fix for qcom-cci, platform module alias for xiic, build warning
        fix for mlxbf, typo fixes in comments"
      
      * tag 'i2c-for-6.1-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
        i2c: mlxbf: depend on ACPI; clean away ifdeffage
        i2c: fix spelling typos in comments
        i2c: qcom-cci: Fix ordering of pm_runtime_xx and i2c_add_adapter
        i2c: xiic: Add platform module alias
      cda5d920
    • Linus Torvalds's avatar
      Merge tag 'pci-v6.1-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci · fd79882f
      Linus Torvalds authored
      Pull pci fixes from Bjorn Helgaas:
      
       - Revert a simplification that broke pci-tegra due to a masking error
      
       - Update MAINTAINERS for Kishon's email address change and TI
         DRA7XX/J721E maintainer change
      
      * tag 'pci-v6.1-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci:
        MAINTAINERS: Update Kishon's email address in PCI endpoint subsystem
        MAINTAINERS: Add Vignesh Raghavendra as maintainer of TI DRA7XX/J721E PCI driver
        Revert "PCI: tegra: Use PCI_CONF1_EXT_ADDRESS() macro"
      fd79882f
    • Linus Torvalds's avatar
      Merge tag 'media/v6.1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media · 3272eb1a
      Linus Torvalds authored
      Pull missed media updates from Mauro Carvalho Chehab:
       "It seems I screwed-up my previous pull request: it ends up that only
        half of the media patches that were in linux-next got merged in -rc1.
      
        The script which creates the signed tags silently failed due to
        5.19->6.0 so it ended generating a tag with incomplete stuff.
      
        So here are the missing parts:
      
         - a DVB core security fix
      
         - lots of fixes and cleanups for atomisp staging driver
      
         - old drivers that are VB1 are being moved to staging to be
           deprecated
      
         - several driver updates - mostly for embedded systems, but there are
           also some things addressing issues with some PC webcams, in the UVC
           video driver"
      
      * tag 'media/v6.1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (163 commits)
        media: sun6i-csi: Move csi buffer definition to main header file
        media: sun6i-csi: Introduce and use video helper functions
        media: sun6i-csi: Add media ops with link notify callback
        media: sun6i-csi: Remove controls handler from the driver
        media: sun6i-csi: Register the media device after creation
        media: sun6i-csi: Pass and store csi device directly in video code
        media: sun6i-csi: Tidy up video code
        media: sun6i-csi: Tidy up v4l2 code
        media: sun6i-csi: Tidy up Kconfig
        media: sun6i-csi: Use runtime pm for clocks and reset
        media: sun6i-csi: Define and use variant to get module clock rate
        media: sun6i-csi: Always set exclusive module clock rate
        media: sun6i-csi: Tidy up platform code
        media: sun6i-csi: Refactor main driver data structures
        media: sun6i-csi: Define and use driver name and (reworked) description
        media: cedrus: Add a Kconfig dependency on RESET_CONTROLLER
        media: sun8i-rotate: Add a Kconfig dependency on RESET_CONTROLLER
        media: sun8i-di: Add a Kconfig dependency on RESET_CONTROLLER
        media: sun4i-csi: Add a Kconfig dependency on RESET_CONTROLLER
        media: sun6i-csi: Add a Kconfig dependency on RESET_CONTROLLER
        ...
      3272eb1a
  4. Oct 22, 2022