Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp8248499ybn; Tue, 1 Oct 2019 05:35:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqwWzHCS9mfsu6c6IZPPVvAfz+0dJOakaRTTkubeis+f/8kzqXdFaPdixm/X1+87SC5o+KtH X-Received: by 2002:a50:d0d5:: with SMTP id g21mr25253732edf.204.1569933312189; Tue, 01 Oct 2019 05:35:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569933312; cv=none; d=google.com; s=arc-20160816; b=YjIicRw/wC3cs9hwWJK5EXBA29s18ens8USZJJJMDoskntrC6tWFECdq/UZWGBY6Z+ PDxn3rP8lwa7G9d8SzurNbvToyMN25lo4z0JVcG0utjKI3OK7CcPJ4EL8hzCdx3YjwxZ Vq173bqZAM9KhAjA1SLuWYgKH16ZWkcJO2NoqkcsmyVw6KlolyE5Ku6a17ApQhw7rALl ur2xJTYztdVFvHXG6l9vHaEki3aWYMOgf17gZ7z6/MCBqv+vRujWcsxNih6Th1fhYl0z IMnZiMcmOq1CbY7ql1tPDgUsa0oZqWeY6VYfaqy3XnqUqiM3/fGdqmp4K4piyjRGgafH oZ8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject; bh=h+k8RxUpD2WnctewWklYTUnesncch/TP7wfItV/qk0Y=; b=kb9ft5jnXaOIiTsk35jUHPct1QKdY12TOJHLdoJl2XrnQ1ND8iYmDvxyelq30PvobB 0mltXbnn0qw3B0zY3eCusWkjtQ8pnjZGmW1pSkXwsSE6uWBfoU0YD0tcCN+451VlAOjf b8gyuomqlBBSxxN7L/z5JrNyYcpWrE7FXtIc6bDIKIeVbyuOO/qHHThWEa70VfOoTQCk O7x+5sSL8e4PZqrxCjdO5dpE+sqh6DDyhs+3EeCCo0GVxUJjwxUEWaXoW4wDSvfhIEKq jYE+DaDjN4TZ9SEJI3Ilvqojq0FON+csEfx2cIqU0gzmXkbOWgCaXQScVrdDlGMYMM3g Z7IA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id 96si8973243edq.24.2019.10.01.05.34.47; Tue, 01 Oct 2019 05:35:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S2387863AbfJAMdv (ORCPT + 99 others); Tue, 1 Oct 2019 08:33:51 -0400 Received: from mga12.intel.com ([192.55.52.136]:21857 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726181AbfJAMdu (ORCPT ); Tue, 1 Oct 2019 08:33:50 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Oct 2019 05:33:50 -0700 X-IronPort-AV: E=Sophos;i="5.64,571,1559545200"; d="scan'208";a="185168539" Received: from likexu-mobl1.ccr.corp.intel.com (HELO [10.249.172.165]) ([10.249.172.165]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/AES256-SHA; 01 Oct 2019 05:33:46 -0700 Subject: Re: [PATCH 3/3] KVM: x86/vPMU: Add lazy mechanism to release perf_event per vPMC To: Peter Zijlstra Cc: Paolo Bonzini , kvm@vger.kernel.org, rkrcmar@redhat.com, sean.j.christopherson@intel.com, vkuznets@redhat.com, Jim Mattson , Ingo Molnar , Arnaldo Carvalho de Melo , ak@linux.intel.com, wei.w.wang@intel.com, kan.liang@intel.com, like.xu@intel.com, ehankland@google.com, arbel.moshe@oracle.com, linux-kernel@vger.kernel.org References: <20190930072257.43352-1-like.xu@linux.intel.com> <20190930072257.43352-4-like.xu@linux.intel.com> <20191001082321.GL4519@hirez.programming.kicks-ass.net> From: Like Xu Organization: Intel OTC Message-ID: Date: Tue, 1 Oct 2019 20:33:45 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <20191001082321.GL4519@hirez.programming.kicks-ass.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Peter, On 2019/10/1 16:23, Peter Zijlstra wrote: > On Mon, Sep 30, 2019 at 03:22:57PM +0800, Like Xu wrote: >> + union { >> + u8 event_count :7; /* the total number of created perf_events */ >> + bool enable_cleanup :1; > > That's atrocious, don't ever create a bitfield with base _Bool. I saw this kind of usages in the tree such as "struct arm_smmu_master/tipc_mon_state/regmap_irq_chip". I'm not sure is this your personal preference or is there a technical reason such as this usage is not incompatible with union syntax? My design point is to save a little bit space without introducing two variables such as "int event_count & bool enable_cleanup". One of the alternatives is to introduce "u8 pmu_state", where the last seven bits are event_count for X86_PMC_IDX_MAX and the highest bit is the enable_cleanup bit. Are you OK with this ? By the way, is the lazy release mechanism looks reasonable to you? > >> + } state; >