[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH V7 01/18] perf/core: Use static_call to optimize perf_guest_info_callbacks
- To: Zhu Lingshan <lingshan.zhu@xxxxxxxxx>, lingshan.zhu@xxxxxxxx
- From: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
- Date: Tue, 22 Jun 2021 13:31:54 -0400
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=sF9B9msUqlPodgpOgTK/j2ZCCIDp54oksLKTPM+GdSs=; b=aRT/1LrfyMgmyC/2mSYKvai+JpoeKCOO1yPoQU8hGX6FYfXF0njmZ5eeEAxglNomlYzknMiGBub1zB/n1eH18C0Jbv8Z6V/Gu9q0tEeLuGjMmP8CxhAYjHUjX1n/ypfCwnqkglXYHsSER8MUbCHMlDEl3uClT5RGh5ujep6YV5XNSGKN/ydmiaOSoDSZorO/o2tYhUIWOLZQIwHb0h7OZN19XaVBzEQi8583VLKmWtsoRh9lnXW98P8BiH8iLuM1WyZGwilPpNDfQNIcimIFwyO2KOj7uBIjgFz6TLUgGoiHUWDFvPKAgycCvzMyE0bHEDsXqR6IQrjzsUoXzGwvPw==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CQWuFbq/lPVSfpTZw948PFpsFc3T2BkUDI1mzqDMtsGtRrFA7brLUaDstrTzwkEhtlXOY75znL7dkcnTF9hc9XwTAG5XNbAP4FfM1wMnBwwu1n8ySTGXIwZZ8zngeKaMAjAOcY2nCVmpcaytQwIR9TTstoKngxr49bbk/oq9x1Avyb0Bg0bBAfbmAVzFCtD9Fj2EtL5FeIwI58vlmBRLzda7PmFh18RM7F4wgwqoVzN24FlYSbxmpWiGSWWeRT22RxO9IMkJeSAngXE3vnJ0xr3yJgJqEN3UHt81jhchQgtM2paWUtLobpVD/eCkNXrnvk9ul/Osiv7vVxqSopLrUg==
- Authentication-results: infradead.org; dkim=none (message not signed) header.d=none;infradead.org; dmarc=none action=none header.from=oracle.com;
- Cc: Like Xu <like.xu@xxxxxxxxxxxxxxx>, Will Deacon <will@xxxxxxxxxx>, Marc Zyngier <maz@xxxxxxxxxx>, Guo Ren <guoren@xxxxxxxxxx>, Nick Hu <nickhu@xxxxxxxxxxxxx>, Paul Walmsley <paul.walmsley@xxxxxxxxxx>, linux-arm-kernel@xxxxxxxxxxxxxxxxxxx, kvmarm@xxxxxxxxxxxxxxxxxxxxx, linux-csky@xxxxxxxxxxxxxxx, linux-riscv@xxxxxxxxxxxxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxxx, Peter Zijlstra <peterz@xxxxxxxxxxxxx>
- Delivery-date: Tue, 22 Jun 2021 17:32:47 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 6/22/21 5:38 AM, Zhu Lingshan wrote:
> -static int xen_is_user_mode(void)
> -{
> - const struct xen_pmu_data *xenpmu_data = get_xenpmu_data();
> + state |= PERF_GUEST_ACTIVE;
>
> - if (!xenpmu_data) {
> - pr_warn_once("%s: pmudata not initialized\n", __func__);
> - return 0;
> + if (xenpmu_data->pmu.pmu_flags & PMU_SAMPLE_PV) {
> + if (xenpmu_data->pmu.pmu_flags & PMU_SAMPLE_USER)
> + state |= PERF_GUEST_USER;
> + } else {
> + if (!!(xenpmu_data->pmu.r.regs.cpl & 3))
> + state |= PERF_GUEST_USER;
Please drop "!!", it's not needed here. And use "else if".
With that, for Xen bits:
Reviewed-by: Boris Ostrovsky <boris.ostrvsky@xxxxxxxxxx>
-boris
|