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

Transformers update #51

Merged
merged 5 commits into from
Jul 13, 2021
Merged

Transformers update #51

merged 5 commits into from
Jul 13, 2021

Conversation

clamor-s
Copy link
Contributor

No description provided.

@digetx
Copy link
Member

digetx commented Jul 12, 2021

@okias Looks like it tries to make a release tag here.

regulator-max-microvolt = <1500000>;
regulator-name = "vdd_1v2_gen";
regulator-min-microvolt = <1200000>;
regulator-max-microvolt = <1200000>;
Copy link
Member

Choose a reason for hiding this comment

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

Could you please tell where from you got these names and values?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Have you checked it on all transformer devices?

Copy link
Contributor Author

@clamor-s clamor-s Jul 12, 2021

Choose a reason for hiding this comment

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

Yes, tf201/tf300t/tf700t both native and kexec. Furthermore, those values can be logged from downstream is /sys/

Copy link
Contributor

Choose a reason for hiding this comment

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

Weren't the names correct?

Copy link
Member

Choose a reason for hiding this comment

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

Likely that the names were correct and N7 has incorrect names, but I'm not 100% sure.

@clamor-s
Copy link
Contributor Author

clamor-s commented Jul 13, 2021

@digetx looks like tf701t dock actually is a i2c device and CAN be bind as asus,dock-ec. I'd ask you to add part of changes I've proposed. Me and jenneron are currently working on proper solution that does not need specific per-device data definitions.

drivers/mfd/asus-ec.c Outdated Show resolved Hide resolved
Copy link
Member

@digetx digetx left a comment

Choose a reason for hiding this comment

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

TF101 would never boot previously. if it required firmware. Downstream kernels may have TF code, but it should be disabled by default. T20 consumer devices don't use TF in general.

@clamor-s
Copy link
Contributor Author

TF101 would never boot previously. if it required firmware. Downstream kernels may have TF code, but it should be disabled by default. T20 consumer devices don't use TF in general.

Agree, there are some thoughts about booting with android bootloader. TF101G does not have nvflash ability.

May this work? https://github.com/torvalds/linux/blob/master/arch/arm/boot/dts/tegra114-tn7.dts#L14-L16
Jenneron proposed to check, but none of TF101 users provided addresses needed.

@digetx
Copy link
Member

digetx commented Jul 13, 2021

Missing initrd shouldn't prevent kernel from booting. The problem that we had on N7 is that bootloader overwrites part of kernel with initrd if kernel image is too big. But it could be more complicated, like an odd h/w configuration left after bootloader. It's possible to debug kernel booting blindly by inserting PMC reboot call for finding the place in the code that causes the hang.

Enabling firmware for TF101 should break it entirely, please don't do it. I suppose that the TF patch wasn't tested, correct?

@clamor-s
Copy link
Contributor Author

clamor-s commented Jul 13, 2021

Actually it was and it worked (or I missunderstood). At least it did not brake anything. I'll call tf101 users in pmos on transformer channel for more info.

Btw, picasso bootloader did not have such issues?

UPD. Dropped tf101 fw commit and removed asus-ec log flag from remove func

priv->batt_data_ts = jiffies - 1;
priv->last_state = POWER_SUPPLY_STATUS_UNKNOWN;

cfg.of_node = pdev->dev.parent->of_node;
cfg.drv_data = priv;

if (pdata->is_pad)
if (!of_property_match_string(cfg.of_node, "compatible", "asus,pad-ec"))
Copy link
Member

@digetx digetx Jul 13, 2021

Choose a reason for hiding this comment

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

Couldn't of_device_is_compatible() be used here?

Copy link
Member

Choose a reason for hiding this comment

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

I'll change it after merging. The rest looks okay.

@digetx
Copy link
Member

digetx commented Jul 13, 2021

Picasso doesn't have such problem.

@digetx
Copy link
Member

digetx commented Jul 13, 2021

Thanks!

