Re: [PATCH 07/25] mm/csky: Use mm_fault_accounting()

From: Peter Xu
Date: Thu Jun 18 2020 - 18:28:46 EST


On Thu, Jun 18, 2020 at 05:24:30PM -0400, Peter Xu wrote:
> > /* Major fault */
> > if ((ret & VM_FAULT_MAJOR) || (flags & FAULT_FLAG_TRIED)) {
> > flt = &current->maj_flt;
> > event_type = PERF_COUNT_SW_PAGE_FAULTS_MAJ;
> > } else {
> > flt = &current->min_flt;
> > event_type = PERF_COUNT_SW_PAGE_FAULTS_MIN;
> > }
> > *flt++;
> > if (regs)
> > perf_sw_event(event_type, 1, regs, address);

Sadly, this line seems to fail the compilation:

CC mm/memory.o
In file included from ././include/linux/compiler_types.h:68,
from <command-line>:
./arch/x86/include/asm/jump_label.h: In function âhandle_mm_faultâ:
./include/linux/compiler-gcc.h:120:38: warning: âasmâ operand 0 probably does not match constraints
120 | #define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0)
| ^~~
./arch/x86/include/asm/jump_label.h:25:2: note: in expansion of macro âasm_volatile_gotoâ
25 | asm_volatile_goto("1:"
| ^~~~~~~~~~~~~~~~~
./include/linux/compiler-gcc.h:120:38: error: impossible constraint in âasmâ
120 | #define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0)
| ^~~
./arch/x86/include/asm/jump_label.h:25:2: note: in expansion of macro âasm_volatile_gotoâ
25 | asm_volatile_goto("1:"
| ^~~~~~~~~~~~~~~~~
make[1]: *** [scripts/Makefile.build:267: mm/memory.o] Error 1
make: *** [Makefile:1729: mm] Error 2

Frankly speaking I have no solid understanding on what's the error about... But
my gut feeling is that it's about the static keys, where perf_sw_event() may
only support static event types (otherwise we won't be able to know whether to
patch the instruction with no-op or a jump?).

I'll go back to the simple version for now, until I know a solution..

Thanks,

--
Peter Xu