Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp654720ybz; Wed, 15 Apr 2020 16:02:51 -0700 (PDT) X-Google-Smtp-Source: APiQypIBNhbToLur7qMFeUbuvgMoN/wlPUyG8Fk0rnTd91XEFU36T/TVxacbqIu3TGbsnETAYZvI X-Received: by 2002:a50:cc87:: with SMTP id q7mr26536150edi.96.1586991770981; Wed, 15 Apr 2020 16:02:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586991770; cv=none; d=google.com; s=arc-20160816; b=0ds7qoss+anQb0JC5AeHXqoeTpEHiiPlMdkNcGod7jscKLwZQGJFHKNCA6z44Ztvr5 rOznJrxUgEXf8iOvS89cbxyq6b+kjes6akZ/uvliPx3fzpGb3mi8ySMP6OZkAL3jT8xD f8vv9Lu2Wplra3JH4t3Q8S7jsPQIrcPbw2QVaideXrItHSt6Hj0FRmanK+12pAQ7q4ZS 6VxWYQhxaytS0Sy+d96KgWbBqX+KJ1Bbmwr4SxV22dfEo+qaVmNQmadZUGrdPn8yVE5v iSkoQBRIpQtgCY+7UwE8TRWmhuqOXjezXG1GZWHRxdg6vKyudTsrMLQAuVLOwwphiYO7 ZvRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-transfer-encoding :mime-version:organization:references:in-reply-to:subject:cc:to:from :date; bh=T/3G0KuhDoCQuXH9ZR7Sp80paF6qZVs3dIuWri3+ino=; b=yyZ9i5hsyq5v0+z8oGYvnwU2SDwaGQPd3+9dypTFa0+1GBm/ErrufmwUrWUDSq753b pg6nHzexuky2jAkd1M99o1LlPTINSw3jYKM75Wg7++Wy/C3XKIs0Zbkl71iBjXuYOdJg /bv3u+iBKaiwD1Y8Pq8n7J1e//L+T8kB+kic6gyDqrx5jYV7ysVoWCeDtLxsUs7RLz7/ D1KIOQEiAMLAVFc621bxXLJHA7o08C6EKbsbdwBNy01ZO+ppPDzdp9LGBFfxMa1nZ+sR sKLjnpOFr12zzZTHKbx1AVwRH9bb39pjPOUm05wPuZoKU8E8dVHUt4ak9V/RCXjhftWg bkyQ== 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=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i18si10830459ejx.488.2020.04.15.16.02.27; Wed, 15 Apr 2020 16:02:50 -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=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2897523AbgDOLng convert rfc822-to-8bit (ORCPT + 99 others); Wed, 15 Apr 2020 07:43:36 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:17146 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2408908AbgDOLht (ORCPT ); Wed, 15 Apr 2020 07:37:49 -0400 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 03FBXhH1124539 for ; Wed, 15 Apr 2020 07:37:32 -0400 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 30dse2n9xx-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 15 Apr 2020 07:37:32 -0400 Received: from localhost by e06smtp02.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 15 Apr 2020 12:37:02 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp02.uk.ibm.com (192.168.101.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 15 Apr 2020 12:36:56 +0100 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 03FBbMGa54264042 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 15 Apr 2020 11:37:22 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 25EB911C054; Wed, 15 Apr 2020 11:37:22 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 29D7C11C04C; Wed, 15 Apr 2020 11:37:21 +0000 (GMT) Received: from p-imbrenda (unknown [9.145.12.13]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 15 Apr 2020 11:37:21 +0000 (GMT) Date: Wed, 15 Apr 2020 13:37:18 +0200 From: Claudio Imbrenda To: Emanuele Giuseppe Esposito Cc: Philippe =?UTF-8?B?TWF0aGlldS1EYXVkw6k=?= , kvm@vger.kernel.org, Marc Zyngier , James Morse , Julien Thierry , Suzuki K Poulose , Paul Mackerras , Christian Borntraeger , Janosch Frank , David Hildenbrand , Cornelia Huck , Paolo Bonzini , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, kvm-ppc@vger.kernel.org, linux-s390@vger.kernel.org Subject: Re: [PATCH v2] kvm_host: unify VM_STAT and VCPU_STAT definitions in a single place In-Reply-To: <992ede27-3eae-f2da-ad38-1d3498853ad2@redhat.com> References: <20200414155625.20559-1-eesposit@redhat.com> <992ede27-3eae-f2da-ad38-1d3498853ad2@redhat.com> Organization: IBM X-Mailer: Claws Mail 3.17.5 (GTK+ 2.24.32; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT X-TM-AS-GCONF: 00 x-cbid: 20041511-0008-0000-0000-00000371193C X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 20041511-0009-0000-0000-00004A92CCDF Message-Id: <20200415133718.2db57666@p-imbrenda> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.676 definitions=2020-04-15_02:2020-04-14,2020-04-15 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 clxscore=1015 priorityscore=1501 impostorscore=0 mlxscore=0 malwarescore=0 suspectscore=0 lowpriorityscore=0 phishscore=0 spamscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2004150084 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 15 Apr 2020 10:30:06 +0200 Emanuele Giuseppe Esposito wrote: > On 4/15/20 8:36 AM, Philippe Mathieu-Daudé wrote: > > On 4/14/20 5:56 PM, Emanuele Giuseppe Esposito wrote: > >> The macros VM_STAT and VCPU_STAT are redundantly implemented in > >> multiple files, each used by a different architecure to initialize > >> the debugfs entries for statistics. Since they all have the same > >> purpose, they can be unified in a single common definition in > >> include/linux/kvm_host.h > >> > >> Signed-off-by: Emanuele Giuseppe Esposito > >> --- > >> arch/arm64/kvm/guest.c | 23 ++--- > >> arch/mips/kvm/mips.c | 61 ++++++------ > >> arch/powerpc/kvm/book3s.c | 61 ++++++------ > >> arch/powerpc/kvm/booke.c | 41 ++++---- > >> arch/s390/kvm/kvm-s390.c | 203 > >> +++++++++++++++++++------------------- arch/x86/kvm/x86.c | > >> 80 +++++++-------- include/linux/kvm_host.h | 5 + > >> 7 files changed, 231 insertions(+), 243 deletions(-) > >> > >> diff --git a/arch/arm64/kvm/guest.c b/arch/arm64/kvm/guest.c > >> index 23ebe51410f0..8417b200bec9 100644 > >> --- a/arch/arm64/kvm/guest.c > >> +++ b/arch/arm64/kvm/guest.c > >> @@ -29,20 +29,17 @@ > >> > >> #include "trace.h" > >> > >> -#define VM_STAT(x) { #x, offsetof(struct kvm, stat.x), > >> KVM_STAT_VM } -#define VCPU_STAT(x) { #x, offsetof(struct > >> kvm_vcpu, stat.x), KVM_STAT_VCPU } - > >> struct kvm_stats_debugfs_item debugfs_entries[] = { > >> - VCPU_STAT(halt_successful_poll), > >> - VCPU_STAT(halt_attempted_poll), > >> - VCPU_STAT(halt_poll_invalid), > >> - VCPU_STAT(halt_wakeup), > >> - VCPU_STAT(hvc_exit_stat), > >> - VCPU_STAT(wfe_exit_stat), > >> - VCPU_STAT(wfi_exit_stat), > >> - VCPU_STAT(mmio_exit_user), > >> - VCPU_STAT(mmio_exit_kernel), > >> - VCPU_STAT(exits), > >> + VCPU_STAT("halt_successful_poll", halt_successful_poll), > >> + VCPU_STAT("halt_attempted_poll", halt_attempted_poll), > >> + VCPU_STAT("halt_poll_invalid", halt_poll_invalid), > >> + VCPU_STAT("halt_wakeup", halt_wakeup), > >> + VCPU_STAT("hvc_exit_stat", hvc_exit_stat), > >> + VCPU_STAT("wfe_exit_stat", wfe_exit_stat), > >> + VCPU_STAT("wfi_exit_stat", wfi_exit_stat), > >> + VCPU_STAT("mmio_exit_user", mmio_exit_user), > >> + VCPU_STAT("mmio_exit_kernel", mmio_exit_kernel), > >> + VCPU_STAT("exits", exits), > >> { NULL } > >> }; > > > > Patch easily reviewed with --word-diff. > > > > [...] > >> diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h > >> index 6d58beb65454..2e6ead872957 100644 > >> --- a/include/linux/kvm_host.h > >> +++ b/include/linux/kvm_host.h > >> @@ -1130,6 +1130,11 @@ struct kvm_stats_debugfs_item { > >> #define KVM_DBGFS_GET_MODE(dbgfs_item) > >> \ ((dbgfs_item)->mode ? (dbgfs_item)->mode : 0644) > >> > >> +#define VM_STAT(n, x, ...) > >> \ > >> + { n, offsetof(struct kvm, stat.x), KVM_STAT_VM, ## > >> __VA_ARGS__ } +#define VCPU_STAT(n, x, ...) > >> \ > >> > > > > Not sure while you use so many whitespaces here... (maybe Paolo can > > strip some when applying?). > > I honestly am not sure why it added few more spaces than I wanted, > but the idea was to follow the KVM_DBGFS_GET_MODE macro above and put > the backslash at the end of the line (80th char). once the whitespace issues are fixed, you can also add Reviewed-by: Claudio Imbrenda > > > > Otherwise it looks nicer that v1, thanks. > > > > Reviewed-by: Philippe Mathieu-Daudé > > > >> + { n, offsetof(struct kvm_vcpu, stat.x), KVM_STAT_VCPU, ## > >> __VA_ARGS__ } + > >> extern struct kvm_stats_debugfs_item debugfs_entries[]; > >> extern struct dentry *kvm_debugfs_dir; > >> > >> > > >