linux-stable/arch/s390
Thomas Richter 60f8f641f3 s390/pai_crypto: dynamically allocate percpu pai crypto map data structure
Struct paicrypt_map is a data structure and is statically defined
for each possible CPU. Rework this and replace it by dynamically
allocated data structures created when a perf_event_open() system call
is invoked.

It is replaced by an array of pointers to all possible CPUs and
reference counting. The array of pointers is allocated when the first
event is created. For each online CPU an event is installed on, a struct
paicrypt_map is allocated and a pointer to struct cpu_cf_events is
stored in the array:

                        CPU   0   1   2   3    ...  N
                              +---+---+---+---+---+---+
     paicrypt_root::mapptr--> | * |   |   |   |...|   |
                              +-|-+---+---+---+---+---+
                                |
                                |
                               \|/
                        +--------------+
                        | paicrypt_map |
                        +--------------+

With this approach the large data structure is only allocated when
an event is actually installed and used.
Also implement proper reference counting for allocation and removal.

PAI crypto counter events can not be created when a CPU hot plug
add is processed. This means a CPU hot plug add does not get
the necessary PAI event to record PAI cryptography counter increments
on the newly added CPU. There is no possibility to notify user space
of a new CPU and the necessary event infrastructure assoiciated with
the file descriptor returned by perf_event_open() system call.
However system call perf_event_open() can use the newly added CPU
when issued after the CPU hot plug add.

Kernel CPU hot plug remove deletes the CPU and stops the PAI counters on
that CPU. When the process closes the file descriptor associated
with that event, the event's destroy() function removes any
allocated data structures and adjusts the reference counts.

Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
Acked-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
2023-10-19 16:36:21 +02:00
..
appldata sysctl: Add size to register_sysctl 2023-08-15 15:26:17 -07:00
boot s390/vmem: remove unused variable 2023-10-16 13:04:09 +02:00
configs Kbuild updates for v6.6 2023-09-05 11:01:47 -07:00
crypto s390/paes: fix PKEY_TYPE_EP11_AES handling for secure keyblobs 2023-08-17 15:18:53 +02:00
hypfs s390 updates for 6.6 merge window 2023-08-28 17:22:39 -07:00
include s390: add support for DCACHE_WORD_ACCESS 2023-10-16 13:04:09 +02:00
kernel s390/pai_crypto: dynamically allocate percpu pai crypto map data structure 2023-10-19 16:36:21 +02:00
kvm s390: use control register bit defines 2023-09-19 13:26:57 +02:00
lib s390/ctlreg: add struct ctlreg 2023-09-19 13:26:56 +02:00
mm s390/mm: make vmemmap_free() only for CONFIG_MEMORY_HOTPLUG available 2023-10-19 16:36:21 +02:00
net s390/bpf: Pass through tail call counter in trampolines 2023-09-06 10:48:14 +02:00
pci s390: use control register bit defines 2023-09-19 13:26:57 +02:00
purgatory s390 updates for 6.5 merge window part 2 2023-07-06 13:18:30 -07:00
tools KVM: s390: Add facility 197 to the allow list 2022-07-13 15:25:25 +02:00
Kbuild - An extensive rework of kexec and crash Kconfig from Eric DeVolder 2023-08-29 14:53:51 -07:00
Kconfig s390: add support for DCACHE_WORD_ACCESS 2023-10-16 13:04:09 +02:00
Kconfig.debug s390/Kconfig.debug: fix indentation 2022-06-01 12:03:15 +02:00
Makefile s390: use obj-y to descend into drivers/s390/ 2023-07-24 12:12:25 +02:00