Skip to content

Commit 01b0c01

Browse files
committed
Merge branch 'akpm' (patches from Andrew)
Merge fourth patch-bomb from Andrew Morton: - sys_membarier syscall - seq_file interface changes - a few misc fixups * emailed patches from Andrew Morton <akpm@linux-foundation.org>: revert "ocfs2/dlm: use list_for_each_entry instead of list_for_each" mm/early_ioremap: add explicit #include of asm/early_ioremap.h fs/seq_file: convert int seq_vprint/seq_printf/etc... returns to void selftests: enhance membarrier syscall test selftests: add membarrier syscall test sys_membarrier(): system-wide memory barrier (generic, x86) MODSIGN: fix a compilation warning in extract-cert
2 parents 3ebb054 + e527b22 commit 01b0c01

File tree

22 files changed

+336
-54
lines changed

22 files changed

+336
-54
lines changed

MAINTAINERS

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6789,6 +6789,14 @@ W: http://www.mellanox.com
67896789
Q: http://patchwork.ozlabs.org/project/netdev/list/
67906790
F: drivers/net/ethernet/mellanox/mlxsw/
67916791

6792+
MEMBARRIER SUPPORT
6793+
M: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6794+
M: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
6795+
L: linux-kernel@vger.kernel.org
6796+
S: Supported
6797+
F: kernel/membarrier.c
6798+
F: include/uapi/linux/membarrier.h
6799+
67926800
MEMORY MANAGEMENT
67936801
L: linux-mm@kvack.org
67946802
W: http://www.linux-mm.org

arch/x86/entry/syscalls/syscall_32.tbl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,3 +381,4 @@
381381
372 i386 recvmsg sys_recvmsg compat_sys_recvmsg
382382
373 i386 shutdown sys_shutdown
383383
374 i386 userfaultfd sys_userfaultfd
384+
375 i386 membarrier sys_membarrier

arch/x86/entry/syscalls/syscall_64.tbl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,7 @@
330330
321 common bpf sys_bpf
331331
322 64 execveat stub_execveat
332332
323 common userfaultfd sys_userfaultfd
333+
324 common membarrier sys_membarrier
333334

334335
#
335336
# x32-specific system call numbers start at 512 to avoid cache impact

drivers/iommu/omap-iommu-debug.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,9 @@ __dump_tlb_entries(struct omap_iommu *obj, struct cr_regs *crs, int num)
135135
static ssize_t iotlb_dump_cr(struct omap_iommu *obj, struct cr_regs *cr,
136136
struct seq_file *s)
137137
{
138-
return seq_printf(s, "%08x %08x %01x\n", cr->cam, cr->ram,
138+
seq_printf(s, "%08x %08x %01x\n", cr->cam, cr->ram,
139139
(cr->cam & MMU_CAM_P) ? 1 : 0);
140+
return 0;
140141
}
141142

142143
static size_t omap_dump_tlb_entries(struct omap_iommu *obj, struct seq_file *s)

fs/nsfs.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,8 @@ static int nsfs_show_path(struct seq_file *seq, struct dentry *dentry)
142142
struct inode *inode = d_inode(dentry);
143143
const struct proc_ns_operations *ns_ops = dentry->d_fsdata;
144144

145-
return seq_printf(seq, "%s:[%lu]", ns_ops->name, inode->i_ino);
145+
seq_printf(seq, "%s:[%lu]", ns_ops->name, inode->i_ino);
146+
return 0;
146147
}
147148

