Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LoongArch: Fix some issues and update interrupt registration policy #269

Merged
merged 4 commits into from
Jun 14, 2024

Conversation

sterling-teng
Copy link
Contributor

No description provided.

Yanteng Si added 4 commits June 13, 2024 16:20
…d BPI

After this patch,KASLR is really disabled when nokaslr passed from
boot parameter for old BPI.

Fixes: 59eab58 ("LoongArch: Old BPI compatibility")
Signed-off-by: Hongchen Zhang <[email protected]>
Signed-off-by: Ming Wang <[email protected]>
Signed-off-by: Yanteng Si <[email protected]>
The current code is using a fixed mapping between the LS7A interrupt source
and the HT interrupt vector. This prevents the utilization of the full
interrupt vector space and therefore limits the number of interrupt source
in a system.

Replace the fixed mapping with a dynamic mapping which allocates a
vector when an interrupt source is set up. This avoids that unused
sources prevent vectors from being used for other devices.

Introduce a mapping table in struct pch_pic, where each interrupt source
will allocate an index as a 'hwirq' number from the table in the order of
application and set table value as interrupt source number. This hwirq
number will be configured as vector in the HT interrupt controller. For an
interrupt source, the validity period of the obtained hwirq will last until
the system reset.

Co-developed-by: Biao Dong <[email protected]>
Signed-off-by: Biao Dong <[email protected]>
Co-developed-by: Tianyang Zhang <[email protected]>
Signed-off-by: Tianyang Zhang <[email protected]>
Signed-off-by: Baoqi Zhang <[email protected]>
Signed-off-by: Yanteng Si <[email protected]>
When we boot a 3C5000-7A2000 2Node server using "nr_cpus=1 maxcpus=1",
we get the following Call Trace:
    4.807397] ------------[ cut here ]------------
[    4.811996] WARNING: CPU: 0 PID: 1 at drivers/acpi/irq.c:63 acpi_register_gsi+0xe0/0x100
[    4.820048] Modules linked in:
[    4.823082] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 6.9.0-rc7-next-20240509+ deepin-community#26
[    4.830604] Hardware name: LOONGSON Dabieshan/Loongson-LS2C50C2, BIOS Loongson UEFI (3C50007A2000_Ls2c5lc2) V4.0.13-Dual 12/06/23 17:33:54
[    4.842964] pc 9000000000bdc6e0 ra 9000000000bdc66c tp 90000002051d4000 sp 90000002051d7ae0
[    4.851269] a0 0000000000000000 a1 00000000000000a0 a2 0000000000000000 a3 0000000000000000
[    4.859567] a4 9000000200014518 a5 000000000000003c a6 90000000018876b0 a7 00302e39303a3030
[    4.867866] t0 0000000000000000 t1 0000000000000080 t2 0000000000000040 t3 0000000000036800
[    4.876165] t4 0000000000036800 t5 0000000000000004 t6 0000000000000000 t7 0000000000000000
[    4.884464] t8 900000000800d910 u0 0000000000000000 s9 90000000014bf9e8 s0 00000000000000a0
[    4.892763] s1 0000000000000000 s2 0000000000000000 s3 9000000001985000 s4 90000002051d7b88
[    4.901063] s5 0000000000000001 s6 90000002055470b8 s7 90000000014400ac s8 0000000000000008
[    4.909362]    ra: 9000000000bdc66c acpi_register_gsi+0x6c/0x100
[    4.915330]   ERA: 9000000000bdc6e0 acpi_register_gsi+0xe0/0x100
[    4.921297]  CRMD: 000000b0 (PLV0 -IE -DA +PG DACF=CC DACM=CC -WE)
[    4.927446]  PRMD: 00000004 (PPLV0 +PIE -PWE)
[    4.931777]  EUEN: 00000000 (-FPE -SXE -ASXE -BTE)
[    4.936538]  ECFG: 00071c1d (LIE=0,2-4,10-12 VS=7)
[    4.941301] ESTAT: 000c0000 [BRK] (IS= ECode=12 EsubCode=0)
[    4.946838]  PRID: 0014c011 (Loongson-64bit, Loongson-3C5000)
[    4.952545] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 6.9.0-rc7-next-20240509+ deepin-community#26
[    4.960066] Hardware name: LOONGSON Dabieshan/Loongson-LS2C50C2, BIOS Loongson UEFI (3C50007A2000_Ls2c5lc2) V4.0.13-Dual 12/06/23 17:33:54
[    4.972425] Stack : 9000000001985000 0000000000000000 9000000000223524 90000002051d4000
[    4.980382]         90000002051d7740 90000002051d7748 0000000000000000 90000002051d7888
[    4.988338]         90000002051d7880 90000002051d7880 90000002051d7690 0000000000000001
[    4.996294]         0000000000000001 90000002051d7748 420a070366b7e75d 90000002054f4500
[    5.004251]         0000000000000001 0000000000000000 4137303030354333 c0000000ffffdfff
[    5.012206]         0000000000000003 00000000000ea642 0000000006b3c000 90000000014bf9e8
[    5.020163]         0000000000000000 0000000000000000 90000000017f7e80 9000000001985000
[    5.028119]         0000000000000001 0000000000000000 ffffffffffd7f549 90000000014400ac
[    5.036075]         0000000000000008 0000000000000000 900000000022353c 00007ffff1354000
[    5.044031]         00000000000000b0 0000000000000004 0000000000000000 0000000000071c1d
[    5.051987]         ...
[    5.054410] Call Trace:
[    5.054412] [<900000000022353c>] show_stack+0x5c/0x1a0
[    5.061940] [<900000000141e86c>] dump_stack_lvl+0x9c/0xc4
[    5.067305] [<900000000140170c>] __warn+0x94/0xcc
[    5.071977] [<90000000013cd900>] report_bug+0x160/0x220
[    5.077170] [<900000000141facc>] do_bp+0x26c/0x2e0
[    5.081929] [<0000000000000000>] 0x0
[    5.085475] [<9000000000bdc6e0>] acpi_register_gsi+0xe0/0x100
[    5.091182] [<9000000000bd5350>] acpi_pci_irq_enable+0xd0/0x220
[    5.097061] [<9000000000b5e8d4>] pci_device_probe+0x54/0x260
[    5.102683] [<9000000000d1fefc>] really_probe+0xbc/0x320
[    5.107960] [<9000000000d201f0>] __driver_probe_device+0x90/0x160
[    5.114012] [<9000000000d202f8>] driver_probe_device+0x38/0x120
[    5.119892] [<9000000000d205d4>] __driver_attach+0x94/0x1c0
[    5.125426] [<9000000000d1d7ac>] bus_for_each_dev+0x8c/0x100
[    5.131046] [<9000000000d1ee30>] bus_add_driver+0xf0/0x240
[    5.136494] [<9000000000d21688>] driver_register+0x68/0x140
[    5.142028] [<9000000000220158>] do_one_initcall+0x78/0x200
[    5.147561] [<9000000001440fcc>] kernel_init_freeable+0x23c/0x2b0
[    5.153614] [<900000000142123c>] kernel_init+0x1c/0x120
[    5.158802] [<9000000000221348>] ret_from_kernel_thread+0xc/0xa4

