Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp262466pxj; Tue, 18 May 2021 02:48:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxsvxNUmrnt3lfCKLWpBEbLNYBDN1dUXkKLZW7VvwlJckK5MCjLm5fvn+hrrasurhnSANP1 X-Received: by 2002:a05:6e02:507:: with SMTP id d7mr3498344ils.19.1621331335150; Tue, 18 May 2021 02:48:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621331335; cv=none; d=google.com; s=arc-20160816; b=qCOxKaEDi8DVTMjjuU8FbUukp5QnucG6LZm4R7yaXNd2/cW9x5vMVGUvAS9e9BevW/ cRE9XDeYb9jxWYXaVut4hpGNc2LxvhbjtDClTJm8flfb0O1oJpOcCu3y0y75ZFEMaiuF U9MPswZQBxOMV30IYRsKzC7LKoLM724E14krJyEAKt3gUOX7v6CrokA6evKOWl9UC4wb VDx+aZ3BLugYr/1YAlY6HI4e0zVPVJcQwKzwx1oknWK129b9DypyvJHc3FP9i5KAgX9Q Wj6Y5C5oMlZvKOysG0C/C5rTyeRR8eVZnm9UzMNx9XMC0l7yrmjIqWLCYX2P+2q5tujh vTnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:ironport-sdr:ironport-sdr; bh=xv2KSvo16M4SsZimi4gqion3H+4HoGmHiD2dNzDRPc0=; b=t2HZRwcm1FXa+anCUONMM5tIHYJwi4C5npo1sK9vwB3GgpxCNk7GnMz0cKbxk9MOTC AdCYUa0jgBaguZemZnAJ4KHf0bg6/Ym0EeLYF0ly4Ri/k+V5HcFmfe+vCCToaCtkoJfW e8/1rjJJlLSxfQFJTye+EPks6oHI50M662lLjELMg/NIQg2saj03g97CcdztlEUQKxrB ndWcPqlqpuY+6Cazp2K4MSfKSAj1ir6zcfllLfCYA0qTJqfzQJd33UwHUxxFXlwAjdn+ 5Jy2So86fS6ZsP8bb2W2Y+jQGTsK9dsiyJvHQx4+guHfKsqD9EYkROTB+5QxzvqwK6Ky H3qw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h3si19818852jam.96.2021.05.18.02.48.43; Tue, 18 May 2021 02:48:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243273AbhEQPJc (ORCPT + 99 others); Mon, 17 May 2021 11:09:32 -0400 Received: from mga12.intel.com ([192.55.52.136]:52859 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242559AbhEQO7z (ORCPT ); Mon, 17 May 2021 10:59:55 -0400 IronPort-SDR: OqUwtqWNYDfdDO3uFAqmgaq9Xdf5evGw+DmvOrl/3Nhhf2GL1ufZIFiyFCbKMKt+9DBaAIRiWd omE2D+2yHPjw== X-IronPort-AV: E=McAfee;i="6200,9189,9987"; a="180080141" X-IronPort-AV: E=Sophos;i="5.82,307,1613462400"; d="scan'208";a="180080141" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 May 2021 07:50:26 -0700 IronPort-SDR: iIgpmFCjC+ba4PHw13ILGS1IQbgwQUXRhKvrLaJrySRFIcicr/hLb428X1DYTCkt3PCUMCgoEw kxVuVGQPc3IA== X-IronPort-AV: E=Sophos;i="5.82,307,1613462400"; d="scan'208";a="410852673" Received: from akleen-mobl1.amr.corp.intel.com (HELO [10.212.163.36]) ([10.212.163.36]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 May 2021 07:50:13 -0700 Subject: Re: [PATCH v6 08/16] KVM: x86/pmu: Add IA32_DS_AREA MSR emulation to support guest DS To: Peter Zijlstra , Like Xu Cc: Paolo Bonzini , Borislav Petkov , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , weijiang.yang@intel.com, Kan Liang , wei.w.wang@intel.com, eranian@google.com, liuxiangdong5@huawei.com, linux-kernel@vger.kernel.org, x86@kernel.org, kvm@vger.kernel.org References: <20210511024214.280733-1-like.xu@linux.intel.com> <20210511024214.280733-9-like.xu@linux.intel.com> From: Andi Kleen Message-ID: <3b13359c-5b7a-f103-74ff-1f57389db181@linux.intel.com> Date: Mon, 17 May 2021 07:50:02 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/17/2021 6:26 AM, Peter Zijlstra wrote: > On Tue, May 11, 2021 at 10:42:06AM +0800, Like Xu wrote: >> @@ -3897,6 +3898,8 @@ static struct perf_guest_switch_msr *intel_guest_get_msrs(int *nr, void *data) >> { >> struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events); >> struct perf_guest_switch_msr *arr = cpuc->guest_switch_msrs; >> + struct debug_store *ds = __this_cpu_read(cpu_hw_events.ds); >> + struct kvm_pmu *pmu = (struct kvm_pmu *)data; > You can do without the cast, this is C, 'void *' silently casts to any > other pointer type. FWIW doing the C++ like casts for void * is fairly standard C coding style. I generally prefer it too for better documentation. K&R is written this way. -Andi (my last email on this topic to avoid any bike shedding)