148149
static const struct super_operations nsfs_ops = {

fs/ocfs2/dlm/dlmrecovery.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1776,7 +1776,7 @@ static int dlm_process_recovery_data(struct dlm_ctxt *dlm,
17761776
struct dlm_migratable_lockres *mres)
17771777
{
17781778
struct dlm_migratable_lock *ml;
1779-
struct list_head *queue;
1779+
struct list_head *queue, *iter;
17801780
struct list_head *tmpq = NULL;
17811781
struct dlm_lock *newlock = NULL;
17821782
struct dlm_lockstatus *lksb = NULL;
@@ -1821,7 +1821,9 @@ static int dlm_process_recovery_data(struct dlm_ctxt *dlm,
18211821
spin_lock(&res->spinlock);
18221822
for (j = DLM_GRANTED_LIST; j <= DLM_BLOCKED_LIST; j++) {
18231823
tmpq = dlm_list_idx_to_ptr(res, j);
1824-
list_for_each_entry(lock, tmpq, list) {
1824+
list_for_each(iter, tmpq) {
1825+
lock = list_entry(iter,
1826+
struct dlm_lock, list);
18251827
if (lock->ml.cookie == ml->cookie)
18261828
break;
18271829
lock = NULL;

fs/seq_file.c

Lines changed: 31 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -372,16 +372,16 @@ EXPORT_SYMBOL(seq_release);
372372
* @esc: set of characters that need escaping
373373
*
374374
* Puts string into buffer, replacing each occurrence of character from
375-
* @esc with usual octal escape. Returns 0 in case of success, -1 - in
376-
* case of overflow.
375+
* @esc with usual octal escape.
376+
* Use seq_has_overflowed() to check for errors.
377377
*/
378-
int seq_escape(struct seq_file *m, const char *s, const char *esc)
378+
void seq_escape(struct seq_file *m, const char *s, const char *esc)
379379
{
380380
char *end = m->buf + m->size;
381-
char *p;
381+
char *p;
382382
char c;
383383

384-
for (p = m->buf + m->count; (c = *s) != '\0' && p < end; s++) {
384+
for (p = m->buf + m->count; (c = *s) != '\0' && p < end; s++) {
385385
if (!strchr(esc, c)) {
386386
*p++ = c;
387387
continue;
@@ -394,39 +394,34 @@ int seq_escape(struct seq_file *m, const char *s, const char *esc)
394394
continue;
395395
}
396396
seq_set_overflow(m);
397-
return -1;
398-
}
397+
return;
398+
}
399399
m->count = p - m->buf;
400-
return 0;
401400
}
402401
EXPORT_SYMBOL(seq_escape);
403402

404-
int seq_vprintf(struct seq_file *m, const char *f, va_list args)
403+
void seq_vprintf(struct seq_file *m, const char *f, va_list args)
405404
{
406405
int len;
407406

408407
if (m->count < m->size) {
409408
len = vsnprintf(m->buf + m->count, m->size - m->count, f, args);
410409
if (m->count + len < m->size) {
411410
m->count += len;
412-
return 0;
411+
return;
413412
}
414413
}
415414
seq_set_overflow(m);
416-
return -1;
417415
}
418416
EXPORT_SYMBOL(seq_vprintf);
419417

420-
int seq_printf(struct seq_file *m, const char *f, ...)
418+
void seq_printf(struct seq_file *m, const char *f, ...)
421419
{
422-
int ret;
423420
va_list args;
424421

425422
va_start(args, f);
426-
ret = seq_vprintf(m, f, args);
423+
seq_vprintf(m, f, args);
427424
va_end(args);
428-
429-
return ret;
430425
}
431426
EXPORT_SYMBOL(seq_printf);
432427

@@ -664,26 +659,25 @@ int seq_open_private(struct file *filp, const struct seq_operations *ops,
664659
}
665660
EXPORT_SYMBOL(seq_open_private);
666661

667-
int seq_putc(struct seq_file *m, char c)
662+
void seq_putc(struct seq_file *m, char c)
668663
{
669-
if (m->count < m->size) {
670-
m->buf[m->count++] = c;
671-
return 0;
672-
}
673-
return -1;
664+
if (m->count >= m->size)
665+
return;
666+
667+
m->buf[m->count++] = c;
674668
}
675669
EXPORT_SYMBOL(seq_putc);
676670

677-
int seq_puts(struct seq_file *m, const char *s)
671+
void seq_puts(struct seq_file *m, const char *s)
678672
{
679673
int len = strlen(s);
680-
if (m->count + len < m->size) {
681-
memcpy(m->buf + m->count, s, len);
682-
m->count += len;
683-
return 0;
674+
675+
if (m->count + len >= m->size) {
676+
seq_set_overflow(m);
677+
return;
684678
}
685-
seq_set_overflow(m);
686-
return -1;
679+
memcpy(m->buf + m->count, s, len);
680+
m->count += len;
687681
}
688682
EXPORT_SYMBOL(seq_puts);
689683

@@ -694,8 +688,8 @@ EXPORT_SYMBOL(seq_puts);
694688
* This routine is very quick when you show lots of numbers.
695689
* In usual cases, it will be better to use seq_printf(). It's easier to read.
696690
*/
697-
int seq_put_decimal_ull(struct seq_file *m, char delimiter,
698-
unsigned long long num)
691+
void seq_put_decimal_ull(struct seq_file *m, char delimiter,
692+
unsigned long long num)
699693
{
700694
int len;
701695

@@ -707,35 +701,33 @@ int seq_put_decimal_ull(struct seq_file *m, char delimiter,
707701

708702
if (num < 10) {
709703
m->buf[m->count++] = num + '0';
710-
return 0;
704+
return;
711705
}
712706

713707
len = num_to_str(m->buf + m->count, m->size - m->count, num);
714708
if (!len)
715709
goto overflow;
716710
m->count += len;
717-
return 0;
711+
return;
712+
718713
overflow:
719714
seq_set_overflow(m);
720-
return -1;
721715
}
722716
EXPORT_SYMBOL(seq_put_decimal_ull);
723717

724-
int seq_put_decimal_ll(struct seq_file *m, char delimiter,
725-
long long num)
718+
void seq_put_decimal_ll(struct seq_file *m, char delimiter, long long num)
726719
{
727720
if (num < 0) {
728721
if (m->count + 3 >= m->size) {
729722
seq_set_overflow(m);
730-
return -1;
723+
return;
731724
}
732725
if (delimiter)
733726
m->buf[m->count++] = delimiter;
734727
num = -num;
735728
delimiter = '-';
736729
}
737-
return seq_put_decimal_ull(m, delimiter, num);
738-
730+
seq_put_decimal_ull(m, delimiter, num);
739731
}
740732
EXPORT_SYMBOL(seq_put_decimal_ll);
741733

include/linux/seq_file.h

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,18 @@ int seq_open(struct file *, const struct seq_operations *);
114114
ssize_t seq_read(struct file *, char __user *, size_t, loff_t *);
115115
loff_t seq_lseek(struct file *, loff_t, int);
116116
int seq_release(struct inode *, struct file *);
117-
int seq_escape(struct seq_file *, const char *, const char *);
118-
int seq_putc(struct seq_file *m, char c);
119-
int seq_puts(struct seq_file *m, const char *s);
120117
int seq_write(struct seq_file *seq, const void *data, size_t len);
121118

122-
__printf(2, 3) int seq_printf(struct seq_file *, const char *, ...);
123-
__printf(2, 0) int seq_vprintf(struct seq_file *, const char *, va_list args);
119+
__printf(2, 0)
120+
void seq_vprintf(struct seq_file *m, const char *fmt, va_list args);
121+
__printf(2, 3)
122+
void seq_printf(struct seq_file *m, const char *fmt, ...);
123+
void seq_putc(struct seq_file *m, char c);
124+
void seq_puts(struct seq_file *m, const char *s);
125+
void seq_put_decimal_ull(struct seq_file *m, char delimiter,
126+
unsigned long long num);
127+
void seq_put_decimal_ll(struct seq_file *m, char delimiter, long long num);
128+
void seq_escape(struct seq_file *m, const char *s, const char *esc);
124129

125130
void seq_hex_dump(struct seq_file *m, const char *prefix_str, int prefix_type,
126131
int rowsize, int groupsize, const void *buf, size_t len,
@@ -138,10 +143,6 @@ int single_release(struct inode *, struct file *);
138143
void *__seq_open_private(struct file *, const struct seq_operations *, int);
139144
int seq_open_private(struct file *, const struct seq_operations *, int);
140145
int seq_release_private(struct inode *, struct file *);
141-
int seq_put_decimal_ull(struct seq_file *m, char delimiter,
142-
unsigned long long num);
143-
int seq_put_decimal_ll(struct seq_file *m, char delimiter,
144-
long long num);
145146

146147
static inline struct user_namespace *seq_user_ns(struct seq_file *seq)
147148
{

include/linux/syscalls.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -885,4 +885,6 @@ asmlinkage long sys_execveat(int dfd, const char __user *filename,
885885
const char __user *const __user *argv,
886886
const char __user *const __user *envp, int flags);
887887

888+
asmlinkage long sys_membarrier(int cmd, int flags);
889+
888890
#endif

include/uapi/asm-generic/unistd.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -709,9 +709,11 @@ __SYSCALL(__NR_memfd_create, sys_memfd_create)
709709
__SYSCALL(__NR_bpf, sys_bpf)
710710
#define __NR_execveat 281
711711
__SC_COMP(__NR_execveat, sys_execveat, compat_sys_execveat)
712+
#define __NR_membarrier 282
713+
__SYSCALL(__NR_membarrier, sys_membarrier)
712714

713715
#undef __NR_syscalls
714-
#define __NR_syscalls 282
716+
#define __NR_syscalls 283
715717

716718
/*
717719
* All syscalls below here should go away really,

0 commit comments

Comments
 (0)