[    5.166244] ---[ end trace 0000000000000000 ]---
[    5.170998] GSI: No registered irqchip, giving up

The root cause is that when the CPU boot from flat mode, it is
unreliable to use cpu_to node to calculate the node number.
Therefore, we use NODES_PER_FLATMODE_NODE to calculate the
physical node number.

According to the 3C5000 user manual, the value of
NODES_PER_FLATMODE_NODE should be 4.

Signed-off-by: Ming Wang <[email protected]>
Signed-off-by: Hongchen Zhang <[email protected]>
Signed-off-by: Yanteng Si <[email protected]>
Fixes: d7aad0c ("LoongArch: add kernel setvirtmap for runtime")
Signed-off-by: Yun Liu <[email protected]>
Signed-off-by: Hongchen Zhang <[email protected]>
Signed-off-by: Yanteng Si <[email protected]>
@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign liujianqiang-niu for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@deepin-ci-robot
Copy link

Hi @sterling-teng. Thanks for your PR.

I'm waiting for a deepin-community member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Copy link
Member

@opsiff opsiff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/ok-to-test

Copy link
Member

@opsiff opsiff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@deepin-ci-robot
Copy link

deepin pr auto review

关键摘要:

  • pch_pic_domain_translate函数中,使用spin_lock_irqsavespin_unlock_irqrestore可能导致不必要的上下文切换,应该考虑使用raw_spin_lockraw_spin_unlock
  • pch_pic_alloc函数中,writeb操作应该在raw_spin_lockraw_spin_unlock之间添加同步机制,以确保数据的一致性和完整性。
  • pch_pic_reset函数中,writeb操作应该在raw_spin_lockraw_spin_unlock之间添加同步机制,以确保数据的一致性和完整性。
  • pch_pic_init函数中,初始化priv->table时,应该使用memset而不是循环赋值,以提高性能。
  • pch_pic_bitsetpch_pic_bitclr函数中,应该添加对priv指针的校验,以确保操作的对象有效。
  • hwirq_to_bit函数的实现可能存在逻辑错误,因为它直接将hwirqNODES_PER_FLATMODE_NODE相除,而没有考虑到NODES_PER_FLATMODE_NODE的值可能不是2的幂。
  • pch_pic_set_type函数中,对于IRQ_TYPE_LEVEL_LOWIRQ_TYPE_LEVEL_HIGHpch_pic_bitclrpch_pic_bitset的调用顺序可能不正确,应该先设置PIC_REG_EDGE,然后再设置PIC_REG_POL

是否建议立即修改:

@opsiff opsiff merged commit b739577 into deepin-community:linux-6.6.y Jun 14, 2024
3 of 4 checks passed
@opsiff
Copy link
Member

opsiff commented Jun 14, 2024

有一个疑问就是NODES_PER_FLATMODE_NODE用到的时候是否NODES_PER_FLATMODE_NODE宏定义都存在?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants