Skip to content

Move Surface Aggregator client devices on Surface Book 3 from base hub to KIP hub - #112

Merged
qzed merged 3 commits into
v5.14-surface-develfrom
v5.14-kip
Oct 31, 2021
Merged

qzed merged 3 commits into
v5.14-surface-develfrom
v5.14-kip

Conversation

@qzed

@qzed qzed commented Oct 31, 2021

Copy link
Copy Markdown
Member

This moves the SSAM client devices attached to the Surface Book 3 base from the base hub to the KIP hub which seems to be the intended subsystem for managing those devices. With this change, the base hub becomes unused and can be removed.

qzed added 3 commits October 31, 2021 20:42
In cases of hot-removal, further communication with the device should be
avoided whenever possible, as it may fail and time out.

Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
… base devices

It turns out that the Surface Book 3 manages the devices contained in
its detachable base via the KIP hub as well, similarly to the Surface
Pro 8 and Surface Pro X. So move them over to the KIP hub.

Right now, we (mis-)use the detachment subsystem (DTX), which is
designed for handling detachment requests and physical locking of the
base, to properly remove and re-attach Surface System Aggregator Module
(SSAM) client devices contained in the base. This system does not seem
to be intended for managing the (sub-)devices contained in the base,
which may need some time to be set up properly.

The KIP subsystem seems to be the intended subsystem for managing those
devices, thus let's use that one instead.

Note that this also changes the way in which devices on the Surface Book
3 are removed when they have been detached, specifically from normal
removal to hot-removal (avoiding further communication with the embedded
controller). It seems that the "communication timeout after device
removal" issue does also occur on the Surface Book 3, but has so far
been missed as it does not happen reliably every time. Switching to
hot-removal fixes this issue and should not have any noticable
drawbacks.

Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
The base hub was a virtual device hub for Surface System Aggregator
Module (SSAM) client devices contained in the detachable Surface Book 3
base. Remove it as it is no longer needed.

In the previous change, we have moved all devices from the base hub to
the KIP hub. That change has also removed the only base-hub-device that
ever existed, as it was essentially replaced by the KIP-hub-device and
thus was no longer needed. This means that there is no remaining
hub-device against which the base hub driver can load, i.e. it is now
essentially dead code. So remove the driver as well.

Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
@qzed
qzed merged commit e716df1 into v5.14-surface-devel Oct 31, 2021
@qzed
qzed deleted the v5.14-kip branch October 31, 2021 19:45
qzed pushed a commit that referenced this pull request Jun 7, 2022
WARNING: line length of 108 exceeds 100 columns
#97: FILE: tools/testing/selftests/vm/mremap_test.c:136:
+	char *start = mmap(NULL, 3 * page_size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);

