From patchwork Fri Oct 13 10:36:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Razvan Cojocaru X-Patchwork-Id: 10004067 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 119F260216 for ; Fri, 13 Oct 2017 10:39:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 00EDC29023 for ; Fri, 13 Oct 2017 10:39:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E815329027; Fri, 13 Oct 2017 10:39:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 759E129023 for ; Fri, 13 Oct 2017 10:39:10 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e2xKv-00083O-AW; Fri, 13 Oct 2017 10:37:01 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e2xKu-00082r-7J for xen-devel@lists.xen.org; Fri, 13 Oct 2017 10:37:00 +0000 Received: from [85.158.139.211] by server-11.bemta-5.messagelabs.com id 47/72-32680-B4790E95; Fri, 13 Oct 2017 10:36:59 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupileJIrShJLcpLzFFi42KJPp6xUNd7+oN Ig40bGC2WfFzM4sDocXT3b6YAxijWzLyk/IoE1ox9FyYwFzzjqFhz+gFLA2M/excjJ4eQgIfE lu0nmCHstYwSVzerQNjXGCX63+bC1HRcO8/axcgFZM9mlPi9bBILSEJYwEji0aIjjCC2iECAx JqpZ5lBipgFbjBKNDasZ4TorpI4/3ETK4jNJmAosXpjCxuIzSvgJHG//y+QzcHBIqAq8WlCLE hYVCBc4k7rOxaIEkGJkzOfgNmcAvYSzRO/gI1hFjCTmLf5ITOELS5x68l8JghbXmL72zlgcQm BHIm5D/Yyg4yXEJCS+N+qBHKahEADi8SXVydYIWpkJB5NvMk2gVFsFpJ1s5CsmIVkxSwkKxYw sqxi1ChOLSpLLdI1NNZLKspMzyjJTczM0TU0MNXLTS0uTkxPzUlMKtZLzs/dxAiMIwYg2MH4b 5vnIUZJDiYlUV61yAeRQnxJ+SmVGYnFGfFFpTmpxYcYZTg4lCR4PaYB5QSLUtNTK9Iyc4ARDZ OW4OBREuGtAUnzFhck5hZnpkOkTjEqSonz+oAkBEASGaV5cG2wJHKJUVZKmJcR6BAhnoLUotz MElT5V4ziHIxKwryBIFN4MvNK4Ka/AlrMBLT4XQTY4pJEhJRUA6PAtdg49yyBuOBdK462fS+b Ytjque+5Cncmp+xOJUF3Xd6q3nlH1yZZXdzM9uSNy7fzFzK5jB/d3d29vnNhQm7ywgXv8jvl3 dlnOjn7XhCZdu+6uWgNd8HS14durAirMw2csuy6l8oaeWkvef7AU8zWZo+Fiu40PT52erPUuY 3yribXps1V81RiKc5INNRiLipOBAAlYQhLHQMAAA== X-Env-Sender: rcojocaru@bitdefender.com X-Msg-Ref: server-6.tower-206.messagelabs.com!1507891018!103982434!1 X-Originating-IP: [91.199.104.161] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 3602 invoked from network); 13 Oct 2017 10:36:58 -0000 Received: from mx01.bbu.dsd.mx.bitdefender.com (HELO mx01.bbu.dsd.mx.bitdefender.com) (91.199.104.161) by server-6.tower-206.messagelabs.com with DHE-RSA-AES128-GCM-SHA256 encrypted SMTP; 13 Oct 2017 10:36:58 -0000 Received: (qmail 12959 invoked from network); 13 Oct 2017 13:36:57 +0300 Received: from unknown (HELO mx-sr.buh.bitdefender.com) (10.17.80.103) by mx01.bbu.dsd.mx.bitdefender.com with AES256-GCM-SHA384 encrypted SMTP; 13 Oct 2017 13:36:57 +0300 Received: from smtp01.buh.bitdefender.com (smtp.bitdefender.biz [10.17.80.75]) by mx-sr.buh.bitdefender.com (Postfix) with ESMTP id 934F97FC77 for ; Fri, 13 Oct 2017 13:36:57 +0300 (EEST) Received: (qmail 22920 invoked from network); 13 Oct 2017 13:36:57 +0300 Received: from unknown (HELO ?10.10.14.109?) (rcojocaru@bitdefender.com@195.210.4.22) by smtp01.buh.bitdefender.com with SMTP; 13 Oct 2017 13:36:57 +0300 To: Jan Beulich , Alexandru Isaila References: <1507799425-3286-1-git-send-email-aisaila@bitdefender.com> <59E0B1A7020000780018617F@prv-mh.provo.novell.com> From: Razvan Cojocaru Message-ID: <8b37f5e5-c594-ba25-2e43-8538c716eaf3@bitdefender.com> Date: Fri, 13 Oct 2017 13:36:56 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <59E0B1A7020000780018617F@prv-mh.provo.novell.com> Content-Language: en-US X-BitDefender-Scanner: Clean, Agent: BitDefender qmail 3.1.6 on smtp01.buh.bitdefender.com, sigver: 7.73444 X-BitDefender-Spam: No (0) X-BitDefender-SpamStamp: Build: [Engines: 2.15.8.1074, Dats: 463656, Stamp: 3], Multi: [Enabled, t: (0.000011, 0.007304)], BW: [Enabled, t: (0.000011)], RBL DNSBL: [Disabled], APM: [Enabled, Score: 500, t: (0.003405), Flags: 85D2ED72; NN_LEGIT_VALID_REPLY; NN_NO_LINK_NMD; NN_LEGIT_BITDEFENDER; NN_LEGIT_S_SQARE_BRACKETS], SGN: [Enabled, t: (0.015656,0.000078)], URL: [Enabled, t: (0.000006,0.000001)], RTDA: [Enabled, t: (0.277194), Hit: No, Details: v2.6.12; Id: 15.5f4gom.1bs2u4i64.3dvt0], total: 0(775) X-BitDefender-CF-Stamp: none Cc: tim@xen.org, sstabellini@kernel.org, wei.liu2@citrix.com, konrad.wilk@oracle.com, George.Dunlap@eu.citrix.com, andrew.cooper3@citrix.com, ian.jackson@eu.citrix.com, xen-devel@lists.xen.org, tamas@tklengyel.com Subject: Re: [Xen-devel] [PATCH v1] x86/hvm: Add MSR old value X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP On 13.10.2017 13:29, Jan Beulich wrote: >> + __set_bit(index + sizeof(struct monitor_msr_bitmap), bitmap); > > I think you miss "* 8" here - a bit position plus sizeof() doesn't > produce any useful value. > > But what's worse - having read till the end of the patch I don't > see you change any allocation, yet you clearly need to double > the space now that you need two bits per MSR. We did this: return -ENOMEM; @@ -67,7 +67,7 @@ static unsigned long *monitor_bitmap_for_msr(const struct domain *d, u32 *msr) } } I.e., we are now allocating an array of size 2 of struct monitor_msr_bitmaps with xzalloc_array(). Thanks, Razvan diff --git a/xen/arch/x86/monitor.c b/xen/arch/x86/monitor.c index e59f1f5..a3046c6 100644 --- a/xen/arch/x86/monitor.c +++ b/xen/arch/x86/monitor.c @@ -25,7 +25,7 @@ int arch_monitor_init_domain(struct domain *d) { if ( !d->arch.monitor.msr_bitmap ) - d->arch.monitor.msr_bitmap = xzalloc(struct monitor_msr_bitmap); + d->arch.monitor.msr_bitmap = xzalloc_array(struct monitor_msr_bitmap, 2); if ( !d->arch.monitor.msr_bitmap )