From patchwork Thu Nov 10 16:21:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Razvan Cojocaru X-Patchwork-Id: 9421421 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 4A725601C0 for ; Thu, 10 Nov 2016 16:23:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 34F9D2960A for ; Thu, 10 Nov 2016 16:23:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 29AAB2967D; Thu, 10 Nov 2016 16:23:21 +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 6016F2960A for ; Thu, 10 Nov 2016 16:23:18 +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 1c4s64-0001Wd-10; Thu, 10 Nov 2016 16:21:04 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c4s62-0001WR-UO for xen-devel@lists.xen.org; Thu, 10 Nov 2016 16:21:03 +0000 Received: from [85.158.139.211] by server-5.bemta-5.messagelabs.com id 2E/60-02084-E6E94285; Thu, 10 Nov 2016 16:21:02 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrEIsWRWlGSWpSXmKPExsUSfTxjoW72PJU Ig42P1SyWfFzM4sDocXT3b6YAxijWzLyk/IoE1oypOw6yFbQIVlxsP8LUwLiQt4uRk0NIwEPi 4rv9LF2MXED2WkaJcxcvskM4VxklvrZ0ATkcYFW7+zkhGhYxSqx+rgliCwvESbzd+4AVpEREQ FOi7acaRGsvk8S6GTuYQRxmgfNMEq9OnmMDaWATMJRYvbEFzOYVcJK4+O0ZI0gzi4CqxPxFVS BhUYFwifezFkKVCEqcnPmEBcTmFAiUONdzgxXEZhZQl/gz7xIzhC0vsf3tHDBbQiBH4uuKS2w gIyUEpCT+tyqBnCAh0M0icfTYXTaIGhmJRxNvsk1gFJ2FZMUsJGNnIRm7gJF5FaNGcWpRWWqR rpGxXlJRZnpGSW5iZo6uoYGpXm5qcXFiempOYlKxXnJ+7iZGYFzUMzAw7mDc0e53iFGSg0lJl FdxukqEEF9SfkplRmJxRnxRaU5q8SFGGQ4OJQneP3OAcoJFqempFWmZOcAIhUlLcPAoifByzw VK8xYXJOYWZ6ZDpE4xKkqJ89qBJARAEhmleXBtsKRwiVFWSpiXkYGBQYinILUoN7MEVf4Vozg Ho5Iw73OQ7TyZeSVw018BLWYCWjwjDmxxSSJCSqqB0fTUuZ/+JxbUdhV9mlldf/jLzPTYQwoZ NnsXbTsa2rPlue+MsPNC13iuiPqavl1S6OyUxtph9Vdyj6/xrzP3VjXvndL+Ys6/J3/nRIoJS S/ufXjz3JHpbTpCjmnN3Ipe+10PvHhfre7/pLYjteTqL9e9Ood7bj5oMSm32P0tq5z/pLKVLM u6r0osxRmJhlrMRcWJACthtEYFAwAA X-Env-Sender: rcojocaru@bitdefender.com X-Msg-Ref: server-15.tower-206.messagelabs.com!1478794858!55890007!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.0.13; banners=-,-,- X-VirusChecked: Checked Received: (qmail 58585 invoked from network); 10 Nov 2016 16:20:59 -0000 Received: from mx01.bbu.dsd.mx.bitdefender.com (HELO mx01.bbu.dsd.mx.bitdefender.com) (91.199.104.161) by server-15.tower-206.messagelabs.com with DHE-RSA-AES128-GCM-SHA256 encrypted SMTP; 10 Nov 2016 16:20:59 -0000 Received: (qmail 17505 invoked from network); 10 Nov 2016 18:20:58 +0200 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; 10 Nov 2016 18:20:58 +0200 Received: from smtp01.buh.bitdefender.com (smtp.bitdefender.biz [10.17.80.75]) by mx-sr.buh.bitdefender.com (Postfix) with ESMTP id 3C5147FC05 for ; Thu, 10 Nov 2016 18:20:58 +0200 (EET) Received: (qmail 12449 invoked from network); 10 Nov 2016 18:20:58 +0200 Received: from rcojocaru.dsd.ro (HELO ?10.10.14.59?) (rcojocaru@bitdefender.com@10.10.14.59) by smtp01.buh.bitdefender.com with SMTP; 10 Nov 2016 18:20:58 +0200 To: Tamas K Lengyel References: <1478766941-14003-1-git-send-email-rcojocaru@bitdefender.com> From: Razvan Cojocaru Message-ID: <76d74d63-7340-3e8e-db75-dcae38c5b62d@bitdefender.com> Date: Thu, 10 Nov 2016 18:21:22 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: X-BitDefender-Scanner: Clean, Agent: BitDefender qmail 3.1.6 on smtp01.buh.bitdefender.com, sigver: 7.67952 X-BitDefender-Spam: No (0) X-BitDefender-SpamStamp: Build: [Engines: 2.15.6.911, Dats: 434759, Stamp: 3], Multi: [Enabled, t: (0.000011, 0.004638)], BW: [Enabled, t: (0.000021,0.000001)], RBL DNSBL: [Disabled], APM: [Enabled, Score: 500, t: (0.004732), Flags: 85D2ED72; NN_FORGED_THUNDERBIRD_2; NN_LEGIT_VALID_REPLY; NN_NO_LINK_NMD; NN_LEGIT_BITDEFENDER; NN_LEGIT_S_SQARE_BRACKETS], SGN: [Enabled, t: (0.008488)], URL: [Enabled, t: (0.000006)], RTDA: [Enabled, t: (0.014836), Hit: No, Details: v2.4.0; Id: 2m1ghm1.1b14peqih.roi6], total: 0(775) X-BitDefender-CF-Stamp: none Cc: Kevin Tian , Stefano Stabellini , Jan Beulich , Jun Nakajima , Andrew Cooper , Xen-devel , Julien Grall , suravee.suthikulpanit@amd.com, boris.ostrovsky@oracle.com Subject: Re: [Xen-devel] [PATCH V2] x86/vm_event: Added support for VM_EVENT_REASON_INTERRUPT 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 11/10/2016 06:01 PM, Tamas K Lengyel wrote: > > > On Thu, Nov 10, 2016 at 6:33 AM, Razvan Cojocaru > > wrote: > > Hello Tamas, thanks for the review! > > On 11/10/2016 03:11 PM, Tamas K Lengyel wrote: > > diff --git a/xen/include/asm-x86/vm_event.h > > b/xen/include/asm-x86/vm_event.h > > index ca73f99..38c624c 100644 > > --- a/xen/include/asm-x86/vm_event.h > > +++ b/xen/include/asm-x86/vm_event.h > > @@ -27,6 +27,7 @@ > > */ > > struct arch_vm_event { > > uint32_t emulate_flags; > > + bool monitor_next_interrupt; > > > > > > This should be in domain.h with the rest of the monitor control bits (as > > the name of the variable suggests as well). > > Unfortunately that would alter the semantics of the patch, as this > variable needs to be per-VCPU. Putting it in domain.h as you suggest > would make it per-domain. Looking at places to put it so that it would > serve this purpose, struct arch_vm_event felt like the most natural > place. > > > I see. I generally like to keep vm_event/monitor bits separate as to not > end up in the spaghetti we were in a couple years ago. Maybe introducing > a struct arch_monitor would be appropriate? I've actually done this, to reflect the per-domain monitor bitfield: This is now accesible via v->arch.monitor.next_interrupt_enabled and does indeed feel much cleaner (plus it removes the need for an ASSERT() or if() that Jan has previously commented on). This will be extensible in the future for whatever per-VCPU events we may want to add. Is this OK? Thanks, Razvan diff --git a/xen/include/asm-x86/domain.h b/xen/include/asm-x86/domain.h index f6a40eb..faa7037 100644 --- a/xen/include/asm-x86/domain.h +++ b/xen/include/asm-x86/domain.h @@ -576,6 +576,10 @@ struct arch_vcpu XEN_GUEST_HANDLE(vcpu_time_info_t) time_info_guest; struct arch_vm_event *vm_event; + + struct { + unsigned int next_interrupt_enabled : 1; + } monitor; }; smap_check_policy_t smap_policy_change(struct vcpu *v,