Re: [PATCH v6 0/9] Add jump table support for objtool on LoongArch

2025-02-10 Thread Tiezhu Yang
On 01/15/2025 09:34 AM, Josh Poimboeuf wrote: On Sat, Jan 11, 2025 at 02:57:42PM +0800, Tiezhu Yang wrote: Hi Josh and Peter, On 12/17/2024 09:08 AM, Tiezhu Yang wrote: This version is based on tip/tip.git objtool/core branch [1], add some weak and arch-specific functions to make the generic

[PATCH v4 1/3] drm/amd/display: Add ASSERT_BUG() macro definition

2025-01-14 Thread Tiezhu Yang
In order to keep the current ability for the aim of debugging and avoid printing the warning message twice, add ASSERT_BUG() macro definition to harden the callers of division functions. Signed-off-by: Tiezhu Yang --- drivers/gpu/drm/amd/display/dc/os_types.h | 7 +++ 1 file changed, 7

[PATCH v4 0/3] drm/amd/display: Stop control flow if the divisior is zero

2025-01-14 Thread Tiezhu Yang
to only use ASSERT_BUG() and SPL_ASSERT_BUG() directly after doing the following two steps: (1) Add ASSERT_BUG() macro definition (2) Add SPL_ASSERT_BUG() macro definition This version is based on 6.13-rc7, tested on x86 and LoongArch. Tiezhu Yang (3): drm/amd/display: Add ASSERT_BUG() macro

[PATCH v4 2/3] drm/amd/display: Add SPL_ASSERT_BUG() macro definition

2025-01-14 Thread Tiezhu Yang
In order to keep the current ability for the aim of debugging and avoid printing the warning message twice, add SPL_ASSERT_BUG() macro definition to harden the callers of division functions. Signed-off-by: Tiezhu Yang --- drivers/gpu/drm/amd/display/dc/spl/spl_debug.h | 11 +++ 1 file

Re: [PATCH v3 1/3] drm/amd/display: Add ASSERT_BUG() macro definition

2025-01-14 Thread Tiezhu Yang
On 01/14/2025 04:29 PM, Huacai Chen wrote: Hi, Tiezhu, On Tue, Jan 14, 2025 at 2:16 PM Tiezhu Yang wrote: In order to keep the current ability for the aim of debugging and avoid printing the warning message twice, add ASSERT_BUG() macro definition to harden the callers of division functions

[PATCH v4 3/3] drm/amd/display: Harden callers of division functions

2025-01-14 Thread Tiezhu Yang
undefined behavior, so use the new added ASSERT_BUG() and SPL_ASSERT_BUG() to stop the control flow if the divisior is zero. Suggested-by: Nathan Chancellor Suggested-by: Xi Ruoyao Suggested-by: Rui Wang Signed-off-by: Tiezhu Yang Link: https://lore.kernel.org/lkml/20241220223403.GA2605890@ax162

[PATCH v3 2/3] drm/amd/display: Add SPL_ASSERT_BUG() macro definition

2025-01-14 Thread Tiezhu Yang
In order to keep the current ability for the aim of debugging and avoid printing the warning message twice, add SPL_ASSERT_BUG() macro definition to harden the callers of division functions. Signed-off-by: Tiezhu Yang --- drivers/gpu/drm/amd/display/dc/spl/spl_debug.h | 9 + 1 file

[PATCH v3 0/3] drm/amd/display: Stop control flow if the divisior is zero

2025-01-14 Thread Tiezhu Yang
to only use ASSERT_BUG() and SPL_ASSERT_BUG() directly after doing the following two steps: (1) Add ASSERT_BUG() macro definition (2) Add SPL_ASSERT_BUG() macro definition This version is based on 6.13-rc7, tested on x86 and LoongArch. Tiezhu Yang (3): drm/amd/display: Add ASSERT_BUG() macro

[PATCH v3 1/3] drm/amd/display: Add ASSERT_BUG() macro definition

2025-01-14 Thread Tiezhu Yang
In order to keep the current ability for the aim of debugging and avoid printing the warning message twice, add ASSERT_BUG() macro definition to harden the callers of division functions. Signed-off-by: Tiezhu Yang --- drivers/gpu/drm/amd/display/dc/os_types.h | 5 + 1 file changed, 5

[PATCH v3 3/3] drm/amd/display: Harden callers of division functions