WARNING: Missing a blank line after declarations
#98: FILE: tools/testing/selftests/vm/mremap_test.c:137:
+	char *start = mmap(NULL, 3 * page_size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+	munmap(start + page_size, page_size);

ERROR: space required before the open parenthesis '('
#107: FILE: tools/testing/selftests/vm/mremap_test.c:146:
+	while(getline(&line, &len, fp) != -1) {

ERROR: space required after that ',' (ctx:VxV)
#108: FILE: tools/testing/selftests/vm/mremap_test.c:147:
+		char *first = strtok(line,"- ");
 		                         ^

ERROR: space required after that ',' (ctx:VxV)
#110: FILE: tools/testing/selftests/vm/mremap_test.c:149:
+		char *second = strtok(NULL,"- ");
 		                          ^

WARNING: Missing a blank line after declarations
#112: FILE: tools/testing/selftests/vm/mremap_test.c:151:
+		void *second_val = (void *) strtol(second, NULL, 16);
+		if (first_val == start && second_val == start + 3 * page_size) {

total: 3 errors, 3 warnings, 113 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

./patches/mm-add-merging-after-mremap-resize.patch has style problems, please review.

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.

Please run checkpatch prior to sending patches

Cc: Jakub Matěna <matenajakub@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
StollD pushed a commit that referenced this pull request Mar 9, 2024
[ Upstream commit b16904f ]

With latest upstream llvm18, the following test cases failed:

  $ ./test_progs -j
  #13/2    bpf_cookie/multi_kprobe_link_api:FAIL
  #13/3    bpf_cookie/multi_kprobe_attach_api:FAIL
  #13      bpf_cookie:FAIL
  #77      fentry_fexit:FAIL
  #78/1    fentry_test/fentry:FAIL
  #78      fentry_test:FAIL
  #82/1    fexit_test/fexit:FAIL
  #82      fexit_test:FAIL
  #112/1   kprobe_multi_test/skel_api:FAIL
  #112/2   kprobe_multi_test/link_api_addrs:FAIL
  [...]
  #112     kprobe_multi_test:FAIL
  #356/17  test_global_funcs/global_func17:FAIL
  #356     test_global_funcs:FAIL

Further analysis shows llvm upstream patch [1] is responsible for the above
failures. For example, for function bpf_fentry_test7() in net/bpf/test_run.c,
without [1], the asm code is:

  0000000000000400 <bpf_fentry_test7>:
     400: f3 0f 1e fa                   endbr64
     404: e8 00 00 00 00                callq   0x409 <bpf_fentry_test7+0x9>
     409: 48 89 f8                      movq    %rdi, %rax
     40c: c3                            retq
     40d: 0f 1f 00                      nopl    (%rax)

... and with [1], the asm code is:

  0000000000005d20 <bpf_fentry_test7.specialized.1>:
    5d20: e8 00 00 00 00                callq   0x5d25 <bpf_fentry_test7.specialized.1+0x5>
    5d25: c3                            retq

... and <bpf_fentry_test7.specialized.1> is called instead of <bpf_fentry_test7>
and this caused test failures for #13/#77 etc. except #356.

For test case #356/17, with [1] (progs/test_global_func17.c)), the main prog
looks like:

  0000000000000000 <global_func17>:
       0:       b4 00 00 00 2a 00 00 00 w0 = 0x2a
       1:       95 00 00 00 00 00 00 00 exit

... which passed verification while the test itself expects a verification
failure.

Let us add 'barrier_var' style asm code in both places to prevent function
specialization which caused selftests failure.

  [1] llvm/llvm-project#72903

Signed-off-by: Yonghong Song <yonghong.song@linux.dev>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20231127050342.1945270-1-yonghong.song@linux.dev
Signed-off-by: Sasha Levin <sashal@kernel.org>
davidssurfacebot pushed a commit to davidbitterlich/kernel that referenced this pull request Nov 2, 2026
Extend update_insn_state_arm64() to support register-to-register and
immediate-to-register 'mov' instructions.

For register-to-register 'mov' (e.g., mov dreg, sreg), propagate data type
information from the source register to the destination register.

For immediate-to-register 'mov' (e.g., mov dreg, #imm), store the immediate
value in the destination register's imm_value field and set its kind to
TSR_KIND_CONST, allowing subsequent instructions to resolve it as a
constant.

A real-world example is shown below:

  ffff8000803eebf8 <get_vma_policy>:
  ffff8000803eec20:  mov  x21, x0          // x0 (struct vm_area_struct*) -> x21
  ffff8000803eec28:  ldr  x2, [x0, linux-surface#112]
  ffff8000803eec2c:  cbz  x2, ffff8000803eec94 <get_vma_policy+0x9c>
* ffff8000803eec94:  ldr  x0, [x21, linux-surface#152]

Before this commit, the type of x21 was unknown, causing the subsequent
inference to fail:

  var [0] reg0 offset 0 type='struct vm_area_struct*' size=0x8
  chk [9c] reg21 offset=0x98 ok=0 kind=0 cfa : no type information
  final result: no type information

After this commit, the type of x21 is correctly inferred as 'vm_area_struct':

  var [0] reg0 offset 0 type='struct vm_area_struct*' size=0x8
  mov [28] reg0 -> reg21 type='struct vm_area_struct*' size=0x8
  chk [9c] reg21 offset=0x98 ok=1 kind=1 (struct vm_area_struct*) : Good!
  found by insn track: 0x98(reg21) type-offset=0x98
  final result:  type='struct vm_area_struct' size=0xb0

Reviewed-by: Ian Rogers <irogers@google.com>
Reviewed-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Tengda Wu <wutengda@huaweicloud.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
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.

1 participant