diff mbox

[v1,4/7] livepatch: Set timeout unit to nanoseconds

Message ID 1481559490-13844-5-git-send-email-ross.lagerwall@citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ross Lagerwall Dec. 12, 2016, 4:18 p.m. UTC
The hypervisor already expects the timeout from the hypercall to be in
nanoseconds, so set this expectation everywhere.

Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
---
 tools/libxc/include/xenctrl.h | 2 +-
 xen/common/livepatch.c        | 4 ++--
 xen/include/public/sysctl.h   | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

Comments

Wei Liu Dec. 12, 2016, 5:02 p.m. UTC | #1
On Mon, Dec 12, 2016 at 04:18:07PM +0000, Ross Lagerwall wrote:
> The hypervisor already expects the timeout from the hypercall to be in
> nanoseconds, so set this expectation everywhere.
> 
> Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
> ---
>  tools/libxc/include/xenctrl.h | 2 +-
>  xen/common/livepatch.c        | 4 ++--
>  xen/include/public/sysctl.h   | 2 +-
>  3 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h
> index 2c83544..4ab0f57 100644
> --- a/tools/libxc/include/xenctrl.h
> +++ b/tools/libxc/include/xenctrl.h
> @@ -2703,7 +2703,7 @@ int xc_livepatch_list(xc_interface *xch, unsigned int max, unsigned int start,
>   * The operations are asynchronous and the hypervisor may take a while
>   * to complete them. The `timeout` offers an option to expire the
>   * operation if it could not be completed within the specified time
> - * (in ms). Value of 0 means let hypervisor decide the best timeout.
> + * (in ns). Value of 0 means let hypervisor decide the best timeout.

Acked-by: Wei Liu <wei.liu2@citrix.com>

>   */
>  int xc_livepatch_apply(xc_interface *xch, char *name, uint32_t timeout);
>  int xc_livepatch_revert(xc_interface *xch, char *name, uint32_t timeout);
> diff --git a/xen/common/livepatch.c b/xen/common/livepatch.c
> index fc8ef99..246e673 100644
> --- a/xen/common/livepatch.c
> +++ b/xen/common/livepatch.c
> @@ -1227,8 +1227,8 @@ static int schedule_work(struct payload *data, uint32_t cmd, uint32_t timeout)
>      livepatch_work.data = data;
>      livepatch_work.timeout = timeout ?: MILLISECS(30);
>  
> -    dprintk(XENLOG_DEBUG, LIVEPATCH "%s: timeout is %"PRI_stime"ms\n",
> -            data->name, livepatch_work.timeout / MILLISECS(1));
> +    dprintk(XENLOG_DEBUG, LIVEPATCH "%s: timeout is %"PRIu32"ns\n",
> +            data->name, livepatch_work.timeout);
>  
>      atomic_set(&livepatch_work.semaphore, -1);
>  
> diff --git a/xen/include/public/sysctl.h b/xen/include/public/sysctl.h
> index 28ac56c..3c67858 100644
> --- a/xen/include/public/sysctl.h
> +++ b/xen/include/public/sysctl.h
> @@ -1068,7 +1068,7 @@ struct xen_sysctl_livepatch_action {
>  #define LIVEPATCH_ACTION_REPLACE      4
>      uint32_t cmd;                           /* IN: LIVEPATCH_ACTION_*. */
>      uint32_t timeout;                       /* IN: Zero if no timeout. */
> -                                            /* Or upper bound of time (ms) */
> +                                            /* Or upper bound of time (ns) */

Is this only fixing a typo or does it constitute a change in behaviour?
The latter would result in bumping the sysctl number. But from the look
of the patch I think it is doing the former.

>                                              /* for operation to take. */
>  };
>  typedef struct xen_sysctl_livepatch_action xen_sysctl_livepatch_action_t;
> -- 
> 2.7.4
>
Konrad Rzeszutek Wilk Dec. 12, 2016, 5:13 p.m. UTC | #2
On Mon, Dec 12, 2016 at 05:02:59PM +0000, Wei Liu wrote:
> On Mon, Dec 12, 2016 at 04:18:07PM +0000, Ross Lagerwall wrote:
> > The hypervisor already expects the timeout from the hypercall to be in
> > nanoseconds, so set this expectation everywhere.
> > 
> > Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
> > ---
> >  tools/libxc/include/xenctrl.h | 2 +-
> >  xen/common/livepatch.c        | 4 ++--
> >  xen/include/public/sysctl.h   | 2 +-
> >  3 files changed, 4 insertions(+), 4 deletions(-)
> > 
> > diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h
> > index 2c83544..4ab0f57 100644
> > --- a/tools/libxc/include/xenctrl.h
> > +++ b/tools/libxc/include/xenctrl.h
> > @@ -2703,7 +2703,7 @@ int xc_livepatch_list(xc_interface *xch, unsigned int max, unsigned int start,
> >   * The operations are asynchronous and the hypervisor may take a while
> >   * to complete them. The `timeout` offers an option to expire the
> >   * operation if it could not be completed within the specified time
> > - * (in ms). Value of 0 means let hypervisor decide the best timeout.
> > + * (in ns). Value of 0 means let hypervisor decide the best timeout.
> 
> Acked-by: Wei Liu <wei.liu2@citrix.com>
> 
> >   */
> >  int xc_livepatch_apply(xc_interface *xch, char *name, uint32_t timeout);
> >  int xc_livepatch_revert(xc_interface *xch, char *name, uint32_t timeout);
> > diff --git a/xen/common/livepatch.c b/xen/common/livepatch.c
> > index fc8ef99..246e673 100644
> > --- a/xen/common/livepatch.c
> > +++ b/xen/common/livepatch.c
> > @@ -1227,8 +1227,8 @@ static int schedule_work(struct payload *data, uint32_t cmd, uint32_t timeout)
> >      livepatch_work.data = data;
> >      livepatch_work.timeout = timeout ?: MILLISECS(30);
> >  
> > -    dprintk(XENLOG_DEBUG, LIVEPATCH "%s: timeout is %"PRI_stime"ms\n",
> > -            data->name, livepatch_work.timeout / MILLISECS(1));
> > +    dprintk(XENLOG_DEBUG, LIVEPATCH "%s: timeout is %"PRIu32"ns\n",
> > +            data->name, livepatch_work.timeout);
> >  
> >      atomic_set(&livepatch_work.semaphore, -1);
> >  
> > diff --git a/xen/include/public/sysctl.h b/xen/include/public/sysctl.h
> > index 28ac56c..3c67858 100644
> > --- a/xen/include/public/sysctl.h
> > +++ b/xen/include/public/sysctl.h
> > @@ -1068,7 +1068,7 @@ struct xen_sysctl_livepatch_action {
> >  #define LIVEPATCH_ACTION_REPLACE      4
> >      uint32_t cmd;                           /* IN: LIVEPATCH_ACTION_*. */
> >      uint32_t timeout;                       /* IN: Zero if no timeout. */
> > -                                            /* Or upper bound of time (ms) */
> > +                                            /* Or upper bound of time (ns) */
> 
> Is this only fixing a typo or does it constitute a change in behaviour?

Type (and it should also be changed in the docs/misc/livepatch.markdown)

> The latter would result in bumping the sysctl number. But from the look
> of the patch I think it is doing the former.
> 
> >                                              /* for operation to take. */
> >  };
> >  typedef struct xen_sysctl_livepatch_action xen_sysctl_livepatch_action_t;
> > -- 
> > 2.7.4
> >
diff mbox

Patch

diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h
index 2c83544..4ab0f57 100644
--- a/tools/libxc/include/xenctrl.h
+++ b/tools/libxc/include/xenctrl.h
@@ -2703,7 +2703,7 @@  int xc_livepatch_list(xc_interface *xch, unsigned int max, unsigned int start,
  * The operations are asynchronous and the hypervisor may take a while
  * to complete them. The `timeout` offers an option to expire the
  * operation if it could not be completed within the specified time
- * (in ms). Value of 0 means let hypervisor decide the best timeout.
+ * (in ns). Value of 0 means let hypervisor decide the best timeout.
  */
 int xc_livepatch_apply(xc_interface *xch, char *name, uint32_t timeout);
 int xc_livepatch_revert(xc_interface *xch, char *name, uint32_t timeout);
diff --git a/xen/common/livepatch.c b/xen/common/livepatch.c
index fc8ef99..246e673 100644
--- a/xen/common/livepatch.c
+++ b/xen/common/livepatch.c
@@ -1227,8 +1227,8 @@  static int schedule_work(struct payload *data, uint32_t cmd, uint32_t timeout)
     livepatch_work.data = data;
     livepatch_work.timeout = timeout ?: MILLISECS(30);
 
-    dprintk(XENLOG_DEBUG, LIVEPATCH "%s: timeout is %"PRI_stime"ms\n",
-            data->name, livepatch_work.timeout / MILLISECS(1));
+    dprintk(XENLOG_DEBUG, LIVEPATCH "%s: timeout is %"PRIu32"ns\n",
+            data->name, livepatch_work.timeout);
 
     atomic_set(&livepatch_work.semaphore, -1);
 
diff --git a/xen/include/public/sysctl.h b/xen/include/public/sysctl.h
index 28ac56c..3c67858 100644
--- a/xen/include/public/sysctl.h
+++ b/xen/include/public/sysctl.h
@@ -1068,7 +1068,7 @@  struct xen_sysctl_livepatch_action {
 #define LIVEPATCH_ACTION_REPLACE      4
     uint32_t cmd;                           /* IN: LIVEPATCH_ACTION_*. */
     uint32_t timeout;                       /* IN: Zero if no timeout. */
-                                            /* Or upper bound of time (ms) */
+                                            /* Or upper bound of time (ns) */
                                             /* for operation to take. */
 };
 typedef struct xen_sysctl_livepatch_action xen_sysctl_livepatch_action_t;