Merge tag 'pstore-v4.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux
Pull pstore updates from Kees Cook: "Improvements and fixes to pstore subsystem: - add additional checks for bad platform data - remove bounce buffer in console writer - protect read/unlink race with a mutex - correctly give up during dump locking failures - increase ftrace bandwidth by splitting ftrace buffers per CPU" * tag 'pstore-v4.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux: ramoops: add pdata NULL check to ramoops_probe pstore: Convert console write to use ->write_buf pstore: Protect unlink with read_mutex pstore: Use global ftrace filters for function trace filtering ftrace: Provide API to use global filtering for ftrace ops pstore: Clarify context field przs as dprzs pstore: improve error report for failed setup pstore: Merge per-CPU ftrace records into one pstore: Add ftrace timestamp counter ramoops: Split ftrace buffer space into per-CPU zones pstore: Make ramoops_init_przs generic for other prz arrays pstore: Allow prz to control need for locking pstore: Warn on PSTORE_TYPE_PMSG using deprecated function pstore: Make spinlock per zone instead of global pstore: Actually give up during locking failure
This commit is contained in:
@@ -398,6 +398,7 @@ int ftrace_set_notrace(struct ftrace_ops *ops, unsigned char *buf,
|
||||
void ftrace_set_global_filter(unsigned char *buf, int len, int reset);
|
||||
void ftrace_set_global_notrace(unsigned char *buf, int len, int reset);
|
||||
void ftrace_free_filter(struct ftrace_ops *ops);
|
||||
void ftrace_ops_set_global_filter(struct ftrace_ops *ops);
|
||||
|
||||
int register_ftrace_command(struct ftrace_func_command *cmd);
|
||||
int unregister_ftrace_command(struct ftrace_func_command *cmd);
|
||||
@@ -645,6 +646,7 @@ static inline unsigned long ftrace_location(unsigned long ip)
|
||||
#define ftrace_set_filter(ops, buf, len, reset) ({ -ENODEV; })
|
||||
#define ftrace_set_notrace(ops, buf, len, reset) ({ -ENODEV; })
|
||||
#define ftrace_free_filter(ops) do { } while (0)
|
||||
#define ftrace_ops_set_global_filter(ops) do { } while (0)
|
||||
|
||||
static inline ssize_t ftrace_filter_write(struct file *file, const char __user *ubuf,
|
||||
size_t cnt, loff_t *ppos) { return -ENODEV; }
|
||||
|
@@ -89,4 +89,80 @@ extern int pstore_register(struct pstore_info *);
|
||||
extern void pstore_unregister(struct pstore_info *);
|
||||
extern bool pstore_cannot_block_path(enum kmsg_dump_reason reason);
|
||||
|
||||
struct pstore_ftrace_record {
|
||||
unsigned long ip;
|
||||
unsigned long parent_ip;
|
||||
u64 ts;
|
||||
};
|
||||
|
||||
/*
|
||||
* ftrace related stuff: Both backends and frontends need these so expose
|
||||
* them here.
|
||||
*/
|
||||
|
||||
#if NR_CPUS <= 2 && defined(CONFIG_ARM_THUMB)
|
||||
#define PSTORE_CPU_IN_IP 0x1
|
||||
#elif NR_CPUS <= 4 && defined(CONFIG_ARM)
|
||||
#define PSTORE_CPU_IN_IP 0x3
|
||||
#endif
|
||||
|
||||
#define TS_CPU_SHIFT 8
|
||||
#define TS_CPU_MASK (BIT(TS_CPU_SHIFT) - 1)
|
||||
|
||||
/*
|
||||
* If CPU number can be stored in IP, store it there, otherwise store it in
|
||||
* the time stamp. This means more timestamp resolution is available when
|
||||
* the CPU can be stored in the IP.
|
||||
*/
|
||||
#ifdef PSTORE_CPU_IN_IP
|
||||
static inline void
|
||||
pstore_ftrace_encode_cpu(struct pstore_ftrace_record *rec, unsigned int cpu)
|
||||
{
|
||||
rec->ip |= cpu;
|
||||
}
|
||||
|
||||
static inline unsigned int
|
||||
pstore_ftrace_decode_cpu(struct pstore_ftrace_record *rec)
|
||||
{
|
||||
return rec->ip & PSTORE_CPU_IN_IP;
|
||||
}
|
||||
|
||||
static inline u64
|
||||
pstore_ftrace_read_timestamp(struct pstore_ftrace_record *rec)
|
||||
{
|
||||
return rec->ts;
|
||||
}
|
||||
|
||||
static inline void
|
||||
pstore_ftrace_write_timestamp(struct pstore_ftrace_record *rec, u64 val)
|
||||
{
|
||||
rec->ts = val;
|
||||
}
|
||||
#else
|
||||
static inline void
|
||||
pstore_ftrace_encode_cpu(struct pstore_ftrace_record *rec, unsigned int cpu)
|
||||
{
|
||||
rec->ts &= ~(TS_CPU_MASK);
|
||||
rec->ts |= cpu;
|
||||
}
|
||||
|
||||
static inline unsigned int
|
||||
pstore_ftrace_decode_cpu(struct pstore_ftrace_record *rec)
|
||||
{
|
||||
return rec->ts & TS_CPU_MASK;
|
||||
}
|
||||
|
||||
static inline u64
|
||||
pstore_ftrace_read_timestamp(struct pstore_ftrace_record *rec)
|
||||
{
|
||||
return rec->ts >> TS_CPU_SHIFT;
|
||||
}
|
||||
|
||||
static inline void
|
||||
pstore_ftrace_write_timestamp(struct pstore_ftrace_record *rec, u64 val)
|
||||
{
|
||||
rec->ts = (rec->ts & TS_CPU_MASK) | (val << TS_CPU_SHIFT);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /*_LINUX_PSTORE_H*/
|
||||
|
@@ -24,6 +24,13 @@
|
||||
#include <linux/list.h>
|
||||
#include <linux/types.h>
|
||||
|
||||
/*
|
||||
* Choose whether access to the RAM zone requires locking or not. If a zone
|
||||
* can be written to from different CPUs like with ftrace for example, then
|
||||
* PRZ_FLAG_NO_LOCK is used. For all other cases, locking is required.
|
||||
*/
|
||||
#define PRZ_FLAG_NO_LOCK BIT(0)
|
||||
|
||||
struct persistent_ram_buffer;
|
||||
struct rs_control;
|
||||
|
||||
@@ -40,6 +47,8 @@ struct persistent_ram_zone {
|
||||
void *vaddr;
|
||||
struct persistent_ram_buffer *buffer;
|
||||
size_t buffer_size;
|
||||
u32 flags;
|
||||
raw_spinlock_t buffer_lock;
|
||||
|
||||
/* ECC correction */
|
||||
char *par_buffer;
|
||||
@@ -55,7 +64,7 @@ struct persistent_ram_zone {
|
||||
|
||||
struct persistent_ram_zone *persistent_ram_new(phys_addr_t start, size_t size,
|
||||
u32 sig, struct persistent_ram_ecc_info *ecc_info,
|
||||
unsigned int memtype);
|
||||
unsigned int memtype, u32 flags);
|
||||
void persistent_ram_free(struct persistent_ram_zone *prz);
|
||||
void persistent_ram_zap(struct persistent_ram_zone *prz);
|
||||
|
||||
@@ -77,6 +86,8 @@ ssize_t persistent_ram_ecc_string(struct persistent_ram_zone *prz,
|
||||
* @mem_address physical memory address to contain ramoops
|
||||
*/
|
||||
|
||||
#define RAMOOPS_FLAG_FTRACE_PER_CPU BIT(0)
|
||||
|
||||
struct ramoops_platform_data {
|
||||
unsigned long mem_size;
|
||||
phys_addr_t mem_address;
|
||||
@@ -86,6 +97,7 @@ struct ramoops_platform_data {
|
||||
unsigned long ftrace_size;
|
||||
unsigned long pmsg_size;
|
||||
int dump_oops;
|
||||
u32 flags;
|
||||
struct persistent_ram_ecc_info ecc_info;
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user