@digetx digetx merged commit 279721c into grate-driver:master Jul 13, 2021
@clamor-s clamor-s deleted the max-patch branch July 13, 2021 20:10
digetx pushed a commit that referenced this pull request Sep 4, 2021
Commit 3df98d7 ("lsm,selinux: pass flowi_common instead of flowi
to the LSM hooks") introduced flowi{4,6}_to_flowi_common() functions which
cause UBSAN warning when building with LLVM 11.0.1 on Ubuntu 21.04.

 ================================================================================
 UBSAN: object-size-mismatch in ./include/net/flow.h:197:33
 member access within address ffffc9000109fbd8 with insufficient space
 for an object of type 'struct flowi'
 CPU: 2 PID: 7410 Comm: systemd-resolve Not tainted 5.14.0 #51
 Hardware name: VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform, BIOS 6.00 02/27/2020
 Call Trace:
  dump_stack_lvl+0x103/0x171
  ubsan_type_mismatch_common+0x1de/0x390
  __ubsan_handle_type_mismatch_v1+0x41/0x50
  udp_sendmsg+0xda2/0x1300
  ? ip_skb_dst_mtu+0x1f0/0x1f0
  ? sock_rps_record_flow+0xe/0x200
  ? inet_send_prepare+0x2d/0x90
  sock_sendmsg+0x49/0x80
  ____sys_sendmsg+0x269/0x370
  __sys_sendmsg+0x15e/0x1d0
  ? syscall_enter_from_user_mode+0xf0/0x1b0
  do_syscall_64+0x3d/0xb0
  entry_SYSCALL_64_after_hwframe+0x44/0xae
 RIP: 0033:0x7f7081a50497
 Code: 0c 00 f7 d8 64 89 02 48 c7 c0 ff ff ff ff eb b7 0f 1f 00 f3 0f 1e fa 64 8b 04 25 18 00 00 00 85 c0 75 10 b8 2e 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 51 c3 48 83 ec 28 89 54 24 1c 48 89 74 24 10
 RSP: 002b:00007ffc153870f8 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
 RAX: ffffffffffffffda RBX: 000000000000000c RCX: 00007f7081a50497
 RDX: 0000000000000000 RSI: 00007ffc15387140 RDI: 000000000000000c
 RBP: 00007ffc15387140 R08: 0000563f29a5e4fc R09: 000000000000cd28
 R10: 0000563f29a68a30 R11: 0000000000000246 R12: 000000000000000c
 R13: 0000000000000001 R14: 0000563f29a68a30 R15: 0000563f29a5e50c
 ================================================================================

I don't think we need to call flowi{4,6}_to_flowi() from these functions
because the first member of "struct flowi4" and "struct flowi6" is

  struct flowi_common __fl_common;

while the first member of "struct flowi" is

  union {
    struct flowi_common __fl_common;
    struct flowi4       ip4;
    struct flowi6       ip6;
    struct flowidn      dn;
  } u;

which should point to the same address without access to "struct flowi".

Signed-off-by: Tetsuo Handa <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
okias pushed a commit to okias/linux that referenced this pull request Jan 7, 2024
[ Upstream commit 5d47ec2 ]

The `cls_redirect` test triggers a kernel panic like:

  # ./test_progs -t cls_redirect
  Can't find bpf_testmod.ko kernel module: -2
  WARNING! Selftests relying on bpf_testmod.ko will be skipped.
  [   30.938489] CPU 3 Unable to handle kernel paging request at virtual address fffffffffd814de0, era == ffff800002009fb8, ra == ffff800002009f9c
  [   30.939331] Oops[#1]:
  [   30.939513] CPU: 3 PID: 1260 Comm: test_progs Not tainted 6.7.0-rc2-loong-devel-g2f56bb0d2327 grate-driver#35 a896aca3f4164f09cc346f89f2e09832e07be5f6
  [   30.939732] Hardware name: QEMU QEMU Virtual Machine, BIOS unknown 2/2/2022
  [   30.939901] pc ffff800002009fb8 ra ffff800002009f9c tp 9000000104da4000 sp 9000000104da7ab0
  [   30.940038] a0 fffffffffd814de0 a1 9000000104da7a68 a2 0000000000000000 a3 9000000104da7c10
  [   30.940183] a4 9000000104da7c14 a5 0000000000000002 a6 0000000000000021 a7 00005555904d7f90
  [   30.940321] t0 0000000000000110 t1 0000000000000000 t2 fffffffffd814de0 t3 0004c4b400000000
  [   30.940456] t4 ffffffffffffffff t5 00000000c3f63600 t6 0000000000000000 t7 0000000000000000
  [   30.940590] t8 000000000006d803 u0 0000000000000020 s9 9000000104da7b10 s0 900000010504c200
  [   30.940727] s1 fffffffffd814de0 s2 900000010504c200 s3 9000000104da7c10 s4 9000000104da7ad0
  [   30.940866] s5 0000000000000000 s6 90000000030e65bc s7 9000000104da7b44 s8 90000000044f6fc0
  [   30.941015]    ra: ffff800002009f9c bpf_prog_846803e5ae81417f_cls_redirect+0xa0/0x590
  [   30.941535]   ERA: ffff800002009fb8 bpf_prog_846803e5ae81417f_cls_redirect+0xbc/0x590
  [   30.941696]  CRMD: 000000b0 (PLV0 -IE -DA +PG DACF=CC DACM=CC -WE)
  [   30.942224]  PRMD: 00000004 (PPLV0 +PIE -PWE)
  [   30.942330]  EUEN: 00000003 (+FPE +SXE -ASXE -BTE)
  [   30.942453]  ECFG: 00071c1c (LIE=2-4,10-12 VS=7)
  [   30.942612] ESTAT: 00010000 [PIL] (IS= ECode=1 EsubCode=0)
  [   30.942764]  BADV: fffffffffd814de0
  [   30.942854]  PRID: 0014c010 (Loongson-64bit, Loongson-3A5000)
  [   30.942974] Modules linked in:
  [   30.943078] Process test_progs (pid: 1260, threadinfo=00000000ce303226, task=000000007d10bb76)
  [   30.943306] Stack : 900000010a064000 90000000044f6fc0 9000000104da7b48 0000000000000000
  [   30.943495]         0000000000000000 9000000104da7c14 9000000104da7c10 900000010504c200
  [   30.943626]         0000000000000001 ffff80001b88c000 9000000104da7b70 90000000030e6668
  [   30.943785]         0000000000000000 9000000104da7b58 ffff80001b88c048 9000000003d05000
  [   30.943936]         900000000303ac88 0000000000000000 0000000000000000 9000000104da7b70
  [   30.944091]         0000000000000000 0000000000000001 0000000731eeab00 0000000000000000
  [   30.944245]         ffff80001b88c000 0000000000000000 0000000000000000 54b99959429f83b8
  [   30.944402]         ffff80001b88c000 90000000044f6fc0 9000000101d70000 ffff80001b88c000
  [   30.944538]         000000000000005a 900000010504c200 900000010a064000 900000010a067000
  [   30.944697]         9000000104da7d88 0000000000000000 9000000003d05000 90000000030e794c
  [   30.944852]         ...
  [   30.944924] Call Trace:
  [   30.945120] [<ffff800002009fb8>] bpf_prog_846803e5ae81417f_cls_redirect+0xbc/0x590
  [   30.945650] [<90000000030e6668>] bpf_test_run+0x1ec/0x2f8
  [   30.945958] [<90000000030e794c>] bpf_prog_test_run_skb+0x31c/0x684
  [   30.946065] [<90000000026d4f68>] __sys_bpf+0x678/0x2724
  [   30.946159] [<90000000026d7288>] sys_bpf+0x20/0x2c
  [   30.946253] [<90000000032dd224>] do_syscall+0x7c/0x94
  [   30.946343] [<9000000002541c5c>] handle_syscall+0xbc/0x158
  [   30.946492]
  [   30.946549] Code: 0015030e  5c0009c0  5001d000 <28c00304> 02c00484  29c00304  00150009  2a42d2e4  0280200d
  [   30.946793]
  [   30.946971] ---[ end trace 0000000000000000 ]---
  [   32.093225] Kernel panic - not syncing: Fatal exception in interrupt
  [   32.093526] Kernel relocated by 0x2320000
  [   32.093630]  .text @ 0x9000000002520000
  [   32.093725]  .data @ 0x9000000003400000
  [   32.093792]  .bss  @ 0x9000000004413200
  [   34.971998] ---[ end Kernel panic - not syncing: Fatal exception in interrupt ]---

This is because we signed-extend function return values. When subprog
mode is enabled, we have:

  cls_redirect()
    -> get_global_metrics() returns pcpu ptr 0xfffffefffc00b480

The pointer returned is later signed-extended to 0xfffffffffc00b480 at
`BPF_JMP | BPF_EXIT`. During BPF prog run, this triggers unhandled page
fault and a kernel panic.

Drop the unnecessary signed-extension on return values like other
architectures do.

With this change, we have:

  # ./test_progs -t cls_redirect
  Can't find bpf_testmod.ko kernel module: -2
  WARNING! Selftests relying on bpf_testmod.ko will be skipped.
  grate-driver#51/1    cls_redirect/cls_redirect_inlined:OK
  grate-driver#51/2    cls_redirect/IPv4 TCP accept unknown (no hops, flags: SYN):OK
  grate-driver#51/3    cls_redirect/IPv6 TCP accept unknown (no hops, flags: SYN):OK
  grate-driver#51/4    cls_redirect/IPv4 TCP accept unknown (no hops, flags: ACK):OK
  grate-driver#51/5    cls_redirect/IPv6 TCP accept unknown (no hops, flags: ACK):OK
  grate-driver#51/6    cls_redirect/IPv4 TCP forward unknown (one hop, flags: ACK):OK
  grate-driver#51/7    cls_redirect/IPv6 TCP forward unknown (one hop, flags: ACK):OK
  grate-driver#51/8    cls_redirect/IPv4 TCP accept known (one hop, flags: ACK):OK
  grate-driver#51/9    cls_redirect/IPv6 TCP accept known (one hop, flags: ACK):OK
  grate-driver#51/10   cls_redirect/IPv4 UDP accept unknown (no hops, flags: none):OK
  grate-driver#51/11   cls_redirect/IPv6 UDP accept unknown (no hops, flags: none):OK
  grate-driver#51/12   cls_redirect/IPv4 UDP forward unknown (one hop, flags: none):OK
  grate-driver#51/13   cls_redirect/IPv6 UDP forward unknown (one hop, flags: none):OK
  grate-driver#51/14   cls_redirect/IPv4 UDP accept known (one hop, flags: none):OK
  grate-driver#51/15   cls_redirect/IPv6 UDP accept known (one hop, flags: none):OK
  grate-driver#51/16   cls_redirect/cls_redirect_subprogs:OK
  grate-driver#51/17   cls_redirect/IPv4 TCP accept unknown (no hops, flags: SYN):OK
  grate-driver#51/18   cls_redirect/IPv6 TCP accept unknown (no hops, flags: SYN):OK
  grate-driver#51/19   cls_redirect/IPv4 TCP accept unknown (no hops, flags: ACK):OK
  grate-driver#51/20   cls_redirect/IPv6 TCP accept unknown (no hops, flags: ACK):OK
  grate-driver#51/21   cls_redirect/IPv4 TCP forward unknown (one hop, flags: ACK):OK
  grate-driver#51/22   cls_redirect/IPv6 TCP forward unknown (one hop, flags: ACK):OK
  grate-driver#51/23   cls_redirect/IPv4 TCP accept known (one hop, flags: ACK):OK
  grate-driver#51/24   cls_redirect/IPv6 TCP accept known (one hop, flags: ACK):OK
  grate-driver#51/25   cls_redirect/IPv4 UDP accept unknown (no hops, flags: none):OK
  grate-driver#51/26   cls_redirect/IPv6 UDP accept unknown (no hops, flags: none):OK
  grate-driver#51/27   cls_redirect/IPv4 UDP forward unknown (one hop, flags: none):OK
  grate-driver#51/28   cls_redirect/IPv6 UDP forward unknown (one hop, flags: none):OK
  grate-driver#51/29   cls_redirect/IPv4 UDP accept known (one hop, flags: none):OK
  grate-driver#51/30   cls_redirect/IPv6 UDP accept known (one hop, flags: none):OK
  grate-driver#51/31   cls_redirect/cls_redirect_dynptr:OK
  grate-driver#51/32   cls_redirect/IPv4 TCP accept unknown (no hops, flags: SYN):OK
  grate-driver#51/33   cls_redirect/IPv6 TCP accept unknown (no hops, flags: SYN):OK
  grate-driver#51/34   cls_redirect/IPv4 TCP accept unknown (no hops, flags: ACK):OK
  grate-driver#51/35   cls_redirect/IPv6 TCP accept unknown (no hops, flags: ACK):OK
  grate-driver#51/36   cls_redirect/IPv4 TCP forward unknown (one hop, flags: ACK):OK
  grate-driver#51/37   cls_redirect/IPv6 TCP forward unknown (one hop, flags: ACK):OK
  grate-driver#51/38   cls_redirect/IPv4 TCP accept known (one hop, flags: ACK):OK
  grate-driver#51/39   cls_redirect/IPv6 TCP accept known (one hop, flags: ACK):OK
  grate-driver#51/40   cls_redirect/IPv4 UDP accept unknown (no hops, flags: none):OK
  grate-driver#51/41   cls_redirect/IPv6 UDP accept unknown (no hops, flags: none):OK
  grate-driver#51/42   cls_redirect/IPv4 UDP forward unknown (one hop, flags: none):OK
  grate-driver#51/43   cls_redirect/IPv6 UDP forward unknown (one hop, flags: none):OK
  grate-driver#51/44   cls_redirect/IPv4 UDP accept known (one hop, flags: none):OK
  grate-driver#51/45   cls_redirect/IPv6 UDP accept known (one hop, flags: none):OK
  grate-driver#51      cls_redirect:OK
  Summary: 1/45 PASSED, 0 SKIPPED, 0 FAILED

Fixes: 5dc6155 ("LoongArch: Add BPF JIT support")
Signed-off-by: Hengqi Chen <[email protected]>
Signed-off-by: Huacai Chen <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants