Skip to content

Commit

Permalink
mm: new mm hook framework
Browse files Browse the repository at this point in the history
CRIU is recreating the process memory layout by remapping the checkpointee
memory area on top of the current process (criu).  This includes remapping
the vDSO to the place it has at checkpoint time.

However some architectures like powerpc are keeping a reference to the
vDSO base address to build the signal return stack frame by calling the
vDSO sigreturn service.  So once the vDSO has been moved, this reference
is no more valid and the signal frame built later are not usable.

This patch serie is introducing a new mm hook framework, and a new
arch_remap hook which is called when mremap is done and the mm lock still
hold.  The next patch is adding the vDSO remap and unmap tracking to the
powerpc architecture.

This patch (of 3):

This patch introduces a new set of header file to manage mm hooks:
- per architecture empty header file (arch/x/include/asm/mm-arch-hooks.h)
- a generic header (include/linux/mm-arch-hooks.h)

The architecture which need to overwrite a hook as to redefine it in its
header file, while architecture which doesn't need have nothing to do.

The default hooks are defined in the generic header and are used in the
case the architecture is not defining it.

In a next step, mm hooks defined in include/asm-generic/mm_hooks.h should
be moved here.

Signed-off-by: Laurent Dufour <[email protected]>
Suggested-by: Andrew Morton <[email protected]>
Cc: "Kirill A. Shutemov" <[email protected]>
Cc: Hugh Dickins <[email protected]>
Cc: Rik van Riel <[email protected]>
Cc: Mel Gorman <[email protected]>
Cc: Pavel Emelyanov <[email protected]>
Cc: Benjamin Herrenschmidt <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Michael Ellerman <[email protected]>
Cc: Ingo Molnar <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Laurent Dufour authored and torvalds committed Jun 25, 2015
1 parent e81f2d2 commit 2ae416b
Show file tree
Hide file tree
Showing 31 changed files with 466 additions and 0 deletions.
15 changes: 15 additions & 0 deletions arch/alpha/include/asm/mm-arch-hooks.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Architecture specific mm hooks
*
* Copyright (C) 2015, IBM Corporation
* Author: Laurent Dufour <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/

#ifndef _ASM_ALPHA_MM_ARCH_HOOKS_H
#define _ASM_ALPHA_MM_ARCH_HOOKS_H

#endif /* _ASM_ALPHA_MM_ARCH_HOOKS_H */
15 changes: 15 additions & 0 deletions arch/arc/include/asm/mm-arch-hooks.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Architecture specific mm hooks
*
* Copyright (C) 2015, IBM Corporation
* Author: Laurent Dufour <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/

#ifndef _ASM_ARC_MM_ARCH_HOOKS_H
#define _ASM_ARC_MM_ARCH_HOOKS_H

#endif /* _ASM_ARC_MM_ARCH_HOOKS_H */
15 changes: 15 additions & 0 deletions arch/arm/include/asm/mm-arch-hooks.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Architecture specific mm hooks
*
* Copyright (C) 2015, IBM Corporation
* Author: Laurent Dufour <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/

#ifndef _ASM_ARM_MM_ARCH_HOOKS_H
#define _ASM_ARM_MM_ARCH_HOOKS_H

#endif /* _ASM_ARM_MM_ARCH_HOOKS_H */
15 changes: 15 additions & 0 deletions arch/arm64/include/asm/mm-arch-hooks.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Architecture specific mm hooks
*
* Copyright (C) 2015, IBM Corporation
* Author: Laurent Dufour <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/

#ifndef _ASM_ARM64_MM_ARCH_HOOKS_H
#define _ASM_ARM64_MM_ARCH_HOOKS_H

#endif /* _ASM_ARM64_MM_ARCH_HOOKS_H */
15 changes: 15 additions & 0 deletions arch/avr32/include/asm/mm-arch-hooks.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Architecture specific mm hooks
*
* Copyright (C) 2015, IBM Corporation
* Author: Laurent Dufour <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/

#ifndef _ASM_AVR32_MM_ARCH_HOOKS_H
#define _ASM_AVR32_MM_ARCH_HOOKS_H

#endif /* _ASM_AVR32_MM_ARCH_HOOKS_H */
15 changes: 15 additions & 0 deletions arch/blackfin/include/asm/mm-arch-hooks.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Architecture specific mm hooks
*
* Copyright (C) 2015, IBM Corporation
* Author: Laurent Dufour <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/

#ifndef _ASM_BLACKFIN_MM_ARCH_HOOKS_H
#define _ASM_BLACKFIN_MM_ARCH_HOOKS_H

#endif /* _ASM_BLACKFIN_MM_ARCH_HOOKS_H */
15 changes: 15 additions & 0 deletions arch/c6x/include/asm/mm-arch-hooks.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Architecture specific mm hooks
*
* Copyright (C) 2015, IBM Corporation
* Author: Laurent Dufour <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/

#ifndef _ASM_C6X_MM_ARCH_HOOKS_H
#define _ASM_C6X_MM_ARCH_HOOKS_H

#endif /* _ASM_C6X_MM_ARCH_HOOKS_H */
15 changes: 15 additions & 0 deletions arch/cris/include/asm/mm-arch-hooks.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Architecture specific mm hooks
*
* Copyright (C) 2015, IBM Corporation
* Author: Laurent Dufour <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/

#ifndef _ASM_CRIS_MM_ARCH_HOOKS_H
#define _ASM_CRIS_MM_ARCH_HOOKS_H

#endif /* _ASM_CRIS_MM_ARCH_HOOKS_H */
15 changes: 15 additions & 0 deletions arch/frv/include/asm/mm-arch-hooks.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Architecture specific mm hooks
*
* Copyright (C) 2015, IBM Corporation
* Author: Laurent Dufour <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/

#ifndef _ASM_FRV_MM_ARCH_HOOKS_H
#define _ASM_FRV_MM_ARCH_HOOKS_H

#endif /* _ASM_FRV_MM_ARCH_HOOKS_H */
15 changes: 15 additions & 0 deletions arch/hexagon/include/asm/mm-arch-hooks.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Architecture specific mm hooks
*
* Copyright (C) 2015, IBM Corporation
* Author: Laurent Dufour <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/

#ifndef _ASM_HEXAGON_MM_ARCH_HOOKS_H
#define _ASM_HEXAGON_MM_ARCH_HOOKS_H

#endif /* _ASM_HEXAGON_MM_ARCH_HOOKS_H */
15 changes: 15 additions & 0 deletions arch/ia64/include/asm/mm-arch-hooks.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Architecture specific mm hooks
*
* Copyright (C) 2015, IBM Corporation
* Author: Laurent Dufour <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/

#ifndef _ASM_IA64_MM_ARCH_HOOKS_H
#define _ASM_IA64_MM_ARCH_HOOKS_H

#endif /* _ASM_IA64_MM_ARCH_HOOKS_H */
15 changes: 15 additions & 0 deletions arch/m32r/include/asm/mm-arch-hooks.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Architecture specific mm hooks
*
* Copyright (C) 2015, IBM Corporation
* Author: Laurent Dufour <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/

#ifndef _ASM_M32R_MM_ARCH_HOOKS_H
#define _ASM_M32R_MM_ARCH_HOOKS_H

#endif /* _ASM_M32R_MM_ARCH_HOOKS_H */
15 changes: 15 additions & 0 deletions arch/m68k/include/asm/mm-arch-hooks.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Architecture specific mm hooks
*
* Copyright (C) 2015, IBM Corporation
* Author: Laurent Dufour <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/

#ifndef _ASM_M68K_MM_ARCH_HOOKS_H
#define _ASM_M68K_MM_ARCH_HOOKS_H

#endif /* _ASM_M68K_MM_ARCH_HOOKS_H */
15 changes: 15 additions & 0 deletions arch/metag/include/asm/mm-arch-hooks.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Architecture specific mm hooks
*
* Copyright (C) 2015, IBM Corporation
* Author: Laurent Dufour <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/

#ifndef _ASM_METAG_MM_ARCH_HOOKS_H
#define _ASM_METAG_MM_ARCH_HOOKS_H

#endif /* _ASM_METAG_MM_ARCH_HOOKS_H */
15 changes: 15 additions & 0 deletions arch/microblaze/include/asm/mm-arch-hooks.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Architecture specific mm hooks
*
* Copyright (C) 2015, IBM Corporation
* Author: Laurent Dufour <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/

#ifndef _ASM_MICROBLAZE_MM_ARCH_HOOKS_H
#define _ASM_MICROBLAZE_MM_ARCH_HOOKS_H

#endif /* _ASM_MICROBLAZE_MM_ARCH_HOOKS_H */
15 changes: 15 additions & 0 deletions arch/mips/include/asm/mm-arch-hooks.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Architecture specific mm hooks
*
* Copyright (C) 2015, IBM Corporation
* Author: Laurent Dufour <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/

#ifndef _ASM_MIPS_MM_ARCH_HOOKS_H
#define _ASM_MIPS_MM_ARCH_HOOKS_H

#endif /* _ASM_MIPS_MM_ARCH_HOOKS_H */
15 changes: 15 additions & 0 deletions arch/mn10300/include/asm/mm-arch-hooks.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Architecture specific mm hooks
*
* Copyright (C) 2015, IBM Corporation
* Author: Laurent Dufour <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/

#ifndef _ASM_MN10300_MM_ARCH_HOOKS_H
#define _ASM_MN10300_MM_ARCH_HOOKS_H

#endif /* _ASM_MN10300_MM_ARCH_HOOKS_H */
15 changes: 15 additions & 0 deletions arch/nios2/include/asm/mm-arch-hooks.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Architecture specific mm hooks
*
* Copyright (C) 2015, IBM Corporation
* Author: Laurent Dufour <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/

#ifndef _ASM_NIOS2_MM_ARCH_HOOKS_H
#define _ASM_NIOS2_MM_ARCH_HOOKS_H

#endif /* _ASM_NIOS2_MM_ARCH_HOOKS_H */
15 changes: 15 additions & 0 deletions arch/openrisc/include/asm/mm-arch-hooks.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Architecture specific mm hooks
*
* Copyright (C) 2015, IBM Corporation
* Author: Laurent Dufour <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/

#ifndef _ASM_OPENRISC_MM_ARCH_HOOKS_H
#define _ASM_OPENRISC_MM_ARCH_HOOKS_H

#endif /* _ASM_OPENRISC_MM_ARCH_HOOKS_H */
15 changes: 15 additions & 0 deletions arch/parisc/include/asm/mm-arch-hooks.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Architecture specific mm hooks
*
* Copyright (C) 2015, IBM Corporation
* Author: Laurent Dufour <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/

#ifndef _ASM_PARISC_MM_ARCH_HOOKS_H
#define _ASM_PARISC_MM_ARCH_HOOKS_H

#endif /* _ASM_PARISC_MM_ARCH_HOOKS_H */
15 changes: 15 additions & 0 deletions arch/powerpc/include/asm/mm-arch-hooks.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Architecture specific mm hooks
*
* Copyright (C) 2015, IBM Corporation
* Author: Laurent Dufour <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/

#ifndef _ASM_POWERPC_MM_ARCH_HOOKS_H
#define _ASM_POWERPC_MM_ARCH_HOOKS_H

#endif /* _ASM_POWERPC_MM_ARCH_HOOKS_H */
15 changes: 15 additions & 0 deletions arch/s390/include/asm/mm-arch-hooks.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Architecture specific mm hooks
*
* Copyright (C) 2015, IBM Corporation
* Author: Laurent Dufour <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/

#ifndef _ASM_S390_MM_ARCH_HOOKS_H
#define _ASM_S390_MM_ARCH_HOOKS_H

#endif /* _ASM_S390_MM_ARCH_HOOKS_H */
15 changes: 15 additions & 0 deletions arch/score/include/asm/mm-arch-hooks.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Architecture specific mm hooks
*
* Copyright (C) 2015, IBM Corporation
* Author: Laurent Dufour <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/

#ifndef _ASM_SCORE_MM_ARCH_HOOKS_H
#define _ASM_SCORE_MM_ARCH_HOOKS_H

#endif /* _ASM_SCORE_MM_ARCH_HOOKS_H */
15 changes: 15 additions & 0 deletions arch/sh/include/asm/mm-arch-hooks.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Architecture specific mm hooks
*
* Copyright (C) 2015, IBM Corporation
* Author: Laurent Dufour <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/

#ifndef _ASM_SH_MM_ARCH_HOOKS_H
#define _ASM_SH_MM_ARCH_HOOKS_H

#endif /* _ASM_SH_MM_ARCH_HOOKS_H */
15 changes: 15 additions & 0 deletions arch/sparc/include/asm/mm-arch-hooks.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Architecture specific mm hooks
*
* Copyright (C) 2015, IBM Corporation
* Author: Laurent Dufour <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/

#ifndef _ASM_SPARC_MM_ARCH_HOOKS_H
#define _ASM_SPARC_MM_ARCH_HOOKS_H

#endif /* _ASM_SPARC_MM_ARCH_HOOKS_H */
Loading

0 comments on commit 2ae416b

Please sign in to comment.