2025-01-14 Thread Tiezhu Yang
undefined behavior, so use the new added ASSERT_BUG() and SPL_ASSERT_BUG() to stop the control flow if the divisior is zero. Suggested-by: Nathan Chancellor Suggested-by: Xi Ruoyao Suggested-by: Rui Wang Signed-off-by: Tiezhu Yang Link: https://lore.kernel.org/lkml/20241220223403.GA2605890@ax162

Re: [PATCH v2 0/5] drm/amd/display: Stop control flow if the divisior is zero

2025-01-11 Thread Tiezhu Yang
On 01/11/2025 05:45 AM, Harry Wentland wrote: On 2025-01-06 03:57, Tiezhu Yang wrote: As far as I can tell, with the current existing macro definitions, there is no better way to do the minimal and proper changes to stop the control flow if the divisior is zero. In order to keep the current

Re: [PATCH v6 0/9] Add jump table support for objtool on LoongArch

2025-01-11 Thread Tiezhu Yang
Hi Josh and Peter, On 12/17/2024 09:08 AM, Tiezhu Yang wrote: This version is based on tip/tip.git objtool/core branch [1], add some weak and arch-specific functions to make the generic code more readable, tested with the latest upstream mainline Binutils, GCC and Clang. ... [1] https

[PATCH v2 5/5] drm/amd/display: Harden callers of division functions

2025-01-06 Thread Tiezhu Yang
use the new added ASSERT_BUG() and SPL_ASSERT_BUG() to stop the control flow if the divisior is zero. Suggested-by: Nathan Chancellor Suggested-by: Xi Ruoyao Suggested-by: Rui Wang Signed-off-by: Tiezhu Yang Link: https://lore.kernel.org/lkml/20241220223403.GA2605890@ax162/ --- drivers/gpu/drm

[PATCH v2 4/5] drm/amd/display: Add SPL_ASSERT_BUG() macro definition

2025-01-06 Thread Tiezhu Yang
In order to keep the current ability for the aim of debugging and avoid printing the warning message twice, add SPL_ASSERT_BUG() macro definition to harden the callers of division functions. Signed-off-by: Tiezhu Yang --- drivers/gpu/drm/amd/display/dc/spl/spl_debug.h | 9 + 1 file

[PATCH v2 3/5] drm/amd/display: Add ASSERT_BUG() macro definition

2025-01-06 Thread Tiezhu Yang
In order to keep the current ability for the aim of debugging and avoid printing the warning message twice, add ASSERT_BUG() macro definition to harden the callers of division functions. Signed-off-by: Tiezhu Yang --- drivers/gpu/drm/amd/display/dc/os_types.h | 5 + 1 file changed, 5

[PATCH v2 0/5] drm/amd/display: Stop control flow if the divisior is zero

2025-01-06 Thread Tiezhu Yang
, tested on x86 and LoongArch. Tiezhu Yang (5): drm/amd/display: Replace ASSERT() with ASSERT_WARN() drm/amd/display: Replace SPL_ASSERT() with SPL_ASSERT_WARN() drm/amd/display: Add ASSERT_BUG() macro definition drm/amd/display: Add SPL_ASSERT_BUG() macro definition drm/amd/display: Harden

[PATCH v2 2/5] drm/amd/display: Replace SPL_ASSERT() with SPL_ASSERT_WARN()

2025-01-06 Thread Tiezhu Yang
uot; `grep SPL_ASSERT -rwl drivers/gpu/drm/amd/display` This is in preparation to add SPL_ASSERT_BUG() in later patch to harden the callers of division functions, no functional change intended. Signed-off-by: Tiezhu Yang --- drivers/gpu/drm/amd/display/dc/spl/dc_spl.c | 12 +++ .../gpu/drm/amd/

[PATCH] drm/amd/display: Harden callers of division functions

2024-12-31 Thread Tiezhu Yang
avior. Keep the current ASSERT for the aim of debugging, just add BUG() to stop control flow if the divisior is zero. Suggested-by: Nathan Chancellor Suggested-by: Xi Ruoyao Suggested-by: Rui Wang Signed-off-by: Tiezhu Yang Link: https://lore.kernel.org/lkml/20241220223403.GA2605890@ax162/ --- dr

Re: [PATCH v6 9/9] drm/amd/display: Mark dc_fixpt_from_fraction() noinline

2024-12-26 Thread Tiezhu Yang
On 12/24/2024 05:46 AM, Nathan Chancellor wrote: On Sun, Dec 22, 2024 at 12:27:47PM +0800, Tiezhu Yang wrote: ... With the above changes, there is no "falls through" objtool warning compiled with both clang 19 and the latest mainline clang 20. I am somewhat surprised that change

