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

A test got slower after api_vcpu_prepare_run was ported #10

Closed
efenniht opened this issue Jul 31, 2019 · 5 comments · Fixed by #22
Closed

A test got slower after api_vcpu_prepare_run was ported #10

efenniht opened this issue Jul 31, 2019 · 5 comments · Fixed by #22
Assignees

Comments

@efenniht
Copy link
Collaborator

efenniht commented Jul 31, 2019

PR #9 이후로 vcpu_state.concurrent_save_restore 라는 테스트 케이스가 실행 시간이 느려져서 timeout 때문에 실패합니다. 원인이 api_vcpu_prepare_run이라는 건 이 함수만 C 코드로 교체했을 때 잘 작동해서 알게 되었습니다.
Naive한 계획은:

  • Hafnium repo 에 대기 중인 PR을 바탕으로 Rust 코드를 수정하면 더 빨라지지 않을까?
  • 다른 코드를 마저 Rust로 옮기면 더 빨라지지 않을까?
  • 이 코드를 refactoring하면 더 빨라지지 않을까?
@efenniht
Copy link
Collaborator Author

일단 여기에 그 PR을 반영해 보았는데 smp.two_vcpus 테스트 케이스가 타임아웃으로 실패합니다. 나중에 더 확인해보기로...

@efenniht efenniht self-assigned this Aug 10, 2019
@efenniht
Copy link
Collaborator Author

이 테스트는 그 PR이 생성될 당시에는 테스트되지 않았습니다. 근데 이 테스트가 만들어진 시기가 PR이 만들어진 시기보다 이른데 어떻게 된 건지 모르겠네요.

@efenniht
Copy link
Collaborator Author

디버깅 결과, src/arch/aarch64/hypervisor/psci_handler.cpsci_secondary_vm_handler의 다음 코드에서 문제가 발생합니다:

target_vcpu = vcpu_lock(vm_get_vcpu(vm, target_vcpu_index));
*ret = vcpu_is_off(target_vcpu) ? PSCI_RETURN_OFF
				: PSCI_RETURN_ON;
vcpu_unlock(&target_vcpu);
break;

여기서 vcpu_lock을 수행할 때 무한루프를 돕니다. 이 코드는 (원래 PR에서는 없던) 패치 당시에 여기에 target_vcpu의 타입만 vcpu_locked 에서 vcpu_execution_locked로 바꾼 것인데, 아예 내용을 바꾸어야 할 것 같습니다.

어떻게 바꿀지는 좀 더 내용을 읽어보고 하겠습니다...

@efenniht
Copy link
Collaborator Author

이 코드는 타겟 vcpu 가 작동 중인지 체크하는 코드인데, 이제는 RUNNING 상태일 때에는 락이 걸리도록 되어 있었으므로, vcpu_try_lock을 만드는 방법으로 고쳤습니다.

@efenniht
Copy link
Collaborator Author

고칠 때 방법은, lock이 걸려 있으면 running이다, 라는 가정을 했는데요, running 이면 lock이 걸려 있지만 lock 이 걸려 있다고 running일까요? 조사해 볼 필요가 있습니다.

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 a pull request may close this issue.

1 participant