diff mbox series

sparc: kprobes: Free instructions in arch_remove_kprobe()

Message ID 1662604440-30524-1-git-send-email-yangtiezhu@loongson.cn
State New
Headers show
Series sparc: kprobes: Free instructions in arch_remove_kprobe() | expand

Commit Message

Tiezhu Yang Sept. 8, 2022, 2:34 a.m. UTC
Call free_insn_slot() to free instructions in arch_remove_kprobe()
as other arches do.

Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
 arch/sparc/include/asm/kprobes.h | 2 +-
 arch/sparc/kernel/kprobes.c      | 8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

Comments

Tiezhu Yang Sept. 8, 2022, 4:10 a.m. UTC | #1
Sorry, please ignore this patch, it is not necessary.
kernel test robot Sept. 8, 2022, 4:33 a.m. UTC | #2
Hi Tiezhu,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on v6.0-rc4]
[also build test WARNING on linus/master next-20220907]
[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#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Tiezhu-Yang/sparc-kprobes-Free-instructions-in-arch_remove_kprobe/20220908-103454
base:    7e18e42e4b280c85b76967a9106a13ca61c16179
config: sparc-allyesconfig (https://download.01.org/0day-ci/archive/20220908/202209081219.MDryXDEc-lkp@intel.com/config)
compiler: sparc64-linux-gcc (GCC) 12.1.0
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
        # https://github.com/intel-lab-lkp/linux/commit/13d8569b8b252a60b519215d42f438582f00a37f
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Tiezhu-Yang/sparc-kprobes-Free-instructions-in-arch_remove_kprobe/20220908-103454
        git checkout 13d8569b8b252a60b519215d42f438582f00a37f
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=sparc SHELL=/bin/bash arch/sparc/ drivers/gpu/ kernel//

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   In file included from include/linux/kprobes.h:32,
                    from include/linux/kgdb.h:19,
                    from include/drm/drm_util.h:36,
                    from include/drm/drm_connector.h:32,
                    from include/drm/drm_modes.h:33,
                    from include/drm/drm_crtc.h:32,
                    from include/drm/drm_atomic.h:31,
                    from drivers/gpu/drm/drm_self_refresh_helper.c:13:
>> arch/sparc/include/asm/kprobes.h:20:32: warning: 'struct kprobe' declared inside parameter list will not be visible outside of this definition or declaration
      20 | void arch_remove_kprobe(struct kprobe *p);
         |                                ^~~~~~
--
   In file included from include/linux/kprobes.h:32,
                    from include/linux/kgdb.h:19,
                    from drivers/gpu/drm/amd/amdgpu/../display/dc/os_types.h:31,
                    from drivers/gpu/drm/amd/amdgpu/../display/dc/dm_services_types.h:29,
                    from drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:29:
>> arch/sparc/include/asm/kprobes.h:20:32: warning: 'struct kprobe' declared inside parameter list will not be visible outside of this definition or declaration
      20 | void arch_remove_kprobe(struct kprobe *p);
         |                                ^~~~~~
   In file included from drivers/gpu/drm/amd/amdgpu/../display/dc/inc/core_types.h:32,
                    from drivers/gpu/drm/amd/amdgpu/../display/dc/inc/link_enc_cfg.h:33,
                    from drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:32:
   drivers/gpu/drm/amd/amdgpu/../display/include/ddc_service_types.h:137:22: warning: 'SYNAPTICS_DEVICE_ID' defined but not used [-Wunused-const-variable=]
     137 | static const uint8_t SYNAPTICS_DEVICE_ID[] = "SYNA";
         |                      ^~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/../display/include/ddc_service_types.h:134:17: warning: 'DP_SINK_BRANCH_DEV_NAME_7580' defined but not used [-Wunused-const-variable=]
     134 | static const u8 DP_SINK_BRANCH_DEV_NAME_7580[] = "7580\x80u";
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/../display/include/ddc_service_types.h:132:22: warning: 'DP_SINK_DEVICE_STR_ID_2' defined but not used [-Wunused-const-variable=]
     132 | static const uint8_t DP_SINK_DEVICE_STR_ID_2[] = {7, 1, 8, 7, 5, 0};
         |                      ^~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/../display/include/ddc_service_types.h:131:22: warning: 'DP_SINK_DEVICE_STR_ID_1' defined but not used [-Wunused-const-variable=]
     131 | static const uint8_t DP_SINK_DEVICE_STR_ID_1[] = {7, 1, 8, 7, 3, 0};
         |                      ^~~~~~~~~~~~~~~~~~~~~~~
--
   In file included from include/linux/kprobes.h:32,
                    from include/linux/kgdb.h:19,
                    from drivers/gpu/drm/amd/amdgpu/../display/dc/os_types.h:31,
                    from drivers/gpu/drm/amd/amdgpu/../display/dc/dm_services_types.h:29,
                    from drivers/gpu/drm/amd/amdgpu/../display/dc/dm_services.h:35,
                    from drivers/gpu/drm/amd/amdgpu/../display/dc/bios/bios_parser2.c:26:
>> arch/sparc/include/asm/kprobes.h:20:32: warning: 'struct kprobe' declared inside parameter list will not be visible outside of this definition or declaration
      20 | void arch_remove_kprobe(struct kprobe *p);
         |                                ^~~~~~
   drivers/gpu/drm/amd/amdgpu/../display/dc/bios/bios_parser2.c: In function 'bios_get_board_layout_info':
   drivers/gpu/drm/amd/amdgpu/../display/dc/bios/bios_parser2.c:3319:29: warning: variable 'bp' set but not used [-Wunused-but-set-variable]
    3319 |         struct bios_parser *bp;
         |                             ^~
--
   In file included from include/linux/kprobes.h:32,
                    from include/linux/kgdb.h:19,
                    from drivers/gpu/drm/amd/amdgpu/../display/dc/os_types.h:31,
                    from drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dmub_psr.h:29,
                    from drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dmub_psr.c:26:
>> arch/sparc/include/asm/kprobes.h:20:32: warning: 'struct kprobe' declared inside parameter list will not be visible outside of this definition or declaration
      20 | void arch_remove_kprobe(struct kprobe *p);
         |                                ^~~~~~
   In file included from drivers/gpu/drm/amd/amdgpu/../display/dc/inc/core_types.h:32,
                    from drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dmub_psr.c:30:
   drivers/gpu/drm/amd/amdgpu/../display/include/ddc_service_types.h:137:22: warning: 'SYNAPTICS_DEVICE_ID' defined but not used [-Wunused-const-variable=]
     137 | static const uint8_t SYNAPTICS_DEVICE_ID[] = "SYNA";
         |                      ^~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/../display/include/ddc_service_types.h:134:17: warning: 'DP_SINK_BRANCH_DEV_NAME_7580' defined but not used [-Wunused-const-variable=]
     134 | static const u8 DP_SINK_BRANCH_DEV_NAME_7580[] = "7580\x80u";
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
   In file included from include/linux/kprobes.h:32,
                    from include/linux/kgdb.h:19,
                    from drivers/gpu/drm/amd/amdgpu/../display/dc/os_types.h:31,
                    from drivers/gpu/drm/amd/amdgpu/../display/dc/dm_services_types.h:29,
                    from drivers/gpu/drm/amd/amdgpu/../display/dc/dm_services.h:35,
                    from drivers/gpu/drm/amd/amdgpu/../display/dc/dce60/dce60_resource.c:31:
>> arch/sparc/include/asm/kprobes.h:20:32: warning: 'struct kprobe' declared inside parameter list will not be visible outside of this definition or declaration
      20 | void arch_remove_kprobe(struct kprobe *p);
         |                                ^~~~~~
   In file included from drivers/gpu/drm/amd/amdgpu/../display/dc/dce60/dce60_resource.c:28:
   drivers/gpu/drm/amd/amdgpu/../include/asic_reg/dce/dce_6_0_d.h:568:43: warning: initialized field overwritten [-Woverride-init]
     568 | #define mmCRTC0_DCFE_MEM_LIGHT_SLEEP_CNTL 0x1B7F
         |                                           ^~~~~~
   drivers/gpu/drm/amd/amdgpu/../display/dc/dce60/dce60_resource.c:157:21: note: in expansion of macro 'mmCRTC0_DCFE_MEM_LIGHT_SLEEP_CNTL'
     157 |         .reg_name = mm ## block ## id ## _ ## reg_name
         |                     ^~
   drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dce_transform.h:170:9: note: in expansion of macro 'SRI'
     170 |         SRI(DCFE_MEM_LIGHT_SLEEP_CNTL, CRTC, id)
         |         ^~~
   drivers/gpu/drm/amd/amdgpu/../display/dc/dce60/dce60_resource.c:183:17: note: in expansion of macro 'XFM_COMMON_REG_LIST_DCE60'
     183 |                 XFM_COMMON_REG_LIST_DCE60(id)\
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/../display/dc/dce60/dce60_resource.c:187:17: note: in expansion of macro 'transform_regs'
     187 |                 transform_regs(0),
         |                 ^~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/../include/asic_reg/dce/dce_6_0_d.h:568:43: note: (near initialization for 'xfm_regs[0].DCFE_MEM_LIGHT_SLEEP_CNTL')
     568 | #define mmCRTC0_DCFE_MEM_LIGHT_SLEEP_CNTL 0x1B7F
         |                                           ^~~~~~
   drivers/gpu/drm/amd/amdgpu/../display/dc/dce60/dce60_resource.c:157:21: note: in expansion of macro 'mmCRTC0_DCFE_MEM_LIGHT_SLEEP_CNTL'
     157 |         .reg_name = mm ## block ## id ## _ ## reg_name
         |                     ^~
   drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dce_transform.h:170:9: note: in expansion of macro 'SRI'
     170 |         SRI(DCFE_MEM_LIGHT_SLEEP_CNTL, CRTC, id)
         |         ^~~
   drivers/gpu/drm/amd/amdgpu/../display/dc/dce60/dce60_resource.c:183:17: note: in expansion of macro 'XFM_COMMON_REG_LIST_DCE60'
     183 |                 XFM_COMMON_REG_LIST_DCE60(id)\
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/../display/dc/dce60/dce60_resource.c:187:17: note: in expansion of macro 'transform_regs'
     187 |                 transform_regs(0),
         |                 ^~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/../include/asic_reg/dce/dce_6_0_d.h:645:43: warning: initialized field overwritten [-Woverride-init]
     645 | #define mmCRTC1_DCFE_MEM_LIGHT_SLEEP_CNTL 0x1E7F
         |                                           ^~~~~~
   drivers/gpu/drm/amd/amdgpu/../display/dc/dce60/dce60_resource.c:157:21: note: in expansion of macro 'mmCRTC1_DCFE_MEM_LIGHT_SLEEP_CNTL'
     157 |         .reg_name = mm ## block ## id ## _ ## reg_name
         |                     ^~
   drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dce_transform.h:170:9: note: in expansion of macro 'SRI'
     170 |         SRI(DCFE_MEM_LIGHT_SLEEP_CNTL, CRTC, id)
         |         ^~~
   drivers/gpu/drm/amd/amdgpu/../display/dc/dce60/dce60_resource.c:183:17: note: in expansion of macro 'XFM_COMMON_REG_LIST_DCE60'
     183 |                 XFM_COMMON_REG_LIST_DCE60(id)\
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/../display/dc/dce60/dce60_resource.c:188:17: note: in expansion of macro 'transform_regs'
     188 |                 transform_regs(1),
         |                 ^~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/../include/asic_reg/dce/dce_6_0_d.h:645:43: note: (near initialization for 'xfm_regs[1].DCFE_MEM_LIGHT_SLEEP_CNTL')
     645 | #define mmCRTC1_DCFE_MEM_LIGHT_SLEEP_CNTL 0x1E7F
         |                                           ^~~~~~
   drivers/gpu/drm/amd/amdgpu/../display/dc/dce60/dce60_resource.c:157:21: note: in expansion of macro 'mmCRTC1_DCFE_MEM_LIGHT_SLEEP_CNTL'
     157 |         .reg_name = mm ## block ## id ## _ ## reg_name
         |                     ^~
   drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dce_transform.h:170:9: note: in expansion of macro 'SRI'
     170 |         SRI(DCFE_MEM_LIGHT_SLEEP_CNTL, CRTC, id)
         |         ^~~
   drivers/gpu/drm/amd/amdgpu/../display/dc/dce60/dce60_resource.c:183:17: note: in expansion of macro 'XFM_COMMON_REG_LIST_DCE60'
     183 |                 XFM_COMMON_REG_LIST_DCE60(id)\
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/../display/dc/dce60/dce60_resource.c:188:17: note: in expansion of macro 'transform_regs'
     188 |                 transform_regs(1),
         |                 ^~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/../include/asic_reg/dce/dce_6_0_d.h:722:43: warning: initialized field overwritten [-Woverride-init]
     722 | #define mmCRTC2_DCFE_MEM_LIGHT_SLEEP_CNTL 0x417F
         |                                           ^~~~~~
   drivers/gpu/drm/amd/amdgpu/../display/dc/dce60/dce60_resource.c:157:21: note: in expansion of macro 'mmCRTC2_DCFE_MEM_LIGHT_SLEEP_CNTL'
     157 |         .reg_name = mm ## block ## id ## _ ## reg_name
         |                     ^~
   drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dce_transform.h:170:9: note: in expansion of macro 'SRI'
     170 |         SRI(DCFE_MEM_LIGHT_SLEEP_CNTL, CRTC, id)
         |         ^~~
   drivers/gpu/drm/amd/amdgpu/../display/dc/dce60/dce60_resource.c:183:17: note: in expansion of macro 'XFM_COMMON_REG_LIST_DCE60'
     183 |                 XFM_COMMON_REG_LIST_DCE60(id)\
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/../display/dc/dce60/dce60_resource.c:189:17: note: in expansion of macro 'transform_regs'
     189 |                 transform_regs(2),
         |                 ^~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/../include/asic_reg/dce/dce_6_0_d.h:722:43: note: (near initialization for 'xfm_regs[2].DCFE_MEM_LIGHT_SLEEP_CNTL')
     722 | #define mmCRTC2_DCFE_MEM_LIGHT_SLEEP_CNTL 0x417F
         |                                           ^~~~~~
   drivers/gpu/drm/amd/amdgpu/../display/dc/dce60/dce60_resource.c:157:21: note: in expansion of macro 'mmCRTC2_DCFE_MEM_LIGHT_SLEEP_CNTL'
     157 |         .reg_name = mm ## block ## id ## _ ## reg_name
         |                     ^~
   drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dce_transform.h:170:9: note: in expansion of macro 'SRI'
     170 |         SRI(DCFE_MEM_LIGHT_SLEEP_CNTL, CRTC, id)
         |         ^~~
   drivers/gpu/drm/amd/amdgpu/../display/dc/dce60/dce60_resource.c:183:17: note: in expansion of macro 'XFM_COMMON_REG_LIST_DCE60'
     183 |                 XFM_COMMON_REG_LIST_DCE60(id)\
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/../display/dc/dce60/dce60_resource.c:189:17: note: in expansion of macro 'transform_regs'
     189 |                 transform_regs(2),
         |                 ^~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/../include/asic_reg/dce/dce_6_0_d.h:799:43: warning: initialized field overwritten [-Woverride-init]
     799 | #define mmCRTC3_DCFE_MEM_LIGHT_SLEEP_CNTL 0x447F
         |                                           ^~~~~~
   drivers/gpu/drm/amd/amdgpu/../display/dc/dce60/dce60_resource.c:157:21: note: in expansion of macro 'mmCRTC3_DCFE_MEM_LIGHT_SLEEP_CNTL'
     157 |         .reg_name = mm ## block ## id ## _ ## reg_name
         |                     ^~
   drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dce_transform.h:170:9: note: in expansion of macro 'SRI'
--
   In file included from include/linux/kprobes.h:32,
                    from include/linux/kgdb.h:19,
                    from drivers/gpu/drm/amd/amdgpu/../display/dc/os_types.h:31,
                    from drivers/gpu/drm/amd/amdgpu/../display/dc/dm_services_types.h:29,
                    from drivers/gpu/drm/amd/amdgpu/../display/dc/dm_services.h:35,
                    from drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc.c:25:
>> arch/sparc/include/asm/kprobes.h:20:32: warning: 'struct kprobe' declared inside parameter list will not be visible outside of this definition or declaration
      20 | void arch_remove_kprobe(struct kprobe *p);
         |                                ^~~~~~
   drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc.c:2845:6: warning: no previous prototype for 'dc_reset_state' [-Wmissing-prototypes]
    2845 | void dc_reset_state(struct dc *dc, struct dc_state *context)
         |      ^~~~~~~~~~~~~~
   In file included from drivers/gpu/drm/amd/amdgpu/../display/dc/inc/core_types.h:32,
                    from drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc.c:30:
   drivers/gpu/drm/amd/amdgpu/../display/include/ddc_service_types.h:137:22: warning: 'SYNAPTICS_DEVICE_ID' defined but not used [-Wunused-const-variable=]
     137 | static const uint8_t SYNAPTICS_DEVICE_ID[] = "SYNA";
         |                      ^~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/../display/include/ddc_service_types.h:134:17: warning: 'DP_SINK_BRANCH_DEV_NAME_7580' defined but not used [-Wunused-const-variable=]
     134 | static const u8 DP_SINK_BRANCH_DEV_NAME_7580[] = "7580\x80u";
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/../display/include/ddc_service_types.h:132:22: warning: 'DP_SINK_DEVICE_STR_ID_2' defined but not used [-Wunused-const-variable=]
     132 | static const uint8_t DP_SINK_DEVICE_STR_ID_2[] = {7, 1, 8, 7, 5, 0};
         |                      ^~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/../display/include/ddc_service_types.h:131:22: warning: 'DP_SINK_DEVICE_STR_ID_1' defined but not used [-Wunused-const-variable=]
     131 | static const uint8_t DP_SINK_DEVICE_STR_ID_1[] = {7, 1, 8, 7, 3, 0};
         |                      ^~~~~~~~~~~~~~~~~~~~~~~
--
   In file included from include/linux/kprobes.h:32,
                    from include/linux/kgdb.h:19,
                    from drivers/gpu/drm/amd/amdgpu/../display/dc/os_types.h:31,
                    from drivers/gpu/drm/amd/amdgpu/../display/dc/dm_services_types.h:29,
                    from drivers/gpu/drm/amd/amdgpu/../display/dc/dm_services.h:35,
                    from drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_link.c:28:
>> arch/sparc/include/asm/kprobes.h:20:32: warning: 'struct kprobe' declared inside parameter list will not be visible outside of this definition or declaration
      20 | void arch_remove_kprobe(struct kprobe *p);
         |                                ^~~~~~
   In file included from drivers/gpu/drm/amd/amdgpu/../display/dc/inc/dc_link_ddc.h:29,
                    from drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_link.c:37:
   drivers/gpu/drm/amd/amdgpu/../display/include/ddc_service_types.h:137:22: warning: 'SYNAPTICS_DEVICE_ID' defined but not used [-Wunused-const-variable=]
     137 | static const uint8_t SYNAPTICS_DEVICE_ID[] = "SYNA";
         |                      ^~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/../display/include/ddc_service_types.h:132:22: warning: 'DP_SINK_DEVICE_STR_ID_2' defined but not used [-Wunused-const-variable=]
     132 | static const uint8_t DP_SINK_DEVICE_STR_ID_2[] = {7, 1, 8, 7, 5, 0};
         |                      ^~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/../display/include/ddc_service_types.h:131:22: warning: 'DP_SINK_DEVICE_STR_ID_1' defined but not used [-Wunused-const-variable=]
     131 | static const uint8_t DP_SINK_DEVICE_STR_ID_1[] = {7, 1, 8, 7, 3, 0};
         |                      ^~~~~~~~~~~~~~~~~~~~~~~
--
   In file included from include/linux/kprobes.h:32,
                    from include/linux/kgdb.h:19,
                    from drivers/gpu/drm/amd/amdgpu/../display/dc/os_types.h:31,
                    from drivers/gpu/drm/amd/amdgpu/../display/dc/dm_services_types.h:29,
                    from drivers/gpu/drm/amd/amdgpu/../display/dc/dm_services.h:35,
                    from drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_resource.c:26:
>> arch/sparc/include/asm/kprobes.h:20:32: warning: 'struct kprobe' declared inside parameter list will not be visible outside of this definition or declaration
      20 | void arch_remove_kprobe(struct kprobe *p);
         |                                ^~~~~~
   drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_resource.c:1848:6: warning: no previous prototype for 'is_timing_changed' [-Wmissing-prototypes]
    1848 | bool is_timing_changed(struct dc_stream_state *cur_stream,
         |      ^~~~~~~~~~~~~~~~~
   In file included from drivers/gpu/drm/amd/amdgpu/../display/dc/inc/core_types.h:32,
                    from drivers/gpu/drm/amd/amdgpu/../display/dc/inc/resource.h:28,
                    from drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_resource.c:28:
   drivers/gpu/drm/amd/amdgpu/../display/include/ddc_service_types.h:137:22: warning: 'SYNAPTICS_DEVICE_ID' defined but not used [-Wunused-const-variable=]
     137 | static const uint8_t SYNAPTICS_DEVICE_ID[] = "SYNA";
         |                      ^~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/../display/include/ddc_service_types.h:134:17: warning: 'DP_SINK_BRANCH_DEV_NAME_7580' defined but not used [-Wunused-const-variable=]
     134 | static const u8 DP_SINK_BRANCH_DEV_NAME_7580[] = "7580\x80u";
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/../display/include/ddc_service_types.h:132:22: warning: 'DP_SINK_DEVICE_STR_ID_2' defined but not used [-Wunused-const-variable=]
     132 | static const uint8_t DP_SINK_DEVICE_STR_ID_2[] = {7, 1, 8, 7, 5, 0};
         |                      ^~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/../display/include/ddc_service_types.h:131:22: warning: 'DP_SINK_DEVICE_STR_ID_1' defined but not used [-Wunused-const-variable=]
     131 | static const uint8_t DP_SINK_DEVICE_STR_ID_1[] = {7, 1, 8, 7, 3, 0};
         |                      ^~~~~~~~~~~~~~~~~~~~~~~
--
   In file included from include/linux/kprobes.h:32,
                    from include/linux/kgdb.h:19,
                    from drivers/gpu/drm/amd/amdgpu/../display/dc/os_types.h:31,
                    from drivers/gpu/drm/amd/amdgpu/../display/dc/dm_services_types.h:29,
                    from drivers/gpu/drm/amd/amdgpu/../display/dc/dm_services.h:35,
                    from drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_link_dp.c:24:
>> arch/sparc/include/asm/kprobes.h:20:32: warning: 'struct kprobe' declared inside parameter list will not be visible outside of this definition or declaration
      20 | void arch_remove_kprobe(struct kprobe *p);
         |                                ^~~~~~
   drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_link_dp.c: In function 'dp_retrieve_lttpr_cap':
   drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_link_dp.c:5062:24: warning: variable 'status' set but not used [-Wunused-but-set-variable]
    5062 |         enum dc_status status = DC_ERROR_UNEXPECTED;
         |                        ^~~~~~
   In file included from drivers/gpu/drm/amd/amdgpu/../display/dc/inc/core_types.h:32,
                    from drivers/gpu/drm/amd/amdgpu/../display/dc/inc/resource.h:28,
                    from drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_link_dp.c:31:
   drivers/gpu/drm/amd/amdgpu/../display/include/ddc_service_types.h: At top level:
   drivers/gpu/drm/amd/amdgpu/../display/include/ddc_service_types.h:137:22: warning: 'SYNAPTICS_DEVICE_ID' defined but not used [-Wunused-const-variable=]
     137 | static const uint8_t SYNAPTICS_DEVICE_ID[] = "SYNA";
         |                      ^~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/../display/include/ddc_service_types.h:134:17: warning: 'DP_SINK_BRANCH_DEV_NAME_7580' defined but not used [-Wunused-const-variable=]
     134 | static const u8 DP_SINK_BRANCH_DEV_NAME_7580[] = "7580\x80u";
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/../display/include/ddc_service_types.h:132:22: warning: 'DP_SINK_DEVICE_STR_ID_2' defined but not used [-Wunused-const-variable=]
     132 | static const uint8_t DP_SINK_DEVICE_STR_ID_2[] = {7, 1, 8, 7, 5, 0};
         |                      ^~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/amd/amdgpu/../display/include/ddc_service_types.h:131:22: warning: 'DP_SINK_DEVICE_STR_ID_1' defined but not used [-Wunused-const-variable=]
     131 | static const uint8_t DP_SINK_DEVICE_STR_ID_1[] = {7, 1, 8, 7, 3, 0};
         |                      ^~~~~~~~~~~~~~~~~~~~~~~
--
   In file included from include/linux/kprobes.h:32,
                    from include/linux/kgdb.h:19,
                    from drivers/gpu/drm/amd/amdgpu/../display/dc/os_types.h:31,
                    from drivers/gpu/drm/amd/amdgpu/../display/dc/dc_types.h:32,
                    from drivers/gpu/drm/amd/amdgpu/../display/dc/dc.h:29,
                    from drivers/gpu/drm/amd/amdgpu/../display/modules/color/color_gamma.c:26:
>> arch/sparc/include/asm/kprobes.h:20:32: warning: 'struct kprobe' declared inside parameter list will not be visible outside of this definition or declaration
      20 | void arch_remove_kprobe(struct kprobe *p);
         |                                ^~~~~~
   drivers/gpu/drm/amd/amdgpu/../display/modules/color/color_gamma.c: In function 'apply_degamma_for_user_regamma':
   drivers/gpu/drm/amd/amdgpu/../display/modules/color/color_gamma.c:1691:36: warning: implicit conversion from 'enum <anonymous>' to 'enum dc_transfer_func_predefined' [-Wenum-conversion]
    1691 |         build_coefficients(&coeff, true);
         |                                    ^~~~
--
   In file included from include/linux/kprobes.h:32,
                    from include/linux/kgdb.h:19,
                    from drivers/gpu/drm/amd/amdgpu/../display/dc/os_types.h:31,
                    from drivers/gpu/drm/amd/amdgpu/../display/dc/dm_services_types.h:29,
                    from drivers/gpu/drm/amd/amdgpu/../include/dm_pp_interface.h:26,
                    from drivers/gpu/drm/amd/amdgpu/amdgpu.h:65,
                    from drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c:28:
>> arch/sparc/include/asm/kprobes.h:20:32: warning: 'struct kprobe' declared inside parameter list will not be visible outside of this definition or declaration
      20 | void arch_remove_kprobe(struct kprobe *p);
         |                                ^~~~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c:129:6: warning: no previous prototype for 'amdgpu_ucode_print_imu_hdr' [-Wmissing-prototypes]
     129 | void amdgpu_ucode_print_imu_hdr(const struct common_firmware_header *hdr)
         |      ^~~~~~~~~~~~~~~~~~~~~~~~~~
..


vim +20 arch/sparc/include/asm/kprobes.h

    19	
  > 20	void arch_remove_kprobe(struct kprobe *p);
    21
kernel test robot Sept. 11, 2022, 11:43 p.m. UTC | #3
Hi Tiezhu,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on v6.0-rc4]
[also build test ERROR on linus/master next-20220909]
[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#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Tiezhu-Yang/sparc-kprobes-Free-instructions-in-arch_remove_kprobe/20220908-103454
base:    7e18e42e4b280c85b76967a9106a13ca61c16179
config: sparc-allyesconfig (https://download.01.org/0day-ci/archive/20220912/202209120746.pxirzPMp-lkp@intel.com/config)
compiler: sparc64-linux-gcc (GCC) 12.1.0
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
        # https://github.com/intel-lab-lkp/linux/commit/13d8569b8b252a60b519215d42f438582f00a37f
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Tiezhu-Yang/sparc-kprobes-Free-instructions-in-arch_remove_kprobe/20220908-103454
        git checkout 13d8569b8b252a60b519215d42f438582f00a37f
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=sparc SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   In file included from include/linux/kprobes.h:32,
                    from arch/sparc/kernel/kprobes.c:8:
   arch/sparc/include/asm/kprobes.h:20:32: error: 'struct kprobe' declared inside parameter list will not be visible outside of this definition or declaration [-Werror]
      20 | void arch_remove_kprobe(struct kprobe *p);
         |                                ^~~~~~
>> arch/sparc/kernel/kprobes.c:77:16: error: conflicting types for 'arch_remove_kprobe'; have 'void(struct kprobe *)'
      77 | void __kprobes arch_remove_kprobe(struct kprobe *p)
         |                ^~~~~~~~~~~~~~~~~~
   arch/sparc/include/asm/kprobes.h:20:6: note: previous declaration of 'arch_remove_kprobe' with type 'void(struct kprobe *)'
      20 | void arch_remove_kprobe(struct kprobe *p);
         |      ^~~~~~~~~~~~~~~~~~
   arch/sparc/kernel/kprobes.c: In function 'arch_remove_kprobe':
>> arch/sparc/kernel/kprobes.c:79:13: error: the comparison will always evaluate as 'true' for the address of 'insn' will never be NULL [-Werror=address]
      79 |         if (p->ainsn.insn) {
         |             ^
   arch/sparc/include/asm/kprobes.h:32:25: note: 'insn' declared here
      32 |         kprobe_opcode_t insn[MAX_INSN_SIZE];
         |                         ^~~~
>> arch/sparc/kernel/kprobes.c:80:17: error: implicit declaration of function 'free_insn_slot'; did you mean 'flush_insn_slot'? [-Werror=implicit-function-declaration]
      80 |                 free_insn_slot(p->ainsn.insn, 0);
         |                 ^~~~~~~~~~~~~~
         |                 flush_insn_slot
>> arch/sparc/kernel/kprobes.c:81:31: error: assignment to expression with array type
      81 |                 p->ainsn.insn = NULL;
         |                               ^
   cc1: all warnings being treated as errors
--
   In file included from include/linux/kprobes.h:32,
                    from kernel/kprobes.c:23:
   arch/sparc/include/asm/kprobes.h:20:32: warning: 'struct kprobe' declared inside parameter list will not be visible outside of this definition or declaration
      20 | void arch_remove_kprobe(struct kprobe *p);
         |                                ^~~~~~
   kernel/kprobes.c: In function 'free_aggr_kprobe':
>> kernel/kprobes.c:1051:28: error: passing argument 1 of 'arch_remove_kprobe' from incompatible pointer type [-Werror=incompatible-pointer-types]
    1051 |         arch_remove_kprobe(p);
         |                            ^
         |                            |
         |                            struct kprobe *
   arch/sparc/include/asm/kprobes.h:20:40: note: expected 'struct kprobe *' but argument is of type 'struct kprobe *'
      20 | void arch_remove_kprobe(struct kprobe *p);
         |                         ~~~~~~~~~~~~~~~^
   kernel/kprobes.c: In function '__unregister_kprobe_bottom':
   kernel/kprobes.c:1792:36: error: passing argument 1 of 'arch_remove_kprobe' from incompatible pointer type [-Werror=incompatible-pointer-types]
    1792 |                 arch_remove_kprobe(p);
         |                                    ^
         |                                    |
         |                                    struct kprobe *
   arch/sparc/include/asm/kprobes.h:20:40: note: expected 'struct kprobe *' but argument is of type 'struct kprobe *'
      20 | void arch_remove_kprobe(struct kprobe *p);
         |                         ~~~~~~~~~~~~~~~^
   kernel/kprobes.c: In function 'kill_kprobe':
   kernel/kprobes.c:2371:28: error: passing argument 1 of 'arch_remove_kprobe' from incompatible pointer type [-Werror=incompatible-pointer-types]
    2371 |         arch_remove_kprobe(p);
         |                            ^
         |                            |
         |                            struct kprobe *
   arch/sparc/include/asm/kprobes.h:20:40: note: expected 'struct kprobe *' but argument is of type 'struct kprobe *'
      20 | void arch_remove_kprobe(struct kprobe *p);
         |                         ~~~~~~~~~~~~~~~^
   cc1: some warnings being treated as errors


vim +77 arch/sparc/kernel/kprobes.c

   > 8	#include <linux/kprobes.h>
     9	#include <linux/extable.h>
    10	#include <linux/kdebug.h>
    11	#include <linux/slab.h>
    12	#include <linux/context_tracking.h>
    13	#include <asm/signal.h>
    14	#include <asm/cacheflush.h>
    15	#include <linux/uaccess.h>
    16	
    17	/* We do not have hardware single-stepping on sparc64.
    18	 * So we implement software single-stepping with breakpoint
    19	 * traps.  The top-level scheme is similar to that used
    20	 * in the x86 kprobes implementation.
    21	 *
    22	 * In the kprobe->ainsn.insn[] array we store the original
    23	 * instruction at index zero and a break instruction at
    24	 * index one.
    25	 *
    26	 * When we hit a kprobe we:
    27	 * - Run the pre-handler
    28	 * - Remember "regs->tnpc" and interrupt level stored in
    29	 *   "regs->tstate" so we can restore them later
    30	 * - Disable PIL interrupts
    31	 * - Set regs->tpc to point to kprobe->ainsn.insn[0]
    32	 * - Set regs->tnpc to point to kprobe->ainsn.insn[1]
    33	 * - Mark that we are actively in a kprobe
    34	 *
    35	 * At this point we wait for the second breakpoint at
    36	 * kprobe->ainsn.insn[1] to hit.  When it does we:
    37	 * - Run the post-handler
    38	 * - Set regs->tpc to "remembered" regs->tnpc stored above,
    39	 *   restore the PIL interrupt level in "regs->tstate" as well
    40	 * - Make any adjustments necessary to regs->tnpc in order
    41	 *   to handle relative branches correctly.  See below.
    42	 * - Mark that we are no longer actively in a kprobe.
    43	 */
    44	
    45	DEFINE_PER_CPU(struct kprobe *, current_kprobe) = NULL;
    46	DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk);
    47	
    48	struct kretprobe_blackpoint kretprobe_blacklist[] = {{NULL, NULL}};
    49	
    50	int __kprobes arch_prepare_kprobe(struct kprobe *p)
    51	{
    52		if ((unsigned long) p->addr & 0x3UL)
    53			return -EILSEQ;
    54	
    55		p->ainsn.insn[0] = *p->addr;
    56		flushi(&p->ainsn.insn[0]);
    57	
    58		p->ainsn.insn[1] = BREAKPOINT_INSTRUCTION_2;
    59		flushi(&p->ainsn.insn[1]);
    60	
    61		p->opcode = *p->addr;
    62		return 0;
    63	}
    64	
    65	void __kprobes arch_arm_kprobe(struct kprobe *p)
    66	{
    67		*p->addr = BREAKPOINT_INSTRUCTION;
    68		flushi(p->addr);
    69	}
    70	
    71	void __kprobes arch_disarm_kprobe(struct kprobe *p)
    72	{
    73		*p->addr = p->opcode;
    74		flushi(p->addr);
    75	}
    76	
  > 77	void __kprobes arch_remove_kprobe(struct kprobe *p)
    78	{
  > 79		if (p->ainsn.insn) {
  > 80			free_insn_slot(p->ainsn.insn, 0);
  > 81			p->ainsn.insn = NULL;
    82		}
    83	}
    84
diff mbox series

Patch

diff --git a/arch/sparc/include/asm/kprobes.h b/arch/sparc/include/asm/kprobes.h
index 06c2bc7..0788286 100644
--- a/arch/sparc/include/asm/kprobes.h
+++ b/arch/sparc/include/asm/kprobes.h
@@ -17,7 +17,7 @@  typedef u32 kprobe_opcode_t;
 
 #define kretprobe_blacklist_size 0
 
-#define arch_remove_kprobe(p)	do {} while (0)
+void arch_remove_kprobe(struct kprobe *p);
 
 #define flush_insn_slot(p)		\
 do { 	flushi(&(p)->ainsn.insn[0]);	\
diff --git a/arch/sparc/kernel/kprobes.c b/arch/sparc/kernel/kprobes.c
index 535c7b3..a251f73 100644
--- a/arch/sparc/kernel/kprobes.c
+++ b/arch/sparc/kernel/kprobes.c
@@ -74,6 +74,14 @@  void __kprobes arch_disarm_kprobe(struct kprobe *p)
 	flushi(p->addr);
 }
 
+void __kprobes arch_remove_kprobe(struct kprobe *p)
+{
+	if (p->ainsn.insn) {
+		free_insn_slot(p->ainsn.insn, 0);
+		p->ainsn.insn = NULL;
+	}
+}
+
 static void __kprobes save_previous_kprobe(struct kprobe_ctlblk *kcb)
 {
 	kcb->prev_kprobe.kp = kprobe_running();