Re: [PATCH v6 9/9] drm/amd/display: Mark dc_fixpt_from_fraction() noinline

2024-12-23 Thread Tiezhu Yang
On 12/21/2024 03:40 PM, Xi Ruoyao wrote: On Fri, 2024-12-20 at 15:34 -0700, Nathan Chancellor wrote: Now, the thing is, these ASSERT()s are checking for divide-by-zero, I suspect clang figured that out and invokes UB on us and just stops code-gen. Yeah, I think your analysis is spot on, as thi

Re: [PATCH v6 9/9] drm/amd/display: Mark dc_fixpt_from_fraction() noinline

2024-12-20 Thread Tiezhu Yang
On 12/19/2024 03:22 AM, Alex Deucher wrote: On Wed, Dec 18, 2024 at 2:18 PM Josh Poimboeuf wrote: On Wed, Dec 18, 2024 at 10:36:00PM +0800, Huacai Chen wrote: Hi, Tiezhu, On Tue, Dec 17, 2024 at 9:50 AM Tiezhu Yang wrote: When compiling with Clang on LoongArch, there exists the following

[PATCH v6 8/9] LoongArch: Convert unreachable() to BUG()

2024-12-17 Thread Tiezhu Yang
get a "break BRK_BUG" trap (with unreachable annotation). Signed-off-by: Tiezhu Yang --- arch/loongarch/kernel/machine_kexec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/loongarch/kernel/machine_kexec.c b/arch/loongarch/kernel/machine_kexec.c index 8a

[PATCH v6 0/9] Add jump table support for objtool on LoongArch

2024-12-17 Thread Tiezhu Yang
git/log/?h=objtool/core Tiezhu Yang (9): objtool: Handle various symbol types of rodata objtool: Handle different entry size of rodata objtool: Handle PC relative relocation type objtool: Handle unreachable entry of rodata objtool/LoongArch: Add support for switch table objtool/LoongArch: A

[PATCH v6 7/9] LoongArch: Enable jump table for objtool

2024-12-17 Thread Tiezhu Yang
For now, it is time to remove -fno-jump-tables to enable jump table for objtool if the compiler has -mannotate-tablejump, otherwise it is better to remain -fno-jump-tables to keep compatibility with older compilers. Signed-off-by: Tiezhu Yang --- arch/loongarch/Kconfig | 3 +++ arch/loongarch

[PATCH v6 3/9] objtool: Handle PC relative relocation type

2024-12-17 Thread Tiezhu Yang
itecture that has different requirements. Link: https://github.com/loongson/la-abi-specs/blob/release/laelf.adoc Signed-off-by: Tiezhu Yang --- tools/objtool/arch/loongarch/decode.c | 17 + tools/objtool/arch/loongarch/include/arch/elf.h | 7 +++ tools/objtool/check.

[PATCH v6 5/9] objtool/LoongArch: Add support for switch table

2024-12-17 Thread Tiezhu Yang
avoid getting the wrong jump destination instructions. Link: https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=0ee028f55640 Link: https://github.com/llvm/llvm-project/commit/4c2c17756739 Signed-off-by: Tiezhu Yang --- tools/objtool/arch/loongarch/special.c | 131 - 1 file c

[PATCH v6 2/9] objtool: Handle different entry size of rodata

2024-12-17 Thread Tiezhu Yang
LoongArch. Signed-off-by: Tiezhu Yang --- tools/objtool/arch/loongarch/decode.c | 11 +++ tools/objtool/arch/powerpc/decode.c | 15 +++ tools/objtool/arch/x86/decode.c | 13 + tools/objtool/check.c | 2 +- tools/objtool/include/objtool/arch.h

[PATCH v6 4/9] objtool: Handle unreachable entry of rodata

2024-12-17 Thread Tiezhu Yang
: Tiezhu Yang --- tools/objtool/check.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/objtool/check.c b/tools/objtool/check.c index cff7416b207e..654cffcf9512 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -1986,9 +1986,10 @@ static int

[PATCH v6 1/9] objtool: Handle various symbol types of rodata

2024-12-17 Thread Tiezhu Yang
ot;reloc->sym->offset + reloc_addend(reloc)" to obtain the symbol offset for various symbol types. Signed-off-by: Tiezhu Yang --- tools/objtool/check.c | 14 ++ 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tools/objtool/check.c b/tools/objtool/check.c index e

[PATCH v6 9/9] drm/amd/display: Mark dc_fixpt_from_fraction() noinline

