From patchwork Tue Feb 9 14:39:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Rzeszutek Wilk X-Patchwork-Id: 8262401 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 587F59F38B for ; Tue, 9 Feb 2016 14:42:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 77B4420268 for ; Tue, 9 Feb 2016 14:42:15 +0000 (UTC) Received: from lists.xen.org (lists.xenproject.org [50.57.142.19]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8C96C20254 for ; Tue, 9 Feb 2016 14:42:14 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aT9S6-0001FV-4k; Tue, 09 Feb 2016 14:39:38 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aT9S4-0001FJ-Mn for xen-devel@lists.xenproject.org; Tue, 09 Feb 2016 14:39:36 +0000 Received: from [85.158.137.68] by server-3.bemta-3.messagelabs.com id 42/65-02499-72AF9B65; Tue, 09 Feb 2016 14:39:35 +0000 X-Env-Sender: konrad.wilk@oracle.com X-Msg-Ref: server-6.tower-31.messagelabs.com!1455028773!21279502!1 X-Originating-IP: [141.146.126.69] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTQxLjE0Ni4xMjYuNjkgPT4gMjc3MjE4\n X-StarScan-Received: X-StarScan-Version: 7.35.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 58447 invoked from network); 9 Feb 2016 14:39:34 -0000 Received: from aserp1040.oracle.com (HELO aserp1040.oracle.com) (141.146.126.69) by server-6.tower-31.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 9 Feb 2016 14:39:34 -0000 Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u19EdPok018779 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 9 Feb 2016 14:39:25 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0021.oracle.com (8.13.8/8.13.8) with ESMTP id u19EdOjF028254 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Tue, 9 Feb 2016 14:39:24 GMT Received: from abhmp0008.oracle.com (abhmp0008.oracle.com [141.146.116.14]) by userv0121.oracle.com (8.13.8/8.13.8) with ESMTP id u19EdNS8010593; Tue, 9 Feb 2016 14:39:23 GMT Received: from localhost.localdomain (/10.159.133.30) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 09 Feb 2016 06:39:22 -0800 Date: Tue, 9 Feb 2016 09:39:22 -0500 From: Konrad Rzeszutek Wilk To: Doug Goldstein Message-ID: <20160209143922.GC4537@localhost.localdomain> References: <1452808031-706-1-git-send-email-konrad.wilk@oracle.com> <1452808031-706-4-git-send-email-konrad.wilk@oracle.com> <56B6754C.2060909@cardoe.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <56B6754C.2060909@cardoe.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-Source-IP: aserv0021.oracle.com [141.146.126.233] Cc: wei.liu2@citrix.com, ian.campbell@citrix.com, andrew.cooper3@citrix.com, ian.jackson@eu.citrix.com, mpohlack@amazon.com, ross.lagerwall@citrix.com, stefano.stabellini@citrix.com, jbeulich@suse.com, sasha.levin@oracle.com, xen-devel@lists.xenproject.org Subject: Re: [Xen-devel] [PATCH v2 03/13] xen/xsplice: Hypervisor implementation of XEN_XSPLICE_op (v7) X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP > > +# Enable/Disable xsplice support > > +config XSPLICE > > + bool "xsplice support" > > + default y > > + depends on HAS_XSPLICE > > + ---help--- > > + Allows a running Xen hypervisor to be patched without rebooting. > > + This is primarily used to patch an hypervisor with XSA fixes. > > + > > + If unsure, say Y. > > + > > endmenu > > I'm indifferent on the HAS_XSPLICE, you can drop that if you want to > simply stuff. OK, let me remove it. Thanks! .. snip.. > > +#ifdef CONFIG_XSPLICE > > + case XEN_SYSCTL_xsplice_op: > > + ret = xsplice_control(&op->u.xsplice); > > + copyback = 1; > > + break; > > +#endif > > Should the case statement still exist and not just return -ENOSYS? > Otherwise we're needlessly going into arch_do_sysctl() just to get the > same result. There is some other code in that function, such as: 398 399 #ifdef TEST_COVERAGE 400 case XEN_SYSCTL_coverage_op: 401 ret = sysctl_coverage_op(&op->u.coverage_op); 402 break; 403 #endif Which follows that pattern. I figured I would the same thing as the rest of the code around it. It is not that neat .. But I could also make this a bit neater and have the header file return -ENOSYS, like this: Yeah, let me roll that in. Thanks! diff --git a/xen/common/sysctl.c b/xen/common/sysctl.c index b81b8cd..a8355c5 100644 --- a/xen/common/sysctl.c +++ b/xen/common/sysctl.c @@ -461,12 +461,11 @@ long do_sysctl(XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sysctl) ret = tmem_control(&op->u.tmem_op); break; -#ifdef CONFIG_XSPLICE case XEN_SYSCTL_xsplice_op: ret = xsplice_control(&op->u.xsplice); - copyback = 1; + if ( ret != -ENOSYS ) + copyback = 1; break; -#endif default: ret = arch_do_sysctl(op, u_sysctl); diff --git a/xen/include/xen/xsplice.h b/xen/include/xen/xsplice.h index 3c1b2e4..a0ae95e 100644 --- a/xen/include/xen/xsplice.h +++ b/xen/include/xen/xsplice.h @@ -23,15 +23,18 @@ struct xsplice_patch_func { uint8_t pad[24]; }; -int xsplice_control(struct xen_sysctl_xsplice_op *); - #ifdef CONFIG_XSPLICE +int xsplice_control(struct xen_sysctl_xsplice_op *); void do_xsplice(void); struct bug_frame *xsplice_find_bug(const char *eip, int *id); bool_t is_module(const void *addr); bool_t is_active_module_text(unsigned long addr); unsigned long search_module_extables(unsigned long addr); #else +static inline xsplice_control(struct xen_sysctl_xsplice_op *) +{ + return -ENOSYS; +} static inline void do_xsplice(void) { }; static inline struct bug_frame *xsplice_find_bug(const char *eip, int *id) {