Re: [PATCH 1/5] crypto: sha256 - remove duplicate generic hash init function
Hi Julian, On 12/23/21 6:35 AM, Julian Calaby wrote: Hi Tianjia, On Mon, Dec 20, 2021 at 8:25 PM Tianjia Zhang wrote: crypto_sha256_init() and sha256_base_init() are the same repeated implementations, remove the crypto_sha256_init() in generic implementation, sha224 is the same process. Signed-off-by: Tianjia Zhang --- crypto/sha256_generic.c | 16 ++-- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/crypto/sha256_generic.c b/crypto/sha256_generic.c index 3b377197236e..bf147b01e313 100644 --- a/crypto/sha256_generic.c +++ b/crypto/sha256_generic.c @@ -72,7 +60,7 @@ EXPORT_SYMBOL(crypto_sha256_finup); static struct shash_alg sha256_algs[2] = { { .digestsize = SHA256_DIGEST_SIZE, - .init = crypto_sha256_init, + .init = sha256_base_init, .update = crypto_sha256_update, .final = crypto_sha256_final, .finup = crypto_sha256_finup, @@ -86,7 +74,7 @@ static struct shash_alg sha256_algs[2] = { { } }, { .digestsize = SHA224_DIGEST_SIZE, - .init = crypto_sha224_init, + .init = sha224_base_init, .update = crypto_sha256_update, .final = crypto_sha256_final, .finup = crypto_sha256_finup, Aren't these two functions defined as static inline functions? It appears that these crypto_ wrappers were added so there's "actual" referenceable functions for these structs. Did this actually compile? Thanks, Judging from the compilation results, there is really no difference, but the modification made by this patch is still necessary, because crypto_sha256_init() wrapper and sha256_base_init() are two completely duplicate functions. Best regards, Tianjia
[PATCH] powerpc: fix spelling of "its"
Use the possessive "its" instead of the contraction of "it is" (it's). Signed-off-by: Randy Dunlap Cc: Michael Ellerman --- arch/powerpc/perf/hv-24x7.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- linux-next-20211222.orig/arch/powerpc/perf/hv-24x7.c +++ linux-next-20211222/arch/powerpc/perf/hv-24x7.c @@ -756,7 +756,7 @@ static ssize_t catalog_event_len_validat } if (calc_ev_end > ev_end) { - pr_warn("event %zu exceeds it's own length: event=%pK, end=%pK, offset=%zu, calc_ev_end=%pK\n", + pr_warn("event %zu exceeds its own length: event=%pK, end=%pK, offset=%zu, calc_ev_end=%pK\n", event_idx, event, ev_end, offset, calc_ev_end); return -1; }
[PATCH v2 10/10] powerpc/pseries/vas: Write 'target_creds' for QoS credits change
PowerVM support two types of credits - Default (uses normal priority FIFO) and Qality of service (QoS uses high priproty FIFO). The user decides the number of QoS credits and sets this value with HMC interface. With the core add/removal, this value can be changed in HMC which invokes drmgr to communicate to the kernel. This patch adds an interface so that drmgr command can write the new target QoS credits in sysfs. But the kernel gets the new QoS capabilities from the hypervisor whenever target_creds is updated to make sure sync with the values in the hypervisor. Signed-off-by: Haren Myneni --- arch/powerpc/platforms/pseries/vas-sysfs.c | 34 +- arch/powerpc/platforms/pseries/vas.c | 2 +- arch/powerpc/platforms/pseries/vas.h | 1 + 3 files changed, 35 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/platforms/pseries/vas-sysfs.c b/arch/powerpc/platforms/pseries/vas-sysfs.c index f7609cdef8f8..66f1a0224811 100644 --- a/arch/powerpc/platforms/pseries/vas-sysfs.c +++ b/arch/powerpc/platforms/pseries/vas-sysfs.c @@ -36,6 +36,34 @@ static ssize_t avail_creds_show(struct vas_cop_feat_caps *caps, char *buf) return sprintf(buf, "%d\n", avail_creds); } +/* + * This function is used to get the notification from the drmgr when + * QoS credits are changed as part of DLPAR core add/removal. Though + * receiving the total QoS credits here, get the official QoS + * capabilities from the hypervisor. + */ +static ssize_t target_creds_store(struct vas_cop_feat_caps *caps, + const char *buf, size_t count) +{ + int err; + u16 creds; + + /* +* Nothing to do for default credit type. +*/ + if (caps->win_type == VAS_GZIP_DEF_FEAT_TYPE) + return -EOPNOTSUPP; + + err = kstrtou16(buf, 0, ); + if (!err) + err = vas_reconfig_capabilties(caps->win_type); + + if (err) + return -EINVAL; + + return count; +} + #define sysfs_capbs_entry_read(_name) \ static ssize_t _name##_show(struct vas_cop_feat_caps *caps, char *buf) \ { \ @@ -52,8 +80,12 @@ struct vas_sysfs_entry { sysfs_capbs_entry_read(_name); \ static struct vas_sysfs_entry _name##_attribute = __ATTR(_name, \ 0444, _name##_show, NULL); +#define VAS_ATTR(_name) \ + sysfs_capbs_entry_read(_name); \ + static struct vas_sysfs_entry _name##_attribute = __ATTR(_name, \ + 0644, _name##_show, _name##_store) -VAS_ATTR_RO(target_creds); +VAS_ATTR(target_creds); VAS_ATTR_RO(used_creds); static struct vas_sysfs_entry avail_creds_attribute = diff --git a/arch/powerpc/platforms/pseries/vas.c b/arch/powerpc/platforms/pseries/vas.c index 4b4048209c7d..169f0cccb166 100644 --- a/arch/powerpc/platforms/pseries/vas.c +++ b/arch/powerpc/platforms/pseries/vas.c @@ -714,7 +714,7 @@ static int reconfig_close_windows(struct vas_caps *vcap, int excess_creds) * changes. Reconfig window configurations based on the credits * availability from this new capabilities. */ -static int vas_reconfig_capabilties(u8 type) +int vas_reconfig_capabilties(u8 type) { struct hv_vas_cop_feat_caps *hv_caps; struct vas_cop_feat_caps *caps; diff --git a/arch/powerpc/platforms/pseries/vas.h b/arch/powerpc/platforms/pseries/vas.h index bc393bd74030..4cf1d0ef66a5 100644 --- a/arch/powerpc/platforms/pseries/vas.h +++ b/arch/powerpc/platforms/pseries/vas.h @@ -125,5 +125,6 @@ struct pseries_vas_window { }; int sysfs_add_vas_caps(struct vas_cop_feat_caps *caps); +int vas_reconfig_capabilties(u8 type); int __init sysfs_pseries_vas_init(struct vas_all_caps *vas_caps); #endif /* _VAS_H */ -- 2.27.0
[PATCH v2 09/10] powerpc/pseries/vas: sysfs interface to export capabilities
The hypervisor provides the available VAS GZIP capabilities such as default or QoS window type and the target available credits in each type. This patch creates sysfs entries and exports the target, used and the available credits for each feature. This interface can be used by the user space to determine the credits usage or to set the target credits in the case of QoS type (for DLPAR). /sys/devices/vas/vas0/gzip/def_caps: (default GZIP capabilities) avail_creds /* Available credits to use */ target_creds /* Total credits available. Can be /* changed with DLPAR operation */ used_creds /* Used credits */ /sys/devices/vas/vas0/gzip/qos_caps (QoS GZIP capabilities) avail_creds target_creds used_creds Signed-off-by: Haren Myneni --- arch/powerpc/platforms/pseries/Makefile| 2 +- arch/powerpc/platforms/pseries/vas-sysfs.c | 218 + arch/powerpc/platforms/pseries/vas.c | 6 + arch/powerpc/platforms/pseries/vas.h | 6 + 4 files changed, 231 insertions(+), 1 deletion(-) create mode 100644 arch/powerpc/platforms/pseries/vas-sysfs.c diff --git a/arch/powerpc/platforms/pseries/Makefile b/arch/powerpc/platforms/pseries/Makefile index 41d8aee98da4..349f42c31b65 100644 --- a/arch/powerpc/platforms/pseries/Makefile +++ b/arch/powerpc/platforms/pseries/Makefile @@ -30,6 +30,6 @@ obj-$(CONFIG_PPC_SVM) += svm.o obj-$(CONFIG_FA_DUMP) += rtas-fadump.o obj-$(CONFIG_SUSPEND) += suspend.o -obj-$(CONFIG_PPC_VAS) += vas.o +obj-$(CONFIG_PPC_VAS) += vas.o vas-sysfs.o obj-$(CONFIG_ARCH_HAS_CC_PLATFORM) += cc_platform.o diff --git a/arch/powerpc/platforms/pseries/vas-sysfs.c b/arch/powerpc/platforms/pseries/vas-sysfs.c new file mode 100644 index ..f7609cdef8f8 --- /dev/null +++ b/arch/powerpc/platforms/pseries/vas-sysfs.c @@ -0,0 +1,218 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright 2016-17 IBM Corp. + */ + +#define pr_fmt(fmt) "vas: " fmt + +#include +#include +#include +#include +#include +#include + +#include "vas.h" + +#ifdef CONFIG_SYSFS +static struct kobject *pseries_vas_kobj; +static struct kobject *gzip_caps_kobj; + +struct vas_caps_entry { + struct kobject kobj; + struct vas_cop_feat_caps *caps; +}; + +#define to_caps_entry(entry) container_of(entry, struct vas_caps_entry, kobj) + +static ssize_t avail_creds_show(struct vas_cop_feat_caps *caps, char *buf) +{ + /* +* avail_creds may be -ve if used_creds is oversubscribed, +* can happen if target_creds is reduced with DLPAR core removal. +*/ + int avail_creds = atomic_read(>target_creds) - + atomic_read(>used_creds); + return sprintf(buf, "%d\n", avail_creds); +} + +#define sysfs_capbs_entry_read(_name) \ +static ssize_t _name##_show(struct vas_cop_feat_caps *caps, char *buf) \ +{ \ + return sprintf(buf, "%d\n", atomic_read(>_name)); \ +} + +struct vas_sysfs_entry { + struct attribute attr; + ssize_t (*show)(struct vas_cop_feat_caps *, char *); + ssize_t (*store)(struct vas_cop_feat_caps *, const char *, size_t); +}; + +#define VAS_ATTR_RO(_name) \ + sysfs_capbs_entry_read(_name); \ + static struct vas_sysfs_entry _name##_attribute = __ATTR(_name, \ + 0444, _name##_show, NULL); + +VAS_ATTR_RO(target_creds); +VAS_ATTR_RO(used_creds); + +static struct vas_sysfs_entry avail_creds_attribute = + __ATTR(avail_creds, 0444, avail_creds_show, NULL); + +static struct attribute *vas_capab_attrs[] = { + _creds_attribute.attr, + _creds_attribute.attr, + _creds_attribute.attr, + NULL, +}; + +static ssize_t vas_type_show(struct kobject *kobj, struct attribute *attr, +char *buf) +{ + struct vas_caps_entry *centry; + struct vas_cop_feat_caps *caps; + struct vas_sysfs_entry *entry; + + centry = to_caps_entry(kobj); + caps = centry->caps; + entry = container_of(attr, struct vas_sysfs_entry, attr); + + if (!entry->show) + return -EIO; + + return entry->show(caps, buf); +} + +static ssize_t vas_type_store(struct kobject *kobj, struct attribute *attr, + const char *buf, size_t count) +{ + struct vas_caps_entry *centry; + struct vas_cop_feat_caps *caps; + struct vas_sysfs_entry *entry; + + centry = to_caps_entry(kobj); + caps = centry->caps; + entry = container_of(attr, struct vas_sysfs_entry, attr); + if (!entry->store) + return -EIO; + + return entry->store(caps, buf, count); +} + +static void vas_type_release(struct kobject *kobj) +{ + struct vas_caps_entry *centry = to_caps_entry(kobj); +
[PATCH v2 08/10] powerpc/vas: Return paste instruction failure if no active window
The VAS window may not be active if the system looses credits and the NX generates page fault when it receives request on unmap paste address. The kernel handles the fault by remap new paste address if the window is active again, Otherwise return the paste instruction failure if the executed instruction that caused the fault was a paste. Signed-off-by: Nicholas Piggin Signed-off-by: Haren Myneni --- arch/powerpc/include/asm/ppc-opcode.h | 2 ++ arch/powerpc/platforms/book3s/vas-api.c | 47 - 2 files changed, 48 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/include/asm/ppc-opcode.h b/arch/powerpc/include/asm/ppc-opcode.h index baea657bc868..30bb3c0e07f9 100644 --- a/arch/powerpc/include/asm/ppc-opcode.h +++ b/arch/powerpc/include/asm/ppc-opcode.h @@ -261,6 +261,8 @@ #define PPC_INST_MFSPR_PVR 0x7c1f42a6 #define PPC_INST_MFSPR_PVR_MASK0xfc1e #define PPC_INST_MTMSRD0x7c000164 +#define PPC_INST_PASTE 0x7c20070d +#define PPC_INST_PASTE_MASK0xfc2007ff #define PPC_INST_POPCNTB 0x7cf4 #define PPC_INST_POPCNTB_MASK 0xfc0007fe #define PPC_INST_RFEBB 0x4c000124 diff --git a/arch/powerpc/platforms/book3s/vas-api.c b/arch/powerpc/platforms/book3s/vas-api.c index 5ceba75c13eb..2ffd34bc4032 100644 --- a/arch/powerpc/platforms/book3s/vas-api.c +++ b/arch/powerpc/platforms/book3s/vas-api.c @@ -351,6 +351,41 @@ static int coproc_release(struct inode *inode, struct file *fp) return 0; } +/* + * If the executed instruction that caused the fault was a paste, then + * clear regs CR0[EQ], advance NIP, and return 0. Else return error code. + */ +static int do_fail_paste(void) +{ + struct pt_regs *regs = current->thread.regs; + u32 instword; + + if (WARN_ON_ONCE(!regs)) + return -EINVAL; + + if (WARN_ON_ONCE(!user_mode(regs))) + return -EINVAL; + + /* +* If we couldn't translate the instruction, the driver should +* return success without handling the fault, it will be retried +* or the instruction fetch will fault. +*/ + if (get_user(instword, (u32 __user *)(regs->nip))) + return -EAGAIN; + + /* +* Not a paste instruction, driver may fail the fault. +*/ + if ((instword & PPC_INST_PASTE_MASK) != PPC_INST_PASTE) + return -ENOENT; + + regs->ccr &= ~0xe000; /* Clear CR0[0-2] to fail paste */ + regs_add_return_ip(regs, 4);/* Skip the paste */ + + return 0; +} + /* * This fault handler is invoked when the VAS/NX generates page fault on * the paste address. Happens if the kernel closes window in hypervisor @@ -403,9 +438,19 @@ static vm_fault_t vas_mmap_fault(struct vm_fault *vmf) } mutex_unlock(>task_ref.mmap_mutex); - return VM_FAULT_SIGBUS; + /* +* Received this fault due to closing the actual window. +* It can happen during migration or lost credits. +* Since no mapping, return the paste instruction failure +* to the user space. +*/ + ret = do_fail_paste(); + if (!ret) + return VM_FAULT_NOPAGE; + return VM_FAULT_SIGBUS; } + static const struct vm_operations_struct vas_vm_ops = { .fault = vas_mmap_fault, }; -- 2.27.0
[PATCH v2 07/10] powerpc/vas: Add paste address mmap fault handler
The user space opens VAS windows and issues NX requests by pasting CRB on the corresponding paste address mmap. When the system looses credits due to core removal, the kernel has to close the window in the hypervisor and make the window inactive by unmapping this paste address. Also the OS has to handle NX request page faults if the user space issue NX requests. This handler remap the new paste address with the same VMA when the window is active again (due to core add with DLPAR). Otherwise returns paste failure. Signed-off-by: Haren Myneni --- arch/powerpc/platforms/book3s/vas-api.c | 60 + 1 file changed, 60 insertions(+) diff --git a/arch/powerpc/platforms/book3s/vas-api.c b/arch/powerpc/platforms/book3s/vas-api.c index 2d06bd1b1935..5ceba75c13eb 100644 --- a/arch/powerpc/platforms/book3s/vas-api.c +++ b/arch/powerpc/platforms/book3s/vas-api.c @@ -351,6 +351,65 @@ static int coproc_release(struct inode *inode, struct file *fp) return 0; } +/* + * This fault handler is invoked when the VAS/NX generates page fault on + * the paste address. Happens if the kernel closes window in hypervisor + * (on PowerVM) due to lost credit or the paste address is not mapped. + */ +static vm_fault_t vas_mmap_fault(struct vm_fault *vmf) +{ + struct vm_area_struct *vma = vmf->vma; + struct file *fp = vma->vm_file; + struct coproc_instance *cp_inst = fp->private_data; + struct vas_window *txwin; + u64 paste_addr; + int ret; + + /* +* window is not opened. Shouldn't expect this error. +*/ + if (!cp_inst || !cp_inst->txwin) { + pr_err("%s(): No send window open?\n", __func__); + return VM_FAULT_SIGBUS; + } + + txwin = cp_inst->txwin; + /* +* Fault is coming due to missing from the original mmap. +* Can happen only when the window is closed due to lost +* credit before mmap() or the user space issued NX request +* without mapping. +*/ + if (txwin->task_ref.vma != vmf->vma) { + pr_err("%s(): No previous mapping with paste address\n", + __func__); + return VM_FAULT_SIGBUS; + } + + mutex_lock(>task_ref.mmap_mutex); + /* +* The window may be inactive due to lost credit (Ex: core +* removal with DLPAR). When the window is active again when +* the credit is available, remap with the new paste address. +*/ + if (txwin->status == VAS_WIN_ACTIVE) { + paste_addr = cp_inst->coproc->vops->paste_addr(txwin); + if (paste_addr) { + ret = vmf_insert_pfn(vma, vma->vm_start, + (paste_addr >> PAGE_SHIFT)); + mutex_unlock(>task_ref.mmap_mutex); + return ret; + } + } + mutex_unlock(>task_ref.mmap_mutex); + + return VM_FAULT_SIGBUS; + +} +static const struct vm_operations_struct vas_vm_ops = { + .fault = vas_mmap_fault, +}; + static int coproc_mmap(struct file *fp, struct vm_area_struct *vma) { struct coproc_instance *cp_inst = fp->private_data; @@ -417,6 +476,7 @@ static int coproc_mmap(struct file *fp, struct vm_area_struct *vma) paste_addr, vma->vm_start, rc); txwin->task_ref.vma = vma; + vma->vm_ops = _vm_ops; out: mutex_unlock(>task_ref.mmap_mutex); -- 2.27.0
[PATCH v2 06/10] powerpc/vas: Map paste address only if window is active
The paste address mapping is done with mmap() after the window is opened with ioctl. But the window can be closed due to lost credit due to core removal before mmap(). So if the window is not active, return mmap() failure with -EACCES and expects the user space reissue mmap() when the window is active or open new window when the credit is available. Signed-off-by: Haren Myneni --- arch/powerpc/platforms/book3s/vas-api.c | 21 - 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/platforms/book3s/vas-api.c b/arch/powerpc/platforms/book3s/vas-api.c index a63fd48e34a7..2d06bd1b1935 100644 --- a/arch/powerpc/platforms/book3s/vas-api.c +++ b/arch/powerpc/platforms/book3s/vas-api.c @@ -379,10 +379,27 @@ static int coproc_mmap(struct file *fp, struct vm_area_struct *vma) return -EACCES; } + /* +* The initial mapping is done after the window is opened +* with ioctl. But this window might have been closed +* due to lost credit (core removal on PowerVM) before mmap(). +* So if the window is not active, return mmap() failure +* with -EACCES and expects the user space reconfigure (mmap) +* window when it is active again or open new window when +* the credit is available. +*/ + mutex_lock(>task_ref.mmap_mutex); + if (txwin->status != VAS_WIN_ACTIVE) { + pr_err("%s(): Window is not active\n", __func__); + rc = -EACCES; + goto out; + } + paste_addr = cp_inst->coproc->vops->paste_addr(txwin); if (!paste_addr) { pr_err("%s(): Window paste address failed\n", __func__); - return -EINVAL; + rc = -EINVAL; + goto out; } pfn = paste_addr >> PAGE_SHIFT; @@ -401,6 +418,8 @@ static int coproc_mmap(struct file *fp, struct vm_area_struct *vma) txwin->task_ref.vma = vma; +out: + mutex_unlock(>task_ref.mmap_mutex); return rc; } -- 2.27.0
[PATCH v2 05/10] powerpc/pseries/vas: Close windows with DLPAR core removal
The hypervisor reduces the available credits if the core is removed from the LPAR. So there is possibility of using excessive credits (windows) in the LPAR and the hypervisor expects the system to close the excessive windows. Even though the user space can continue to use these windows to send compression requests to NX, the hypervisor expects the LPAR to reduce these windows usage so that NX load can be equally distributed across all LPARs in the system. When the DLPAR notifier is received, get the new VAS capabilities from the hypervisor and close the excessive windows in the hypervisor. Also the kernel unmaps the paste address so that the user space receives paste failure until these windows are active with the later DLPAR (core add). Signed-off-by: Haren Myneni --- arch/powerpc/include/asm/vas.h | 1 + arch/powerpc/platforms/book3s/vas-api.c | 2 + arch/powerpc/platforms/pseries/vas.c| 117 ++-- arch/powerpc/platforms/pseries/vas.h| 1 + 4 files changed, 112 insertions(+), 9 deletions(-) diff --git a/arch/powerpc/include/asm/vas.h b/arch/powerpc/include/asm/vas.h index 43cea69d1af1..72d1df038b4b 100644 --- a/arch/powerpc/include/asm/vas.h +++ b/arch/powerpc/include/asm/vas.h @@ -73,6 +73,7 @@ struct vas_user_win_ref { struct mm_struct *mm; /* Linux process mm_struct */ struct mutex mmap_mutex;/* protects paste address mmap() */ /* with DLPAR close/open windows */ + struct vm_area_struct *vma; /* Save VMA and used in DLPAR ops */ }; /* diff --git a/arch/powerpc/platforms/book3s/vas-api.c b/arch/powerpc/platforms/book3s/vas-api.c index 2b0ced611f32..a63fd48e34a7 100644 --- a/arch/powerpc/platforms/book3s/vas-api.c +++ b/arch/powerpc/platforms/book3s/vas-api.c @@ -399,6 +399,8 @@ static int coproc_mmap(struct file *fp, struct vm_area_struct *vma) pr_devel("%s(): paste addr %llx at %lx, rc %d\n", __func__, paste_addr, vma->vm_start, rc); + txwin->task_ref.vma = vma; + return rc; } diff --git a/arch/powerpc/platforms/pseries/vas.c b/arch/powerpc/platforms/pseries/vas.c index 0666d3630e6b..c7dec3adc3af 100644 --- a/arch/powerpc/platforms/pseries/vas.c +++ b/arch/powerpc/platforms/pseries/vas.c @@ -363,13 +363,28 @@ static struct vas_window *vas_allocate_window(int vas_id, u64 flags, if (rc) goto out_free; - vas_user_win_add_mm_context(>vas_win.task_ref); txwin->win_type = cop_feat_caps->win_type; mutex_lock(_pseries_mutex); - list_add(>win_list, >list); + /* +* Possible to loose the acquired credit with DLPAR core +* removal after the window is opened. So if there are any +* closed windows (means with lost credits), do not give new +* window to user space. New windows will be opened only +* after the existing windows are reopened when credits are +* available. +*/ + if (!caps->close_wins) { + list_add(>win_list, >list); + caps->num_wins++; + mutex_unlock(_pseries_mutex); + vas_user_win_add_mm_context(>vas_win.task_ref); + return >vas_win; + } mutex_unlock(_pseries_mutex); - return >vas_win; + put_vas_user_win_ref(>vas_win.task_ref); + rc = -EBUSY; + pr_err("No credit is available to allocate window\n"); out_free: /* @@ -432,14 +447,24 @@ static int vas_deallocate_window(struct vas_window *vwin) caps = [win->win_type].caps; mutex_lock(_pseries_mutex); - rc = deallocate_free_window(win); - if (rc) { - mutex_unlock(_pseries_mutex); - return rc; - } + /* +* VAS window is already closed in the hypervisor when +* lost the credit. So just remove the entry from +* the list, remove task references and free vas_window +* struct. +*/ + if (win->vas_win.status != VAS_WIN_NO_CRED_CLOSE) { + rc = deallocate_free_window(win); + if (rc) { + mutex_unlock(_pseries_mutex); + return rc; + } + } else + vascaps[win->win_type].close_wins--; list_del(>win_list); atomic_dec(>used_creds); + vascaps[win->win_type].num_wins--; mutex_unlock(_pseries_mutex); put_vas_user_win_ref(>task_ref); @@ -614,6 +639,72 @@ static int reconfig_open_windows(struct vas_caps *vcaps, int creds) return rc; } +/* + * The hypervisor reduces the available credits if the LPAR lost core. It + * means the excessive windows should not be active and the user space + * should not be using these windows to send compression requests to NX. + * So the kernel closes the excessive windows and unmap the paste address + * such that the user space receives paste instruction
[PATCH v2 04/10] powerpc/pseries/vas: Reopen windows with DLPAR core add
VAS windows can be closed in the hypervisor due to lost credits when the core is removed. If these credits are available later for core add, reopen these windows and set them active. When the kernel sees page fault on the paste address, it creates new mapping on the new paste address. Then the user space can continue to use these windows and send HW compression requests to NX successfully. Signed-off-by: Haren Myneni --- arch/powerpc/include/asm/vas.h | 15 +++ arch/powerpc/platforms/book3s/vas-api.c | 1 + arch/powerpc/platforms/pseries/vas.c| 143 arch/powerpc/platforms/pseries/vas.h| 8 +- 4 files changed, 161 insertions(+), 6 deletions(-) diff --git a/arch/powerpc/include/asm/vas.h b/arch/powerpc/include/asm/vas.h index 57573d9c1e09..43cea69d1af1 100644 --- a/arch/powerpc/include/asm/vas.h +++ b/arch/powerpc/include/asm/vas.h @@ -29,6 +29,18 @@ #define VAS_THRESH_FIFO_GT_QTR_FULL2 #define VAS_THRESH_FIFO_GT_EIGHTH_FULL 3 +/* + * VAS window status + */ +#define VAS_WIN_ACTIVE 0x0 /* Used in platform independent */ + /* vas mmap() */ +#define VAS_WIN_CLOSED 0x1 +#define VAS_WIN_INACTIVE 0x2 /* Inactive due to HW failure */ +#define VAS_WIN_MOD_IN_PROCESS 0x3 /* Process of being modified, */ + /* deallocated, or quiesced */ +#define VAS_WIN_NO_CRED_CLOSE 0x4 /* Linux specific status when */ + /* window is closed due to lost */ + /* credit */ /* * Get/Set bit fields */ @@ -59,6 +71,8 @@ struct vas_user_win_ref { struct pid *pid;/* PID of owner */ struct pid *tgid; /* Thread group ID of owner */ struct mm_struct *mm; /* Linux process mm_struct */ + struct mutex mmap_mutex;/* protects paste address mmap() */ + /* with DLPAR close/open windows */ }; /* @@ -67,6 +81,7 @@ struct vas_user_win_ref { struct vas_window { u32 winid; u32 wcreds_max; /* Window credits */ + u32 status; enum vas_cop_type cop; struct vas_user_win_ref task_ref; char *dbgname; diff --git a/arch/powerpc/platforms/book3s/vas-api.c b/arch/powerpc/platforms/book3s/vas-api.c index 4d82c92ddd52..2b0ced611f32 100644 --- a/arch/powerpc/platforms/book3s/vas-api.c +++ b/arch/powerpc/platforms/book3s/vas-api.c @@ -316,6 +316,7 @@ static int coproc_ioc_tx_win_open(struct file *fp, unsigned long arg) return PTR_ERR(txwin); } + mutex_init(>task_ref.mmap_mutex); cp_inst->txwin = txwin; return 0; diff --git a/arch/powerpc/platforms/pseries/vas.c b/arch/powerpc/platforms/pseries/vas.c index fb6e6a6261a5..0666d3630e6b 100644 --- a/arch/powerpc/platforms/pseries/vas.c +++ b/arch/powerpc/platforms/pseries/vas.c @@ -494,6 +494,7 @@ static int get_vas_capabilities(u8 feat, enum vas_cop_feat_type type, memset(vcaps, 0, sizeof(*vcaps)); INIT_LIST_HEAD(>list); + vcaps->feat = feat; caps = >caps; rc = h_query_vas_capabilities(H_QUERY_VAS_CAPABILITIES, feat, @@ -532,6 +533,144 @@ static int get_vas_capabilities(u8 feat, enum vas_cop_feat_type type, return 0; } +/* + * VAS windows can be closed due to lost credits when the core is + * removed. So reopen them if credits are available due to DLPAR + * core add and set the window active status. When NX sees the page + * fault on the unmapped paste address, the kernel handles the fault + * by setting the remapping to new paste address if the window is + * active. + */ +static int reconfig_open_windows(struct vas_caps *vcaps, int creds) +{ + long domain[PLPAR_HCALL9_BUFSIZE] = {VAS_DEFAULT_DOMAIN_ID}; + struct vas_cop_feat_caps *caps = >caps; + struct pseries_vas_window *win = NULL, *tmp; + int rc, mv_ents = 0; + + /* +* Nothing to do if there are no closed windows. +*/ + if (!vcaps->close_wins) + return 0; + + /* +* For the core removal, the hypervisor reduces the credits +* assigned to the LPAR and the kernel closes VAS windows +* in the hypervisor depends on reduced credits. The kernel +* uses LIFO (the last windows that are opened will be closed +* first) and expects to open in the same order when credits +* are available. +* For example, 40 windows are closed when the LPAR lost 2 cores +* (dedicated). If 1 core is added, this LPAR can have 20 more +* credits. It means the kernel can reopen 20 windows. So move +* 20 entries in the VAS windows lost and reopen next 20 windows. +*/ + if (vcaps->close_wins > creds) + mv_ents = vcaps->close_wins - creds; + + list_for_each_entry_safe(win, tmp, >list, win_list) { + if (!mv_ents)
[PATCH v2 00/10] powerpc/pseries/vas: NXGZIP support with DLPAR
PowerPC provides HW compression with NX coprocessor. This feature is available on both PowerNV and PowerVM and included in Linux. Since each powerpc chip has one NX coprocessor, the VAS introduces the concept of windows / credits to manage access to this hardware resource. On powerVM, these limited resources should be available across all LPARs. So the hypervisor assigns the specific credits to each LPAR based on processor entitlement so that one LPAR does not overload NX. The hypervisor can reject the window open request to a partition if exceeds its credit limit (1 credit per window). So the total number of target credits in a partition can be changed if the core configuration is modified. The hypervisor expects the partition to modify its window usage depends on new target credits. For example, if the partition uses more credits than the new target credits, it should close the excessive windows so that the NX resource will be available to other partitions. This patch series enables OS to support this dynamic credit management with DLPAR core removal/add. Core removal operation: - Get new VAS capabilities from the hypervisor when the DLPAR notifier is received. This capabilities provides the new target credits based on new processor entitlement. In the case of QoS credit changes, the notification will be issued by updating the target_creds via sysfs. - If the partition is already used more than the new target credits, the kernel selects windows, unmap the current paste address and close them in the hypervisor, It uses LIFO to identify these windows - last windows that are opened are the first ones to be closed. - When the user space issue requests on these windows, NX generates page fault on the unmap paste address. The kernel handles the fault by returning the paste instruction failure if the window is not active (means unmap paste). Then up to the library / user space to fall back to SW compression or manage with the current windows. Core add operation: - The kernel can see increased target credits from the new VAS capabilities. - Scans the window list for the closed windows in the hypervisor due to lost credit before and selects windows based on same LIFO. - Make these corresponding windows active and create remap with the same VMA on the new paste address in the fault handler. - Then the user space should expect paste successful later. Patch 1: Define common names for sysfs target/used/avail_creds so that same sysfs entries can be used even on PowerNV later. Patch 2: Add VAS notifier for DLPAR core add / removal Patch 3: Save LPID in the vas window struct during initial window open and use it when reopen later. Patch 4: When credits are available, reopen windows that are closed before with core removal. Patch 5: Close windows in the hypervisor when the partition exceeds its usage than the new target credits. Patch 6: If the window is closed in the hypervisor before the user space issue the initial mmap(), return -EACCES failure. Patch 7: Add new mmap fault handler which handles the page fault from NX on paste address. Patch 8: Return the paste instruction failure if the window is not active. Patch 9 & 10: The user space determines the credit usage with sysfs target/avail/used_creds interfaces. drmgr uses target_creds to notify OS for QoS credit changes. Thanks to Nicholas Piggin and Aneesh Kumar for the valuable suggestions on the NXGZIP design to support DLPAR operations. Changes in v2: - Rebase 5.16-rc5 - Use list safe functions to iterate windows list - Changes to show the actual value in sysfs used_credits even though some windows are inactive with core removal. Reflects -ve value in sysfs avail_creds to let userspace know that it opened more windows than the current maximum LPAR credits. Haren Myneni (10): powerpc/pseries/vas: Use common names in VAS capability structure powerpc/pseries/vas: Add notifier for DLPAR core removal/add powerpc/pseries/vas: Save partition PID in pseries_vas_window struct powerpc/pseries/vas: Reopen windows with DLPAR core add powerpc/pseries/vas: Close windows with DLPAR core removal powerpc/vas: Map paste address only if window is active powerpc/vas: Add paste address mmap fault handler powerpc/vas: Return paste instruction failure if window is not active powerpc/pseries/vas: sysfs interface to export capabilities powerpc/pseries/vas: Write 'target_creds' for QoS credits change arch/powerpc/include/asm/ppc-opcode.h | 2 + arch/powerpc/include/asm/vas.h | 16 ++ arch/powerpc/platforms/book3s/vas-api.c| 129 - arch/powerpc/platforms/pseries/Makefile| 2 +- arch/powerpc/platforms/pseries/vas-sysfs.c | 250 arch/powerpc/platforms/pseries/vas.c | 315 +++-- arch/powerpc/platforms/pseries/vas.h | 23 +- 7 files changed, 710 insertions(+), 27
Re: [PATCH 1/5] crypto: sha256 - remove duplicate generic hash init function
Hi Tianjia, On Mon, Dec 20, 2021 at 8:25 PM Tianjia Zhang wrote: > > crypto_sha256_init() and sha256_base_init() are the same repeated > implementations, remove the crypto_sha256_init() in generic > implementation, sha224 is the same process. > > Signed-off-by: Tianjia Zhang > --- > crypto/sha256_generic.c | 16 ++-- > 1 file changed, 2 insertions(+), 14 deletions(-) > > diff --git a/crypto/sha256_generic.c b/crypto/sha256_generic.c > index 3b377197236e..bf147b01e313 100644 > --- a/crypto/sha256_generic.c > +++ b/crypto/sha256_generic.c > @@ -72,7 +60,7 @@ EXPORT_SYMBOL(crypto_sha256_finup); > > static struct shash_alg sha256_algs[2] = { { > .digestsize = SHA256_DIGEST_SIZE, > - .init = crypto_sha256_init, > + .init = sha256_base_init, > .update = crypto_sha256_update, > .final = crypto_sha256_final, > .finup = crypto_sha256_finup, > @@ -86,7 +74,7 @@ static struct shash_alg sha256_algs[2] = { { > } > }, { > .digestsize = SHA224_DIGEST_SIZE, > - .init = crypto_sha224_init, > + .init = sha224_base_init, > .update = crypto_sha256_update, > .final = crypto_sha256_final, > .finup = crypto_sha256_finup, Aren't these two functions defined as static inline functions? It appears that these crypto_ wrappers were added so there's "actual" referenceable functions for these structs. Did this actually compile? Thanks, -- Julian Calaby Email: julian.cal...@gmail.com Profile: http://www.google.com/profiles/julian.calaby/
[Bug 215389] pagealloc: memory corruption at building glibc-2.33 and running its' testsuite
https://bugzilla.kernel.org/show_bug.cgi?id=215389 --- Comment #1 from Erhard F. (erhar...@mailbox.org) --- Created attachment 300115 --> https://bugzilla.kernel.org/attachment.cgi?id=300115=edit kernel .config (5.15.10, PowerMac G4 DP) -- You may reply to this email to add a comment. You are receiving this mail because: You are watching the assignee of the bug.
[Bug 215389] New: pagealloc: memory corruption at building glibc-2.33 and running its' testsuite
https://bugzilla.kernel.org/show_bug.cgi?id=215389 Bug ID: 215389 Summary: pagealloc: memory corruption at building glibc-2.33 and running its' testsuite Product: Platform Specific/Hardware Version: 2.5 Kernel Version: 5.15.10 Hardware: PPC-32 OS: Linux Tree: Mainline Status: NEW Severity: normal Priority: P1 Component: PPC-32 Assignee: platform_ppc...@kernel-bugs.osdl.org Reporter: erhar...@mailbox.org Regression: No Created attachment 300113 --> https://bugzilla.kernel.org/attachment.cgi?id=300113=edit dmesg (5.15.10, PowerMac G4 DP) Happens at running the glibc-2.33 testsuite on my G4 DP. [...] [ 5503.973022] pagealloc: memory corruption [ 5503.973226] fffdfff0: 00 00 00 00 [ 5503.973469] CPU: 0 PID: 15826 Comm: ld.so.1 Tainted: GW 5.15.10-gentoo-PowerMacG4 #3 [ 5503.973791] Call Trace: [ 5503.973849] [f61edc20] [c03e8644] dump_stack_lvl+0x60/0x80 (unreliable) [ 5503.974096] [f61edc40] [c016ece8] __kernel_unpoison_pages+0x13c/0x174 [ 5503.974320] [f61edc90] [c015aa64] post_alloc_hook+0x60/0xb4 [ 5503.974511] [f61edcb0] [c015aadc] prep_new_page+0x24/0x5c [ 5503.974687] [f61edcd0] [c015be14] get_page_from_freelist+0x26c/0x548 [ 5503.974898] [f61edd50] [c015c5d8] __alloc_pages+0xc8/0x7a4 [ 5503.975080] [f61eddf0] [c0146470] alloc_zeroed_user_highpage_movable.constprop.0+0x18/0x48 [ 5503.975358] [f61ede10] [c01467a8] wp_page_copy+0x58/0x4a4 [ 5503.975534] [f61ede80] [c0149df4] handle_mm_fault+0x72c/0x864 [ 5503.975725] [f61edf00] [c001a9dc] do_page_fault+0x578/0x6c8 [ 5503.975919] [f61edf30] [c000424c] DataAccess_virt+0xd4/0xe4 [ 5503.976102] --- interrupt: 300 at 0x6ffc5eb0 [ 5503.976228] NIP: 6ffc5eb0 LR: 6ffc5e84 CTR: c0335cb0 [ 5503.976383] REGS: f61edf40 TRAP: 0300 Tainted: GW (5.15.10-gentoo-PowerMacG4) [ 5503.976684] MSR: d032 CR: 840022c8 XER: 2000 [ 5503.976929] DAR: a78032e4 DSISR: 0a00 GPR00: 6ffc60bc af9a9650 a7a15550 0064c9ac 00896b60 0009 bcecbe5c 001282d4 GPR08: 00899280 a78032e4 a7809068 f61edf30 240022c2 6ffece34 008a1a90 0001 GPR16: 0064c9ac 0064c9e8 0064c980 008a1830 0064b8f4 000f 0009 GPR24: 00896b60 bcecbe5c 02c6 a7828774 a76db010 83a7 6fff4cdc 0064c9ac [ 5504.008476] NIP [6ffc5eb0] 0x6ffc5eb0 [ 5504.018630] LR [6ffc5e84] 0x6ffc5e84 [ 5504.028738] --- interrupt: 300 [ 5504.038956] page:ef4c8e34 refcount:1 mapcount:0 mapping: index:0x1 pfn:0x31065 [ 5504.049340] flags: 0x8000(zone=2) [ 5504.059763] raw: 8000 0100 0122 0001 0001 [ 5504.070297] raw: [ 5504.080511] page dumped because: pagealloc: corrupted page details The machine stays usable afterwards. Happened also a 2nd time after a reboot, again at building glibc-2.33 and running testsuite: [...] [ 2946.948834] pagealloc: memory corruption [ 2946.949078] fffcfff0: 00 00 00 00 [ 2946.949419] CPU: 1 PID: 31318 Comm: ld.so.1 Tainted: GW 5.15.10-gentoo-PowerMacG4 #3 [ 2946.949753] Call Trace: [ 2946.949814] [f5c21b00] [c03e8644] dump_stack_lvl+0x60/0x80 (unreliable) [ 2946.950054] [f5c21b20] [c016ece8] __kernel_unpoison_pages+0x13c/0x174 [ 2946.950281] [f5c21b70] [c015aa64] post_alloc_hook+0x60/0xb4 [ 2946.950476] [f5c21b90] [c015aadc] prep_new_page+0x24/0x5c [ 2946.950651] [f5c21bb0] [c015be14] get_page_from_freelist+0x26c/0x548 [ 2946.950865] [f5c21c30] [c015c5d8] __alloc_pages+0xc8/0x7a4 [ 2946.951053] [f5c21cd0] [c011f6d4] pagecache_get_page+0x184/0x1fc [ 2946.951259] [f5c21d30] [c029fd34] prepare_pages+0x80/0x14c [ 2946.951442] [f5c21d80] [c02a28dc] btrfs_buffered_write+0x2b8/0x54c [ 2946.951653] [f5c21e20] [c02a4700] btrfs_file_write_iter+0x340/0x368 [ 2946.951876] [f5c21e70] [c01892fc] vfs_write+0x18c/0x1dc [ 2946.952057] [f5c21ef0] [c0189484] ksys_write+0x74/0xb8 [ 2946.952231] [f5c21f30] [c0015098] ret_from_syscall+0x0/0x28 [ 2946.952420] --- interrupt: c00 at 0x6fecc128 [ 2946.952547] NIP: 6fecc128 LR: 6fecc100 CTR: 0001 [ 2946.952704] REGS: f5c21f40 TRAP: 0c00 Tainted: GW (5.15.10-gentoo-PowerMacG4) [ 2946.953008] MSR: d032 CR: 24022448 XER: [ 2946.953267] GPR00: 0004 afad5d90 a7b83550 0009 afad5e9c 2000 6fecbfe8 GPR08: d032 402c551a 402c5409 f5c21f30 84022448 6ffeee28 007889b0 afad8070 GPR16: afad7fa0 afad8008 8000 0008 00976000 001c5bcc GPR24: afad5e9c 2000 0009 afad7e9c 6ffbaff4 afad5e9c [ 2946.975430] NIP [6fecc128] 0x6fecc128 [ 2946.985730] LR [6fecc100] 0x6fecc100 [ 2946.995992] --- interrupt: c00 [ 2947.006198] page:ef4c8e34 refcount:1
Re: [PATCH v2 09/13] powerpc/ftrace: Implement CONFIG_DYNAMIC_FTRACE_WITH_ARGS
On Mon, 20 Dec 2021, Christophe Leroy wrote: > Implement CONFIG_DYNAMIC_FTRACE_WITH_ARGS. It accelerates the call > of livepatching. > > Also note that powerpc being the last one to convert to > CONFIG_DYNAMIC_FTRACE_WITH_ARGS, it will now be possible to remove > klp_arch_set_pc() on all architectures. Correct. We could replace it ftrace_instruction_pointer_set() and that is it. In fact, livepatch.h in both arch/x86/include/asm/ and arch/s390/include/asm/ could be removed with that. On the other hand, there is arm64 live patching support being worked on and I am not sure what their plans about DYNAMIC_FTRACE_WITH_ARGS are. The above would make it a prerequisite. Adding CCs... you can find the whole thread at https://lore.kernel.org/all/cover.1640017960.git.christophe.le...@csgroup.eu/ Miroslav
Re: [PATCH v2 04/13] powerpc/ftrace: Add support for livepatch to PPC32
On Mon, 20 Dec 2021, Christophe Leroy wrote: > PPC64 needs some special logic to properly set up the TOC. > See commit 85baa095497f ("powerpc/livepatch: Add live patching support > on ppc64le") for details. > > PPC32 doesn't have TOC so it doesn't need that logic, so adding > LIVEPATCH support is straight forward. > > Add CONFIG_LIVEPATCH_64 and move livepatch stack logic into that item. > > Livepatch sample modules all work. Great. > Signed-off-by: Christophe Leroy FWIW the patch looks good to me. Miroslav
Re: [PATCH v2 01/13] livepatch: Fix build failure on 32 bits processors
On Mon, 20 Dec 2021, Christophe Leroy wrote: > Trying to build livepatch on powerpc/32 results in: > > kernel/livepatch/core.c: In function 'klp_resolve_symbols': > kernel/livepatch/core.c:221:23: warning: cast to pointer from integer > of different size [-Wint-to-pointer-cast] > 221 | sym = (Elf64_Sym *)sechdrs[symndx].sh_addr + > ELF_R_SYM(relas[i].r_info); > | ^ > kernel/livepatch/core.c:221:21: error: assignment to 'Elf32_Sym *' {aka > 'struct elf32_sym *'} from incompatible pointer type 'Elf64_Sym *' {aka > 'struct elf64_sym *'} [-Werror=incompatible-pointer-types] > 221 | sym = (Elf64_Sym *)sechdrs[symndx].sh_addr + > ELF_R_SYM(relas[i].r_info); > | ^ > kernel/livepatch/core.c: In function 'klp_apply_section_relocs': > kernel/livepatch/core.c:312:35: error: passing argument 1 of > 'klp_resolve_symbols' from incompatible pointer type > [-Werror=incompatible-pointer-types] > 312 | ret = klp_resolve_symbols(sechdrs, strtab, symndx, sec, > sec_objname); > | ^~~ > | | > | Elf32_Shdr * {aka struct > elf32_shdr *} > kernel/livepatch/core.c:193:44: note: expected 'Elf64_Shdr *' {aka > 'struct elf64_shdr *'} but argument is of type 'Elf32_Shdr *' {aka 'struct > elf32_shdr *'} > 193 | static int klp_resolve_symbols(Elf64_Shdr *sechdrs, const char > *strtab, > |^~~ > > Fix it by using the right types instead of forcing 64 bits types. > > Fixes: 7c8e2bdd5f0d ("livepatch: Apply vmlinux-specific KLP relocations > early") > Signed-off-by: Christophe Leroy > Acked-by: Petr Mladek Acked-by: Miroslav Benes M
Re: [PATCH v1 06/11] powerpc/code-patching: Fix patch_branch() return on out-of-range failure
Le 02/12/2021 à 13:00, Christophe Leroy a écrit : > Do not silentely ignore a failure of create_branch() in > patch_branch(). Return -ERANGE. > > Signed-off-by: Christophe Leroy From https://patchwork.ozlabs.org/project/linuxppc-dev/patch/4940b03de220d1dfe2c6b47a41e60925497ce125.1630657331.git.christophe.le...@csgroup.eu/ Reviewed-by: Naveen N. Rao > --- > arch/powerpc/lib/code-patching.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/arch/powerpc/lib/code-patching.c > b/arch/powerpc/lib/code-patching.c > index a43ca22313ee..e7a2a41ae8eb 100644 > --- a/arch/powerpc/lib/code-patching.c > +++ b/arch/powerpc/lib/code-patching.c > @@ -191,7 +191,9 @@ int patch_branch(u32 *addr, unsigned long target, int > flags) > { > ppc_inst_t instr; > > - create_branch(, addr, target, flags); > + if (create_branch(, addr, target, flags)) > + return -ERANGE; > + > return patch_instruction(addr, instr); > } > >
[PATCH] powerpc/32: Fix boot failure with GCC latent entropy plugin
Boot fails with GCC latent entropy plugin enabled. This is due to early boot functions trying to access 'latent_entropy' global data while the kernel is not relocated at its final destination yet. As there is no way to tell GCC to use PTRRELOC() to access it, disable latent entropy plugin in early_32.o and feature-fixups.o and code-patching.o Reported-by: Erhard Furtner Link: https://bugzilla.kernel.org/show_bug.cgi?id=215217 Signed-off-by: Christophe Leroy Fixes: 38addce8b600 ("gcc-plugins: Add latent_entropy plugin") Cc: sta...@vger.kernel.org Cc: Emese Revfy --- arch/powerpc/kernel/Makefile | 1 + arch/powerpc/lib/Makefile| 3 +++ 2 files changed, 4 insertions(+) diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile index 5fa68c2ef1f8..36f3f5a8868d 100644 --- a/arch/powerpc/kernel/Makefile +++ b/arch/powerpc/kernel/Makefile @@ -11,6 +11,7 @@ CFLAGS_prom_init.o += -fPIC CFLAGS_btext.o += -fPIC endif +CFLAGS_early_32.o += $(DISABLE_LATENT_ENTROPY_PLUGIN) CFLAGS_cputable.o += $(DISABLE_LATENT_ENTROPY_PLUGIN) CFLAGS_prom_init.o += $(DISABLE_LATENT_ENTROPY_PLUGIN) CFLAGS_btext.o += $(DISABLE_LATENT_ENTROPY_PLUGIN) diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile index 9e5d0f413b71..0b08e85d3839 100644 --- a/arch/powerpc/lib/Makefile +++ b/arch/powerpc/lib/Makefile @@ -19,6 +19,9 @@ CFLAGS_code-patching.o += -DDISABLE_BRANCH_PROFILING CFLAGS_feature-fixups.o += -DDISABLE_BRANCH_PROFILING endif +CFLAGS_code-patching.o += $(DISABLE_LATENT_ENTROPY_PLUGIN) +CFLAGS_feature-fixups.o += $(DISABLE_LATENT_ENTROPY_PLUGIN) + obj-y += alloc.o code-patching.o feature-fixups.o pmem.o test_code-patching.o ifndef CONFIG_KASAN -- 2.33.1
Re: [PATCH 4/4] powerpc/perf: Add data source encodings for power10 platform
Em Mon, Dec 06, 2021 at 02:47:49PM +0530, Kajol Jain escreveu: > The code represent memory/cache level data based on PERF_MEM_LVL_* > namespace, which is in the process of deprication in the favour of > newer composite PERF_MEM_{LVLNUM_,REMOTE_,SNOOPX_,HOPS_} fields. > Add data source encodings to represent cache/memory data based on > newer composite PERF_MEM_{LVLNUM_,REMOTE_,SNOOPX_,HOPS_} fields. Thanks, applied. - Arnaldo > Add data source encodings to represent data coming from local > memory/Remote memory/distant memory and remote/distant cache hits. > > Inorder to represent data coming from OpenCAPI cache/memory, we use > LVLNUM "PMEM" field which is used to present persistent memory accesses. > > Result in power10 system with patch changes: > > localhost:# ./perf mem report --sort="mem,sym,dso" --stdio > # Overhead Samples Memory access Symbol >Shared Object > # > .. > # > 29.46% 2331 L1 or L1 hit [.] __random >libc-2.28.so > 23.11% 2121 L1 or L1 hit [.] > producer_populate_cache producer_consumer > 18.56% 1758 L1 or L1 hit [.] __random_r >libc-2.28.so > 15.64% 1559 L2 or L2 hit [.] __random >libc-2.28.so > . > 0.09% 5 Remote socket, same board Any cache hit > [.] __random libc-2.28.so > 0.07% 4 Remote socket, same board Any cache hit > [.] __random libc-2.28.so > . > > Reviewed-by: Madhavan Srinivasan > Signed-off-by: Kajol Jain > --- > arch/powerpc/perf/isa207-common.c | 54 --- > 1 file changed, 42 insertions(+), 12 deletions(-) > > diff --git a/arch/powerpc/perf/isa207-common.c > b/arch/powerpc/perf/isa207-common.c > index 6c6bc8b7d887..4037ea652522 100644 > --- a/arch/powerpc/perf/isa207-common.c > +++ b/arch/powerpc/perf/isa207-common.c > @@ -229,13 +229,28 @@ static inline u64 isa207_find_source(u64 idx, u32 > sub_idx) > ret = PH(LVL, L3) | LEVEL(L3) | P(SNOOP, HIT); > break; > case 4: > - if (sub_idx <= 1) > - ret = PH(LVL, LOC_RAM); > - else if (sub_idx > 1 && sub_idx <= 2) > - ret = PH(LVL, REM_RAM1); > - else > - ret = PH(LVL, REM_RAM2); > - ret |= P(SNOOP, HIT); > + if (cpu_has_feature(CPU_FTR_ARCH_31)) { > + ret = P(SNOOP, HIT); > + > + if (sub_idx == 1) > + ret |= PH(LVL, LOC_RAM) | LEVEL(RAM); > + else if (sub_idx == 2 || sub_idx == 3) > + ret |= P(LVL, HIT) | LEVEL(PMEM); > + else if (sub_idx == 4) > + ret |= PH(LVL, REM_RAM1) | REM | LEVEL(RAM) | > P(HOPS, 2); > + else if (sub_idx == 5 || sub_idx == 7) > + ret |= P(LVL, HIT) | LEVEL(PMEM) | REM; > + else if (sub_idx == 6) > + ret |= PH(LVL, REM_RAM2) | REM | LEVEL(RAM) | > P(HOPS, 3); > + } else { > + if (sub_idx <= 1) > + ret = PH(LVL, LOC_RAM); > + else if (sub_idx > 1 && sub_idx <= 2) > + ret = PH(LVL, REM_RAM1); > + else > + ret = PH(LVL, REM_RAM2); > + ret |= P(SNOOP, HIT); > + } > break; > case 5: > if (cpu_has_feature(CPU_FTR_ARCH_31)) { > @@ -261,11 +276,26 @@ static inline u64 isa207_find_source(u64 idx, u32 > sub_idx) > } > break; > case 6: > - ret = PH(LVL, REM_CCE2); > - if ((sub_idx == 0) || (sub_idx == 2)) > - ret |= P(SNOOP, HIT); > - else if ((sub_idx == 1) || (sub_idx == 3)) > - ret |= P(SNOOP, HITM); > + if (cpu_has_feature(CPU_FTR_ARCH_31)) { > + if (sub_idx == 0) > + ret = PH(LVL, REM_CCE1) | LEVEL(ANY_CACHE) | > REM | > + P(SNOOP, HIT) | P(HOPS, 2); > + else if (sub_idx == 1) > + ret = PH(LVL, REM_CCE1) | LEVEL(ANY_CACHE) | > REM | > + P(SNOOP, HITM) | P(HOPS, 2); > + else if (sub_idx == 2) > + ret = PH(LVL, REM_CCE2) | LEVEL(ANY_CACHE) | > REM | > + P(SNOOP, HIT) | P(HOPS, 3); > + else
Re: [PATCH 3/4] powerpc/perf: Add encodings to represent data based on newer composite PERF_MEM_LVLNUM* fields
Em Mon, Dec 06, 2021 at 02:47:48PM +0530, Kajol Jain escreveu: > The code represent data coming from L1/L2/L3 cache hits based on > PERF_MEM_LVL_* namespace, which is in the process of deprecation in > the favour of newer composite PERF_MEM_{LVLNUM_,REMOTE_,SNOOPX_,HOPS_} > fields. Thanks, applied. - Arnaldo > Add data source encodings to represent L1/L2/L3 cache hits based on > newer composite PERF_MEM_{LVLNUM_,REMOTE_,SNOOPX_,HOPS_} fields for > power10 and older platforms > > Result in power9 system without patch changes: > > localhost:# ./perf mem report --sort="mem,sym,dso" --stdio > # Overhead Samples Memory access Symbol > Shared Object > # > . > # > 29.51% 1 L2 hit[k] perf_event_exec > [kernel.vmlinux] > 27.05% 1 L1 hit[k] perf_ctx_unlock > [kernel.vmlinux] > 13.93% 1 L1 hit[k] vtime_delta > [kernel.vmlinux] > 13.11% 1 L1 hit[k] prepend_path.isra.11 > [kernel.vmlinux] > 8.20% 1 L1 hit[.] > 0038.plt_call.__GI_strlen libc-2.28.so > 8.20% 1 L1 hit[k] perf_event_interrupt > [kernel.vmlinux] > > Result in power9 system with patch changes: > > localhost:# ./perf mem report --sort="mem,sym,dso" --stdio > # Overhead Samples Memory access Symbol >Shared Object > # > .. > # > 36.63% 1 L2 or L2 hit [k] perf_event_exec > [kernel.vmlinux] > 25.50% 1 L1 or L1 hit [k] vtime_delta > [kernel.vmlinux] > 13.12% 1 L1 or L1 hit [k] unmap_region > [kernel.vmlinux] > 12.62% 1 L1 or L1 hit [k] > perf_sample_event_took [kernel.vmlinux] > 6.93% 1 L1 or L1 hit [k] perf_ctx_unlock > [kernel.vmlinux] > 5.20% 1 L1 or L1 hit [.] __memcpy_power7 > libc-2.28.so > > Reviewed-by: Madhavan Srinivasan > Signed-off-by: Kajol Jain > --- > arch/powerpc/perf/isa207-common.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/arch/powerpc/perf/isa207-common.c > b/arch/powerpc/perf/isa207-common.c > index 7ea873ab2e6f..6c6bc8b7d887 100644 > --- a/arch/powerpc/perf/isa207-common.c > +++ b/arch/powerpc/perf/isa207-common.c > @@ -220,13 +220,13 @@ static inline u64 isa207_find_source(u64 idx, u32 > sub_idx) > /* Nothing to do */ > break; > case 1: > - ret = PH(LVL, L1); > + ret = PH(LVL, L1) | LEVEL(L1) | P(SNOOP, HIT); > break; > case 2: > - ret = PH(LVL, L2); > + ret = PH(LVL, L2) | LEVEL(L2) | P(SNOOP, HIT); > break; > case 3: > - ret = PH(LVL, L3); > + ret = PH(LVL, L3) | LEVEL(L3) | P(SNOOP, HIT); > break; > case 4: > if (sub_idx <= 1) > -- > 2.27.0 -- - Arnaldo
Re: [PATCH 2/4] tools/perf: Add new macros for mem_hops field
Em Mon, Dec 06, 2021 at 02:47:47PM +0530, Kajol Jain escreveu: > Add new macros for mem_hops field which can be used to > represent remote-node, socket and board level details. > > Currently the code had macro for HOPS_0 which, corresponds > to data coming from another core but same node. > Add new macros for HOPS_1 to HOPS_3 to represent > remote-node, socket and board level data. > > Also add corresponding strings in the mem_hops array to > represent mem_hop field data in perf_mem__lvl_scnprintf function > > Incase mem_hops field is used, PERF_MEM_LVLNUM field also need > to be set inorder to represent the data source. Hence printing > data source via PERF_MEM_LVL field can be skip in that scenario. > > For ex: Encodings for mem_hops fields with L2 cache: Thanks, applied. - Arnaldo > L2 - local L2 > L2 | REMOTE | HOPS_0- remote core, same node L2 > L2 | REMOTE | HOPS_1- remote node, same socket L2 > L2 | REMOTE | HOPS_2- remote socket, same board L2 > L2 | REMOTE | HOPS_3- remote board L2 > > Signed-off-by: Kajol Jain > --- > tools/include/uapi/linux/perf_event.h | 5 - > tools/perf/util/mem-events.c | 29 +-- > 2 files changed, 22 insertions(+), 12 deletions(-) > > diff --git a/tools/include/uapi/linux/perf_event.h > b/tools/include/uapi/linux/perf_event.h > index bd8860eeb291..4cd39aaccbe7 100644 > --- a/tools/include/uapi/linux/perf_event.h > +++ b/tools/include/uapi/linux/perf_event.h > @@ -1332,7 +1332,10 @@ union perf_mem_data_src { > > /* hop level */ > #define PERF_MEM_HOPS_0 0x01 /* remote core, same node */ > -/* 2-7 available */ > +#define PERF_MEM_HOPS_1 0x02 /* remote node, same socket */ > +#define PERF_MEM_HOPS_2 0x03 /* remote socket, same board */ > +#define PERF_MEM_HOPS_3 0x04 /* remote board */ > +/* 5-7 available */ > #define PERF_MEM_HOPS_SHIFT 43 > > #define PERF_MEM_S(a, s) \ > diff --git a/tools/perf/util/mem-events.c b/tools/perf/util/mem-events.c > index 3167b4628b6d..ed0ab838bcc5 100644 > --- a/tools/perf/util/mem-events.c > +++ b/tools/perf/util/mem-events.c > @@ -309,6 +309,9 @@ static const char * const mem_hops[] = { >* to be set with mem_hops field. >*/ > "core, same node", > + "node, same socket", > + "socket, same board", > + "board", > }; > > int perf_mem__lvl_scnprintf(char *out, size_t sz, struct mem_info *mem_info) > @@ -316,7 +319,7 @@ int perf_mem__lvl_scnprintf(char *out, size_t sz, struct > mem_info *mem_info) > size_t i, l = 0; > u64 m = PERF_MEM_LVL_NA; > u64 hit, miss; > - int printed; > + int printed = 0; > > if (mem_info) > m = mem_info->data_src.mem_lvl; > @@ -335,18 +338,22 @@ int perf_mem__lvl_scnprintf(char *out, size_t sz, > struct mem_info *mem_info) > l += 7; > } > > - if (mem_info && mem_info->data_src.mem_hops) > + /* > + * Incase mem_hops field is set, we can skip printing data source via > + * PERF_MEM_LVL namespace. > + */ > + if (mem_info && mem_info->data_src.mem_hops) { > l += scnprintf(out + l, sz - l, "%s ", > mem_hops[mem_info->data_src.mem_hops]); > - > - printed = 0; > - for (i = 0; m && i < ARRAY_SIZE(mem_lvl); i++, m >>= 1) { > - if (!(m & 0x1)) > - continue; > - if (printed++) { > - strcat(out, " or "); > - l += 4; > + } else { > + for (i = 0; m && i < ARRAY_SIZE(mem_lvl); i++, m >>= 1) { > + if (!(m & 0x1)) > + continue; > + if (printed++) { > + strcat(out, " or "); > + l += 4; > + } > + l += scnprintf(out + l, sz - l, mem_lvl[i]); > } > - l += scnprintf(out + l, sz - l, mem_lvl[i]); > } > > if (mem_info && mem_info->data_src.mem_lvl_num) { > -- > 2.27.0 -- - Arnaldo
[BISECTED] power8: watchdog: CPU 3 self-detected hard LOCKUP @ queued_spin_lock_slowpath+0x154/0x2d0
Hi, After upgrading my Power8 server from 5.10 LTS to 5.15 LTS, I started experiencing CPU hard lockups, usually rather quickly after boot: watchdog: CPU 3 self-detected hard LOCKUP @ queued_spin_lock_slowpath+0x154/0x2d0 watchdog: CPU 3 TB:265651929071, last heartbeat TB:259344820187 (12318ms ago) watchdog: CPU 4 self-detected hard LOCKUP @ queued_spin_lock_slowpath+0x22c/0x2d0 watchdog: CPU 4 TB:265651929059, last heartbeat TB:259344820045 (12318ms ago) watchdog: CPU 5 self-detected hard LOCKUP @ queued_spin_lock_slowpath+0x230/0x2d0 watchdog: CPU 5 TB:265651929037, last heartbeat TB:259349940303 (12308ms ago) watchdog: CPU 6 self-detected hard LOCKUP @ queued_spin_lock_slowpath+0x144/0x2d0 watchdog: CPU 6 TB:265651929056, last heartbeat TB:259349940294 (12308ms ago) watchdog: CPU 12 self-detected hard LOCKUP @ queued_spin_lock_slowpath+0x280/0x2d0 watchdog: CPU 12 TB:242479050267, last heartbeat TB:236822174350 (11048ms ago) watchdog: CPU 26 self-detected hard LOCKUP @ queued_spin_lock_slowpath+0x22c/0x2d0 watchdog: CPU 26 TB:265657049348, last heartbeat TB:259355060595 (12308ms ago) watchdog: CPU 40 self-detected hard LOCKUP @ queued_spin_lock_slowpath+0x230/0x2d0 watchdog: CPU 40 TB:265657049289, last heartbeat TB:259360180427 (12298ms ago) watchdog: CPU 47 self-detected hard LOCKUP @ queued_spin_lock_slowpath+0x21c/0x2d0 watchdog: CPU 47 TB:265657049213, last heartbeat TB:259365300321 (12288ms ago) watchdog: CPU 60 self-detected hard LOCKUP @ queued_spin_lock_slowpath+0x230/0x2d0 watchdog: CPU 60 TB:265651929348, last heartbeat TB:259370420527 (12268ms ago) watchdog: CPU 72 self-detected hard LOCKUP @ queued_spin_lock_slowpath+0x230/0x2d0 watchdog: CPU 72 TB:265718488733, last heartbeat TB:259375540545 (12388ms ago) watchdog: CPU 13 detected hard LOCKUP on other CPUs 0-2,7,10,44 watchdog: CPU 13 TB:267541867921, last SMP heartbeat TB:259380660378 (15939ms ago) watchdog: CPU 34 self-detected hard LOCKUP @ queued_spin_lock_slowpath+0x230/0x2d0 watchdog: CPU 34 TB:269913954376, last heartbeat TB:263456144470 (12612ms ago) watchdog: CPU 41 self-detected hard LOCKUP @ queued_spin_lock_slowpath+0x230/0x2d0 watchdog: CPU 41 TB:267865972392, last heartbeat TB:261408162383 (12612ms ago) watchdog: CPU 74 self-detected hard LOCKUP @ queued_spin_lock_slowpath+0x230/0x2d0 watchdog: CPU 74 TB:267766470637, last heartbeat TB:261423522630 (12388ms ago) watchdog: CPU 8 self-detected hard LOCKUP @ queued_spin_lock_slowpath+0x230/0x2d0 watchdog: CPU 8 TB:274978264599, last heartbeat TB:269237436681 (11212ms ago) watchdog: CPU 9 self-detected hard LOCKUP @ queued_spin_lock_slowpath+0x230/0x2d0 watchdog: CPU 9 TB:268029810836, last heartbeat TB:261397922093 (12952ms ago) watchdog: CPU 11 self-detected hard LOCKUP @ queued_spin_lock_slowpath+0x230/0x2d0 watchdog: CPU 11 TB:279685725759, last heartbeat TB:273685814104 (11718ms ago) watchdog: CPU 16 self-detected hard LOCKUP @ queued_spin_lock_slowpath+0x230/0x2d0 watchdog: CPU 16 TB:267865972449, last heartbeat TB:261397922458 (12632ms ago) watchdog: CPU 18 self-detected hard LOCKUP @ queued_spin_lock_slowpath+0x230/0x2d0 watchdog: CPU 18 TB:269913954314, last heartbeat TB:263445904285 (12632ms ago) watchdog: CPU 24 self-detected hard LOCKUP @ queued_spin_lock_slowpath+0x230/0x2d0 watchdog: CPU 24 TB:267865972338, last heartbeat TB:261403042311 (12622ms ago) watchdog: CPU 31 self-detected hard LOCKUP @ queued_spin_lock_slowpath+0x22c/0x2d0 watchdog: CPU 31 TB:268029811095, last heartbeat TB:261403042673 (12942ms ago) watchdog: CPU 32 self-detected hard LOCKUP @ queued_spin_lock_slowpath+0x230/0x2d0 watchdog: CPU 32 TB:267865972528, last heartbeat TB:261403042589 (12622ms ago) watchdog: CPU 33 self-detected hard LOCKUP @ queued_spin_lock_slowpath+0x230/0x2d0 watchdog: CPU 33 TB:268029811013, last heartbeat TB:261408162474 (12932ms ago) watchdog: CPU 35 self-detected hard LOCKUP @ queued_spin_lock_slowpath+0x230/0x2d0 watchdog: CPU 35 TB:280174344471, last heartbeat TB:273696054625 (12652ms ago) watchdog: CPU 37 self-detected hard LOCKUP @ queued_spin_lock_slowpath+0x230/0x2d0 watchdog: CPU 37 TB:269913954356, last heartbeat TB:263456144501 (12612ms ago) watchdog: CPU 38 self-detected hard LOCKUP @ queued_spin_lock_slowpath+0x228/0x2d0 watchdog: CPU 38 TB:290393774681, last heartbeat TB:283946212510 (12592ms ago) Bisecting lead to the following commit: deb9b13eb2571fbde164ae012c77985fd14f2f02 is the first bad commit commit deb9b13eb2571fbde164ae012c77985fd14f2f02 Author: Davidlohr Bueso Date: Mon Mar 8 17:59:50 2021 -0800 powerpc/qspinlock: Use generic smp_cond_load_relaxed The problem persists in 2f47a9a4dfa3674fad19a49b40c5103a9a8e1589 and goes away if I revert deb9b13eb2571fbde164ae012c77985fd14f2f02 on top of that. As deb9b13eb2571fbde164ae012c77985fd14f2f02 seems to be a revert of 49a7d46a06c30c7beabbf9d1a8ea1de0f9e4fdfe, I suspect this problem might have existed before 49a7d46a06c30c7beabbf9d1a8ea1de0f9e4fdfe. I therefore tried to build
Re: [PATCH 1/3] powerpc/64s: Mask NIP before checking against SRR0
> On 21-Dec-2021, at 7:20 PM, Michael Ellerman wrote: > > When CONFIG_PPC_RFI_SRR_DEBUG=y we check that NIP and SRR0 match when > returning from interrupts. This can trigger falsely if NIP has either of > its two low bits set via sigreturn or ptrace, while SRR0 has its low two > bits masked in hardware. > > As a quick fix make sure to mask the low bits before doing the check. > > Fixes: 59dc5bfca0cb ("powerpc/64s: avoid reloading (H)SRR registers if they > are still valid") > Reported-by: Sachin Sant > Signed-off-by: Michael Ellerman > --- Tested this 3 patch series successfully (with and without PPC_RFI_SRR_DEBUG) on Power9/Power10 LPAR as well as Power9 PowerNV. Tested-by: Sachin Sant
Re: [PATCH 3/3] powerpc/vdso: Merge vdso64 and vdso32 into a single directory
Le 22/12/2021 à 10:25, kernel test robot a écrit : > Hi Christophe, > > I love your patch! Yet something to improve: > > [auto build test ERROR on powerpc/next] > [also build test ERROR on v5.16-rc6 next-20211221] > [If your patch is applied to the wrong git tree, kindly drop us a note. > And when submitting patch, we suggest to use '--base' as documented in > https://git-scm.com/docs/git-format-patch] > > url: > https://github.com/0day-ci/linux/commits/Christophe-Leroy/powerpc-vdso-augment-VDSO32-functions-to-support-64-bits-build/20211222-021033 > base: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next > config: powerpc-randconfig-r023-20211222 > (https://download.01.org/0day-ci/archive/20211222/202112221723.qyvrcjhe-...@intel.com/config) > compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project > de4e0195ae1c39f1c3b07834b8e32c113f4f20eb) > reproduce (this is a W=1 build): > wget > https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O > ~/bin/make.cross > chmod +x ~/bin/make.cross > # install powerpc cross compiling tool for clang build > # apt-get install binutils-powerpc-linux-gnu > # > https://github.com/0day-ci/linux/commit/16137812dbb55d25ebe3962d5fb7486cb5b43311 > git remote add linux-review https://github.com/0day-ci/linux > git fetch --no-tags linux-review > Christophe-Leroy/powerpc-vdso-augment-VDSO32-functions-to-support-64-bits-build/20211222-021033 > git checkout 16137812dbb55d25ebe3962d5fb7486cb5b43311 > # save the config file to linux build tree > mkdir build_dir > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 > O=build_dir ARCH=powerpc prepare > > If you fix the issue, kindly add following tag as appropriate > Reported-by: kernel test robot > > All errors (new ones prefixed by >>): > > :1559:2: warning: syscall futex_waitv not implemented [-W#warnings] > #warning syscall futex_waitv not implemented > ^ > 1 warning generated. >>> arch/powerpc/kernel/vdso/gettimeofday.S:75:8: error: unsupported directive >>> '.stabs' > .stabs "_restgpr_31_x:F-1",36,0,0,_restgpr_31_x; .globl _restgpr_31_x; > _restgpr_31_x: >^ > arch/powerpc/kernel/vdso/gettimeofday.S:76:8: error: unsupported > directive '.stabs' > .stabs "_rest32gpr_31_x:F-1",36,0,0,_rest32gpr_31_x; .globl > _rest32gpr_31_x; _rest32gpr_31_x: This problem is unrelated to this patch, you can see below it is from 2021-03-09, and it isn't even introduced by that commit but only by the fact that it uses _GLOBAL() which has existed for years. Anyway, there is already a patch to fix it at https://patchwork.ozlabs.org/project/linuxppc-dev/patch/68932ec2ba6b868d35006b96e90f0890f3da3c05.1638273868.git.christophe.le...@csgroup.eu/ >^ > make[2]: *** [arch/powerpc/kernel/vdso/Makefile:71: > arch/powerpc/kernel/vdso/gettimeofday-32.o] Error 1 > make[2]: Target 'include/generated/vdso32-offsets.h' not remade because > of errors. > make[1]: *** [arch/powerpc/Makefile:421: vdso_prepare] Error 2 > make[1]: Target 'prepare' not remade because of errors. > make: *** [Makefile:219: __sub-make] Error 2 > make: Target 'prepare' not remade because of errors. > > > vim +75 arch/powerpc/kernel/vdso/gettimeofday.S > > 08c18b63d9656e arch/powerpc/kernel/vdso32/gettimeofday.S Christophe Leroy > 2021-03-09 70 > 08c18b63d9656e arch/powerpc/kernel/vdso32/gettimeofday.S Christophe Leroy > 2021-03-09 71 /* Routines for restoring integer registers, called by the > compiler. */ > 08c18b63d9656e arch/powerpc/kernel/vdso32/gettimeofday.S Christophe Leroy > 2021-03-09 72 /* Called with r11 pointing to the stack header word of the > caller of the */ > 08c18b63d9656e arch/powerpc/kernel/vdso32/gettimeofday.S Christophe Leroy > 2021-03-09 73 /* function, just beyond the end of the integer restore area. > */ > 11f0a078a8b6be arch/powerpc/kernel/vdso32/gettimeofday.S Christophe Leroy > 2021-12-21 74 #ifndef __powerpc64__ > 08c18b63d9656e arch/powerpc/kernel/vdso32/gettimeofday.S Christophe Leroy > 2021-03-09 @75 _GLOBAL(_restgpr_31_x) > > --- > 0-DAY CI Kernel Test Service, Intel Corporation > https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org >
Re: [PATCH 3/3] powerpc/vdso: Merge vdso64 and vdso32 into a single directory
Hi Christophe, I love your patch! Yet something to improve: [auto build test ERROR on powerpc/next] [also build test ERROR on v5.16-rc6 next-20211221] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Christophe-Leroy/powerpc-vdso-augment-VDSO32-functions-to-support-64-bits-build/20211222-021033 base: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next config: powerpc-randconfig-r023-20211222 (https://download.01.org/0day-ci/archive/20211222/202112221723.qyvrcjhe-...@intel.com/config) compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project de4e0195ae1c39f1c3b07834b8e32c113f4f20eb) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # install powerpc cross compiling tool for clang build # apt-get install binutils-powerpc-linux-gnu # https://github.com/0day-ci/linux/commit/16137812dbb55d25ebe3962d5fb7486cb5b43311 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Christophe-Leroy/powerpc-vdso-augment-VDSO32-functions-to-support-64-bits-build/20211222-021033 git checkout 16137812dbb55d25ebe3962d5fb7486cb5b43311 # save the config file to linux build tree mkdir build_dir COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=powerpc prepare If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All errors (new ones prefixed by >>): :1559:2: warning: syscall futex_waitv not implemented [-W#warnings] #warning syscall futex_waitv not implemented ^ 1 warning generated. >> arch/powerpc/kernel/vdso/gettimeofday.S:75:8: error: unsupported directive >> '.stabs' .stabs "_restgpr_31_x:F-1",36,0,0,_restgpr_31_x; .globl _restgpr_31_x; _restgpr_31_x: ^ arch/powerpc/kernel/vdso/gettimeofday.S:76:8: error: unsupported directive '.stabs' .stabs "_rest32gpr_31_x:F-1",36,0,0,_rest32gpr_31_x; .globl _rest32gpr_31_x; _rest32gpr_31_x: ^ make[2]: *** [arch/powerpc/kernel/vdso/Makefile:71: arch/powerpc/kernel/vdso/gettimeofday-32.o] Error 1 make[2]: Target 'include/generated/vdso32-offsets.h' not remade because of errors. make[1]: *** [arch/powerpc/Makefile:421: vdso_prepare] Error 2 make[1]: Target 'prepare' not remade because of errors. make: *** [Makefile:219: __sub-make] Error 2 make: Target 'prepare' not remade because of errors. vim +75 arch/powerpc/kernel/vdso/gettimeofday.S 08c18b63d9656e arch/powerpc/kernel/vdso32/gettimeofday.S Christophe Leroy 2021-03-09 70 08c18b63d9656e arch/powerpc/kernel/vdso32/gettimeofday.S Christophe Leroy 2021-03-09 71 /* Routines for restoring integer registers, called by the compiler. */ 08c18b63d9656e arch/powerpc/kernel/vdso32/gettimeofday.S Christophe Leroy 2021-03-09 72 /* Called with r11 pointing to the stack header word of the caller of the */ 08c18b63d9656e arch/powerpc/kernel/vdso32/gettimeofday.S Christophe Leroy 2021-03-09 73 /* function, just beyond the end of the integer restore area. */ 11f0a078a8b6be arch/powerpc/kernel/vdso32/gettimeofday.S Christophe Leroy 2021-12-21 74 #ifndef __powerpc64__ 08c18b63d9656e arch/powerpc/kernel/vdso32/gettimeofday.S Christophe Leroy 2021-03-09 @75 _GLOBAL(_restgpr_31_x) --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org
[PATCH v2] powerpc/cell/axon_msi: replace DEFINE_SIMPLE_ATTRIBUTE with DEFINE_DEBUGFS_ATTRIBUTE
From: Changcheng Deng Fix the following coccicheck warning: ./arch/powerpc/platforms/cell/axon_msi.c: 456: 0-23: WARNING: fops_msic should be defined with DEFINE_DEBUGFS_ATTRIBUTE DEFINE_SIMPLE_ATTRIBUTE + debugfs_create_file() imposes some significant overhead as compared to DEFINE_DEBUGFS_ATTRIBUTE + debugfs_create_file_unsafe(). Reported-by: Zeal Robot Signed-off-by: Changcheng Deng --- arch/powerpc/platforms/cell/axon_msi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/platforms/cell/axon_msi.c b/arch/powerpc/platforms/cell/axon_msi.c index 354a58c1e6f2..362c1efe4180 100644 --- a/arch/powerpc/platforms/cell/axon_msi.c +++ b/arch/powerpc/platforms/cell/axon_msi.c @@ -453,7 +453,7 @@ static int msic_get(void *data, u64 *val) return 0; } -DEFINE_SIMPLE_ATTRIBUTE(fops_msic, msic_get, msic_set, "%llu\n"); +DEFINE_DEBUGFS_ATTRIBUTE(fops_msic, msic_get, msic_set, "%llu\n"); void axon_msi_debug_setup(struct device_node *dn, struct axon_msic *msic) { @@ -474,6 +474,6 @@ void axon_msi_debug_setup(struct device_node *dn, struct axon_msic *msic) snprintf(name, sizeof(name), "msic_%d", of_node_to_nid(dn)); - debugfs_create_file(name, 0600, arch_debugfs_dir, msic, _msic); + debugfs_create_file_unsafe(name, 0600, arch_debugfs_dir, msic, _msic); } #endif /* DEBUG */ -- 2.25.1
Re: [PATCH 4/8] sched: powerpc: Remove unused TASK_SIZE_OF
Got it. Thx On Wed, Dec 22, 2021 at 3:27 PM Christophe Leroy wrote: > > > > Le 22/12/2021 à 04:02, Guo Ren a écrit : > > On Wed, Dec 22, 2021 at 2:43 AM Christophe Leroy > > wrote: > >> > >> > >> > >> Le 21/12/2021 à 18:00, guo...@kernel.org a écrit : > >>> From: Guo Ren > >>> > >>> This macro isn't used in Linux sched, now. Delete in > >>> include/linux/sched.h and arch's include/asm. > >>> > >>> Signed-off-by: Guo Ren > >>> --- > >>>arch/powerpc/include/asm/task_size_64.h | 6 ++ > >>>1 file changed, 2 insertions(+), 4 deletions(-) > >>> > >>> diff --git a/arch/powerpc/include/asm/task_size_64.h > >>> b/arch/powerpc/include/asm/task_size_64.h > >>> index c993482237ed..7e2eca4fac4d 100644 > >>> --- a/arch/powerpc/include/asm/task_size_64.h > >>> +++ b/arch/powerpc/include/asm/task_size_64.h > >>> @@ -44,12 +44,10 @@ > >>> */ > >>>#define TASK_SIZE_USER32 (0x0001UL - (1 * PAGE_SIZE)) > >>> > >>> -#define TASK_SIZE_OF(tsk)\ > >>> - (test_tsk_thread_flag(tsk, TIF_32BIT) ? TASK_SIZE_USER32 : \ > >>> +#define TASK_SIZE\ > >>> + (test_tsk_thread_flag(current, TIF_32BIT) ? TASK_SIZE_USER32 : \ > >>>TASK_SIZE_USER64) > >> > >> I think you should use test_thread_flag() instead. > >> > >> Or even better: use is_32bit_task() and bring back this macro as a > >> single line, something like: > >> > >> #define TASK_SIZE (is_32bit_task() ? TASK_SIZE_USER32 : TASK_SIZE_USER64) > > Okay, looks better. I would fix it in the next version. > > Note that is_32bit_task() exists on powerpc, parisc and sparc. > > For other ones you can still use test_thread_flag() instead of > test_tsk_thread_flag(current) -- Best Regards Guo Ren ML: https://lore.kernel.org/linux-csky/