2024-12-17 Thread Tiezhu Yang
dc_fixpt_from_fraction() is not a simple function, just mark it noinline to avoid the above issue. Signed-off-by: Tiezhu Yang --- drivers/gpu/drm/amd/display/dc/basics/fixpt31_32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/dc/basics/fixpt31_32.c

[PATCH v6 6/9] objtool/LoongArch: Add support for goto table

2024-12-17 Thread Tiezhu Yang
ablejump_annotate", then objtool may find the relocation info of goto table ".rodata..c_jump_table" with find_reloc_of_rodata_c_jump_table(). Signed-off-by: Tiezhu Yang --- tools/objtool/arch/loongarch/special.c | 32 -- 1 file changed, 30 insertions(+), 2 deletion

Re: [PATCH 1/2] drm/radeon: Don't use WC for VRAM if !RADEON_GEM_GTT_WC

2020-09-10 Thread Tiezhu Yang
On 09/09/2020 12:21 PM, Huacai Chen wrote: Though RADEON_GEM_GTT_WC is initially used for GTT, but this flag is bound to drm_arch_can_wc_memory(), and if arch doesn't support WC, then VRAM should not use WC. +cc RADEON and AMDGPU DRM DRIVERS maintainer Alex Deucher Christian König amd-gfx@lis

Re: [PATCH] gpu/drm: Remove TTM_PL_FLAG_WC of VRAM to fix writecombine issue for Loongson64

2020-08-10 Thread Tiezhu Yang
On 08/09/2020 08:13 PM, Christian König wrote: Am 08.08.20 um 15:50 schrieb Jiaxun Yang: 在 2020/8/8 下午9:41, Thomas Bogendoerfer 写道: On Sat, Aug 08, 2020 at 03:25:02PM +0800, Tiezhu Yang wrote: Loongson processors have a writecombine issue that maybe failed to write back framebuffer used

[PATCH] gpu/drm: Remove TTM_PL_FLAG_WC of VRAM to fix writecombine issue for Loongson64

2020-08-09 Thread Tiezhu Yang
p (current fence id 0x0112 last fence id 0x011d on ring 0) [ 60.976525] radeon :03:00.0: ring 3 stalled for more than 10086msec [ 60.983156] radeon :03:00.0: GPU lockup (current fence id 0x0374 last fence id 0x03a8 on ring 3) Signed-off-

Re: [PATCH v2] gpu/drm: Remove debug info about CPU address

2020-07-02 Thread Tiezhu Yang
On 07/02/2020 04:27 PM, Christian König wrote: Am 02.07.20 um 04:27 schrieb Tiezhu Yang: When I update the latest kernel, I see the following "ptrval" boot messages. [1.872600] radeon :01:05.0: fence driver on ring 0 use gpu addr 0x48000c00 and c

Re: [PATCH v2] gpu/drm: Remove debug info about CPU address

2020-07-02 Thread Tiezhu Yang
On 07/02/2020 04:39 PM, Christian König wrote: Am 02.07.20 um 10:35 schrieb Tiezhu Yang: On 07/02/2020 04:27 PM, Christian König wrote: Am 02.07.20 um 04:27 schrieb Tiezhu Yang: When I update the latest kernel, I see the following "ptrval" boot messages. [1.872600] r

[PATCH v2] gpu/drm: Remove debug info about CPU address

2020-07-02 Thread Tiezhu Yang
o about CPU address. Signed-off-by: Tiezhu Yang --- v2: - Just remove the debug info about CPU address suggested by Christian - Modify the patch subject and update the commit message drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 5 ++--- drivers/gpu/drm/radeon/radeon_fence.c | 4 ++--

[PATCH] gpu/drm: Replace "%p" with "%pK"

2020-06-30 Thread Tiezhu Yang
) have this similar issue, fix them. [1.872600] radeon :01:05.0: fence driver on ring 0 use gpu addr 0x48000c00 and cpu addr 0x(ptrval) [1.879095] radeon :01:05.0: fence driver on ring 5 use gpu addr 0x40056038 and cpu addr 0x(____ptrval____) Signed-off-by:

Re: [PATCH] gpu/drm: Replace "%p" with "%pK"

2020-06-30 Thread Tiezhu Yang
On 06/30/2020 04:05 PM, Christian König wrote: Am 30.06.20 um 09:36 schrieb Tiezhu Yang: When I update the latest kernel, I see the following "ptrval" boot messages. Use "%pK" instead of "%p" so that the cpu address can be printed when the kptr_rest