All of lore.kernel.org
 help / color / mirror / Atom feed
* xl mem-max error
@ 2014-11-06 22:17 Zhigang Wang
  2014-11-07 11:05 ` Wei Liu
  0 siblings, 1 reply; 19+ messages in thread
From: Zhigang Wang @ 2014-11-06 22:17 UTC (permalink / raw)
  To: xen-devel

Hi,

I get this error:

    # xl mem-max 3 700
    libxl: error: libxl.c:4549:libxl_domain_setmaxmem: memory_static_max must be greater than or or equal to memory_dynamic_max
    : Success
    cannot set domid 3 static max memory to : 700

    # xenstore-ls -f
    ...
    /local/domain/3/memory = ""
    /local/domain/3/memory/static-max = "716800"
    /local/domain/3/memory/target = "716801"
    /local/domain/3/memory/videoram = "-1"

    # xl list -l 3
    [
        {
            "domid": 3,
            "config": {
                "c_info": {
                    "type": "pv",
                    "name": "0004fb0000060000834f0ecf044b2219",
                    "uuid": "0004fb00-0006-0000-834f-0ecf044b2219",
                    "run_hotplug_scripts": "True"
                },
                "b_info": {
                    "max_vcpus": 32,
                    "avail_vcpus": [
                        0,
                        1
                    ],
                    "max_memkb": 716800,
                    "target_memkb": 716800,
                    "shadow_memkb": 38368,
                    "sched_params": {
                        "weight": 55000
                    },
                    "claim_mode": "True",
                    "type.pv": {
                        "bootloader": "/usr/bin/pygrub"
                    }
                },
                "disks": [
                    {
                        "pdev_path": "/OVS/Repositories/0004fb0000030000abbd129258377a77/VirtualDisks/OVM_OL6U4_X86_64_PVM_2GB_UEK3_System.img",
                        "vdev": "xvda",
                        "format": "raw",
                        "readwrite": 1
                    }
                ],
                "nics": [
                    {
                        "devid": 0,
                        "mac": "00:21:f6:00:08:aa",
                        "bridge": "10f36ca5ec"
                    }
                ],
                "vfbs": [
                    {
                        "devid": 0,
                        "vnc": {
                            "listen": "127.0.0.1",
                            "findunused": "True"
                        },
                        "sdl": {
    
                        },
                        "keymap": "en-us"
                    }
                ],
                "vkbs": [
                    {
                        "devid": 0
                    }
                ],
                "on_reboot": "restart",
                "on_crash": "restart"
            }
        }
    ]

Another HVM guest::

    # xenstore-ls -f
    ...
    /local/domain/2/memory/static-max = "716800"
    /local/domain/2/memory/target = "708608"
    /local/domain/2/memory/videoram = "8192"

Testing on:

    commit 816f5bb1f0740be8355e1be6cc24edf09547d984
    Author: Ian Campbell <ian.campbell@citrix.com>
    Date:   Fri Oct 24 10:58:33 2014 +0100

It seems target_mem always bigger than max_mem. Looks wrong.

Thanks,

Zhigang

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: xl mem-max error
  2014-11-06 22:17 xl mem-max error Zhigang Wang
@ 2014-11-07 11:05 ` Wei Liu
  2014-11-07 14:21   ` Zhigang Wang
  0 siblings, 1 reply; 19+ messages in thread
From: Wei Liu @ 2014-11-07 11:05 UTC (permalink / raw)
  To: Zhigang Wang; +Cc: xen-devel, wei.liu2

On Thu, Nov 06, 2014 at 05:17:42PM -0500, Zhigang Wang wrote:
> Hi,
> 
> I get this error:
> 
>     # xl mem-max 3 700
>     libxl: error: libxl.c:4549:libxl_domain_setmaxmem: memory_static_max must be greater than or or equal to memory_dynamic_max
>     : Success
>     cannot set domid 3 static max memory to : 700
> 

What's your expected behaviour? What's your end goal?

Can the behavior you expected be achieved by manipulating target memory
instead of maxmem?

ISTR Oracle has different view on how memory targets are managed. But
with no other information provided it's hard for me to figure out your
intent and start a conversation.

Wei.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: xl mem-max error
  2014-11-07 11:05 ` Wei Liu
@ 2014-11-07 14:21   ` Zhigang Wang
  2014-11-10 12:37     ` Wei Liu
  0 siblings, 1 reply; 19+ messages in thread
From: Zhigang Wang @ 2014-11-07 14:21 UTC (permalink / raw)
  To: Wei Liu; +Cc: xen-devel

On 11/07/2014 06:05 AM, Wei Liu wrote:
> On Thu, Nov 06, 2014 at 05:17:42PM -0500, Zhigang Wang wrote:
>> Hi,
>>
>> I get this error:
>>
>>     # xl mem-max 3 700
>>     libxl: error: libxl.c:4549:libxl_domain_setmaxmem: memory_static_max must be greater than or or equal to memory_dynamic_max
>>     : Success
>>     cannot set domid 3 static max memory to : 700
>>
> 
> What's your expected behaviour? What's your end goal?

I expect: after start a VM with memory = 700, then I can do:

   # xl mem-max <domain> 700

In our code, we always check (libxl.c):


    if (max_memkb < memorykb) {
        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "memory_static_max must be greater than or or equal to memory_dynamic_max\n");
        goto out;
    }

As target memory is always bigger than static-max in xenstore (from my test, for both pv and hvm):

    /local/domain/3/memory/static-max = "716800"
    /local/domain/3/memory/target = "716801

So it will not success.

Also I think target memory bigger than static-max seems not right.

Thanks,

Zhigang

> Can the behavior you expected be achieved by manipulating target memory
> instead of maxmem?
> 
> ISTR Oracle has different view on how memory targets are managed. But
> with no other information provided it's hard for me to figure out your
> intent and start a conversation.
> 
> Wei.
> 

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: xl mem-max error
  2014-11-07 14:21   ` Zhigang Wang
@ 2014-11-10 12:37     ` Wei Liu
  2014-11-10 12:44       ` Ian Campbell
  0 siblings, 1 reply; 19+ messages in thread
From: Wei Liu @ 2014-11-10 12:37 UTC (permalink / raw)
  To: Zhigang Wang; +Cc: Ian Jackson, xen-devel, Wei Liu, Ian Campbell

On Fri, Nov 07, 2014 at 09:21:38AM -0500, Zhigang Wang wrote:
> On 11/07/2014 06:05 AM, Wei Liu wrote:
> > On Thu, Nov 06, 2014 at 05:17:42PM -0500, Zhigang Wang wrote:
> >> Hi,
> >>
> >> I get this error:
> >>
> >>     # xl mem-max 3 700
> >>     libxl: error: libxl.c:4549:libxl_domain_setmaxmem: memory_static_max must be greater than or or equal to memory_dynamic_max
> >>     : Success
> >>     cannot set domid 3 static max memory to : 700
> >>
> > 
> > What's your expected behaviour? What's your end goal?
> 
> I expect: after start a VM with memory = 700, then I can do:
> 
>    # xl mem-max <domain> 700
> 
> In our code, we always check (libxl.c):
> 
> 
>     if (max_memkb < memorykb) {
>         LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "memory_static_max must be greater than or or equal to memory_dynamic_max\n");
>         goto out;
>     }
> 
> As target memory is always bigger than static-max in xenstore (from my test, for both pv and hvm):
> 
>     /local/domain/3/memory/static-max = "716800"
>     /local/domain/3/memory/target = "716801
> 
> So it will not success.
> 
> Also I think target memory bigger than static-max seems not right.
> 

This does look bogus, which may cause the guest to try to balloon up
over limit. At the very least, we should fix make target as big as
statix-max?

Ian and Ian, any thought how this bug came into being? I think we should
fix this for 4.5, but I don't think I know enough of how memory target
is expected to behave.

Wei.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: xl mem-max error
  2014-11-10 12:37     ` Wei Liu
@ 2014-11-10 12:44       ` Ian Campbell
  2014-11-10 15:29         ` Zhigang Wang
  0 siblings, 1 reply; 19+ messages in thread
From: Ian Campbell @ 2014-11-10 12:44 UTC (permalink / raw)
  To: Wei Liu; +Cc: xen-devel, Zhigang Wang, Ian Jackson

On Mon, 2014-11-10 at 12:37 +0000, Wei Liu wrote:

> Ian and Ian, any thought how this bug came into being? I think we should
> fix this for 4.5, but I don't think I know enough of how memory target
> is expected to behave.
> 

I'm confused by the description of what's going on, in particular the
mixing of mem-max commands and target xenstore nodes (since the former
doesn't really affect the latter).

How was the domain started (memory= and maxmem=).

What were static-max and target at the point?

What did they change to when xl mem-max was issued? 

What did you expect them to change to instead?

Ian.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: xl mem-max error
  2014-11-10 12:44       ` Ian Campbell
@ 2014-11-10 15:29         ` Zhigang Wang
  2014-11-10 15:30           ` Ian Campbell
  0 siblings, 1 reply; 19+ messages in thread
From: Zhigang Wang @ 2014-11-10 15:29 UTC (permalink / raw)
  To: Ian Campbell; +Cc: xen-devel, Wei Liu, Ian Jackson

On 11/10/2014 07:44 AM, Ian Campbell wrote:
> On Mon, 2014-11-10 at 12:37 +0000, Wei Liu wrote:
> 
>> Ian and Ian, any thought how this bug came into being? I think we should
>> fix this for 4.5, but I don't think I know enough of how memory target
>> is expected to behave.
>>
> 
> I'm confused by the description of what's going on, in particular the
> mixing of mem-max commands and target xenstore nodes (since the former
> doesn't really affect the latter).
> 
> How was the domain started (memory= and maxmem=).
> 
> What were static-max and target at the point?
> 
> What did they change to when xl mem-max was issued? 
> 
> What did you expect them to change to instead?

Sorry for the confusion I made. Here is the problem I encountered:

1. Start a VM with 'memory = 700'.
2. Doing 'xl mem-max <domid> 700' will cause a error.

My expectation: after I start a VM with 'memory = 700', I can do 'xl mem-max <domid> 700'.

A little analysis of the problem:

1. Error: "libxl: error: libxl.c:4549:libxl_domain_setmaxmem: memory_static_max must be greater than or or equal to memory_dynamic_max"

2. I find static-max always less then target memory in xenstore:

    /local/domain/3/memory/static-max = "716800" (memory_static_max)
    /local/domain/3/memory/target = "716801"     (memory_dynamic_max)

   which looks bogus.

Thanks,

Zhigang

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: xl mem-max error
  2014-11-10 15:29         ` Zhigang Wang
@ 2014-11-10 15:30           ` Ian Campbell
  2014-11-10 15:38             ` Zhigang Wang
  0 siblings, 1 reply; 19+ messages in thread
From: Ian Campbell @ 2014-11-10 15:30 UTC (permalink / raw)
  To: Zhigang Wang; +Cc: xen-devel, Wei Liu, Ian Jackson

On Mon, 2014-11-10 at 10:29 -0500, Zhigang Wang wrote:
> On 11/10/2014 07:44 AM, Ian Campbell wrote:
> > On Mon, 2014-11-10 at 12:37 +0000, Wei Liu wrote:
> > 
> >> Ian and Ian, any thought how this bug came into being? I think we should
> >> fix this for 4.5, but I don't think I know enough of how memory target
> >> is expected to behave.
> >>
> > 
> > I'm confused by the description of what's going on, in particular the
> > mixing of mem-max commands and target xenstore nodes (since the former
> > doesn't really affect the latter).
> > 
> > How was the domain started (memory= and maxmem=).
> > 
> > What were static-max and target at the point?
> > 
> > What did they change to when xl mem-max was issued? 
> > 
> > What did you expect them to change to instead?
> 
> Sorry for the confusion I made. Here is the problem I encountered:

This is just restating what was upthread, which, as I say, is confusing
to me.

Please can you just answer the 4 questions I asked and we can take it
from there.

> 
> 1. Start a VM with 'memory = 700'.
> 2. Doing 'xl mem-max <domid> 700' will cause a error.
> 
> My expectation: after I start a VM with 'memory = 700', I can do 'xl mem-max <domid> 700'.
> 
> A little analysis of the problem:
> 
> 1. Error: "libxl: error: libxl.c:4549:libxl_domain_setmaxmem: memory_static_max must be greater than or or equal to memory_dynamic_max"
> 
> 2. I find static-max always less then target memory in xenstore:
> 
>     /local/domain/3/memory/static-max = "716800" (memory_static_max)
>     /local/domain/3/memory/target = "716801"     (memory_dynamic_max)
> 
>    which looks bogus.
> 
> Thanks,
> 
> Zhigang

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: xl mem-max error
  2014-11-10 15:30           ` Ian Campbell
@ 2014-11-10 15:38             ` Zhigang Wang
  2014-11-12 12:03               ` Ian Campbell
  0 siblings, 1 reply; 19+ messages in thread
From: Zhigang Wang @ 2014-11-10 15:38 UTC (permalink / raw)
  To: Ian Campbell; +Cc: xen-devel, Wei Liu, Ian Jackson

OK. Let me try my best:

>>> I'm confused by the description of what's going on, in particular the
>>> mixing of mem-max commands and target xenstore nodes (since the former
>>> doesn't really affect the latter).
>>>
>>> How was the domain started (memory= and maxmem=).

xl create with 'memory = 700', no maxmem been set. I think it means maxmem = memory for this case.

>>> What were static-max and target at the point?

     /local/domain/3/memory/static-max = "716800"
     /local/domain/3/memory/target = "716801"

>>> What did they change to when xl mem-max was issued? 

When I issue 'xl mem-max <domid> 700', static-max and target in xenstore will not change, but it will cause the command to fail.

Because: "libxl: error: libxl.c:4549:libxl_domain_setmaxmem: memory_static_max must be greater than or or equal to memory_dynamic_max"

>>> What did you expect them to change to instead?

I expect I can set the maxmem to the same value I initially set (700).

Thanks,

Zhigang

>>
>> Sorry for the confusion I made. Here is the problem I encountered:
> 
> This is just restating what was upthread, which, as I say, is confusing
> to me.
> 
> Please can you just answer the 4 questions I asked and we can take it
> from there.
> 
>>
>> 1. Start a VM with 'memory = 700'.
>> 2. Doing 'xl mem-max <domid> 700' will cause a error.
>>
>> My expectation: after I start a VM with 'memory = 700', I can do 'xl mem-max <domid> 700'.
>>
>> A little analysis of the problem:
>>
>> 1. Error: "libxl: error: libxl.c:4549:libxl_domain_setmaxmem: memory_static_max must be greater than or or equal to memory_dynamic_max"
>>
>> 2. I find static-max always less then target memory in xenstore:
>>
>>     /local/domain/3/memory/static-max = "716800" (memory_static_max)
>>     /local/domain/3/memory/target = "716801"     (memory_dynamic_max)
>>
>>    which looks bogus.
>>
>> Thanks,
>>
>> Zhigang
> 
> 

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: xl mem-max error
  2014-11-10 15:38             ` Zhigang Wang
@ 2014-11-12 12:03               ` Ian Campbell
  2014-11-17 20:03                 ` Zhigang Wang
  0 siblings, 1 reply; 19+ messages in thread
From: Ian Campbell @ 2014-11-12 12:03 UTC (permalink / raw)
  To: Zhigang Wang; +Cc: xen-devel, Wei Liu, Ian Jackson

On Mon, 2014-11-10 at 10:38 -0500, Zhigang Wang wrote:
> OK. Let me try my best:
> 
> >>> I'm confused by the description of what's going on, in particular the
> >>> mixing of mem-max commands and target xenstore nodes (since the former
> >>> doesn't really affect the latter).
> >>>
> >>> How was the domain started (memory= and maxmem=).
> 
> xl create with 'memory = 700', no maxmem been set. I think it means maxmem = memory for this case.
> 
> >>> What were static-max and target at the point?
> 
>      /local/domain/3/memory/static-max = "716800"
>      /local/domain/3/memory/target = "716801"
> 
> >>> What did they change to when xl mem-max was issued? 
> 
> When I issue 'xl mem-max <domid> 700', static-max and target in xenstore will not change, but it will cause the command to fail.
> 
> Because: "libxl: error: libxl.c:4549:libxl_domain_setmaxmem: memory_static_max must be greater than or or equal to memory_dynamic_max"
> 
> >>> What did you expect them to change to instead?
> 
> I expect I can set the maxmem to the same value I initially set (700).

OK, thanks, got it. I think the use of xl mem-max is a bit of a
red-herring, the issue here is that static-max < target at start of day.

I suspect there is either a rounding error somewhere or because of
LIBXL_MAXMEM_CONSTANT being inconsistently applied to the two values
somewhere along the line.

We had been planning[0] to remove this early in the 4.5 cycle, but as
ever it never floated to the top of anyone's list. For 4.5 we should
probably look at applying this fudge more consistently.

Ian.

[0] http://bugs.xenproject.org/xen/bug/23

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: xl mem-max error
  2014-11-12 12:03               ` Ian Campbell
@ 2014-11-17 20:03                 ` Zhigang Wang
  2014-11-18  9:26                   ` Ian Campbell
  0 siblings, 1 reply; 19+ messages in thread
From: Zhigang Wang @ 2014-11-17 20:03 UTC (permalink / raw)
  To: Ian Campbell; +Cc: xen-devel, Wei Liu, Ian Jackson

On 11/12/2014 07:03 AM, Ian Campbell wrote:
> On Mon, 2014-11-10 at 10:38 -0500, Zhigang Wang wrote:
>> OK. Let me try my best:
>>
>>>>> I'm confused by the description of what's going on, in particular the
>>>>> mixing of mem-max commands and target xenstore nodes (since the former
>>>>> doesn't really affect the latter).
>>>>>
>>>>> How was the domain started (memory= and maxmem=).
>>
>> xl create with 'memory = 700', no maxmem been set. I think it means maxmem = memory for this case.
>>
>>>>> What were static-max and target at the point?
>>
>>      /local/domain/3/memory/static-max = "716800"
>>      /local/domain/3/memory/target = "716801"
>>
>>>>> What did they change to when xl mem-max was issued? 
>>
>> When I issue 'xl mem-max <domid> 700', static-max and target in xenstore will not change, but it will cause the command to fail.
>>
>> Because: "libxl: error: libxl.c:4549:libxl_domain_setmaxmem: memory_static_max must be greater than or or equal to memory_dynamic_max"
>>
>>>>> What did you expect them to change to instead?
>>
>> I expect I can set the maxmem to the same value I initially set (700).
> 
> OK, thanks, got it. I think the use of xl mem-max is a bit of a
> red-herring, the issue here is that static-max < target at start of day.
> 
> I suspect there is either a rounding error somewhere or because of
> LIBXL_MAXMEM_CONSTANT being inconsistently applied to the two values
> somewhere along the line.
> 
> We had been planning[0] to remove this early in the 4.5 cycle, but as
> ever it never floated to the top of anyone's list. For 4.5 we should
> probably look at applying this fudge more consistently.
> 
> Ian.
> 
> [0] http://bugs.xenproject.org/xen/bug/23

Here is more info (correct me if something wrong):

1. libxl_types.idl:

    ("video_memkb", MemKB)

    MemKB = UInt(64, init_val = "LIBXL_MEMKB_DEFAULT", json_gen_fn = "libxl__uint64_gen_json")

  libxl.h: #define LIBXL_MEMKB_DEFAULT ~0ULL

  So video_memkb = -1 by default.

2. For hvm, we will set it into: 0, 16M, 8M according to hvm.vga.kind (libxl_create.c)

3. For pv guest, we will use default (-1).

4. When we calculate static-max and target memory:

    ents[0] = "memory/static-max";
    ents[1] = GCSPRINTF("%"PRId64, info->max_memkb);
    ents[2] = "memory/target";
    ents[3] = GCSPRINTF("%"PRId64, info->target_memkb - info->video_memkb);

  So target = static-max - (-1):
   
      /local/domain/3/memory/static-max = "716800"
      /local/domain/3/memory/target = "716801"

  Maybe this is the root cause why we include LIBXL_MAXMEM_CONSTANT.

Potential solutions:

1. Set b_info->video_memkb = 0; for pv guest.
2. Set LIBXL_MEMKB_DEFAULT = 0 (instead of -1): this will affect a lot things.
3. Also add LIBXL_MAXMEM_CONSTANT before doing comparison. (we should avoid this as we want to remove LIBXL_MAXMEM_CONSTANT)

Thanks,

Zhigang

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: xl mem-max error
  2014-11-17 20:03                 ` Zhigang Wang
@ 2014-11-18  9:26                   ` Ian Campbell
  2014-11-18 20:57                     ` [PATCH] set pv guest default video_memkb to 0 Zhigang Wang
  0 siblings, 1 reply; 19+ messages in thread
From: Ian Campbell @ 2014-11-18  9:26 UTC (permalink / raw)
  To: Zhigang Wang; +Cc: xen-devel, Wei Liu, Ian Jackson

On Mon, 2014-11-17 at 15:03 -0500, Zhigang Wang wrote:
> On 11/12/2014 07:03 AM, Ian Campbell wrote:
> > On Mon, 2014-11-10 at 10:38 -0500, Zhigang Wang wrote:
> >> OK. Let me try my best:
> >>
> >>>>> I'm confused by the description of what's going on, in particular the
> >>>>> mixing of mem-max commands and target xenstore nodes (since the former
> >>>>> doesn't really affect the latter).
> >>>>>
> >>>>> How was the domain started (memory= and maxmem=).
> >>
> >> xl create with 'memory = 700', no maxmem been set. I think it means maxmem = memory for this case.
> >>
> >>>>> What were static-max and target at the point?
> >>
> >>      /local/domain/3/memory/static-max = "716800"
> >>      /local/domain/3/memory/target = "716801"
> >>
> >>>>> What did they change to when xl mem-max was issued? 
> >>
> >> When I issue 'xl mem-max <domid> 700', static-max and target in xenstore will not change, but it will cause the command to fail.
> >>
> >> Because: "libxl: error: libxl.c:4549:libxl_domain_setmaxmem: memory_static_max must be greater than or or equal to memory_dynamic_max"
> >>
> >>>>> What did you expect them to change to instead?
> >>
> >> I expect I can set the maxmem to the same value I initially set (700).
> > 
> > OK, thanks, got it. I think the use of xl mem-max is a bit of a
> > red-herring, the issue here is that static-max < target at start of day.
> > 
> > I suspect there is either a rounding error somewhere or because of
> > LIBXL_MAXMEM_CONSTANT being inconsistently applied to the two values
> > somewhere along the line.
> > 
> > We had been planning[0] to remove this early in the 4.5 cycle, but as
> > ever it never floated to the top of anyone's list. For 4.5 we should
> > probably look at applying this fudge more consistently.
> > 
> > Ian.
> > 
> > [0] http://bugs.xenproject.org/xen/bug/23
> 
> Here is more info (correct me if something wrong):
> 
> 1. libxl_types.idl:
> 
>     ("video_memkb", MemKB)
> 
>     MemKB = UInt(64, init_val = "LIBXL_MEMKB_DEFAULT", json_gen_fn = "libxl__uint64_gen_json")
> 
>   libxl.h: #define LIBXL_MEMKB_DEFAULT ~0ULL
> 
>   So video_memkb = -1 by default.
> 
> 2. For hvm, we will set it into: 0, 16M, 8M according to hvm.vga.kind (libxl_create.c)
> 
> 3. For pv guest, we will use default (-1).
> 
> 4. When we calculate static-max and target memory:
> 
>     ents[0] = "memory/static-max";
>     ents[1] = GCSPRINTF("%"PRId64, info->max_memkb);
>     ents[2] = "memory/target";
>     ents[3] = GCSPRINTF("%"PRId64, info->target_memkb - info->video_memkb);
> 
>   So target = static-max - (-1):

Aha, well spotted!
   
>       /local/domain/3/memory/static-max = "716800"
>       /local/domain/3/memory/target = "716801"
> 
>   Maybe this is the root cause why we include LIBXL_MAXMEM_CONSTANT.

I don't think so, LIBXL_MAXMEM_CONSTANT is the result of some
not-well-understood folklore which predates libxl entirely.

> 
> Potential solutions:
> 
> 1. Set b_info->video_memkb = 0; for pv guest.

We should do this one, in the libxl_domain_build_info_setdefault
function.

> 2. Set LIBXL_MEMKB_DEFAULT = 0 (instead of -1): this will affect a lot things.

Yeah, we can't do that since it would disallow setting certain kinds of
memory to 0, which can make sense.

> 3. Also add LIBXL_MAXMEM_CONSTANT before doing comparison. (we should avoid this as we want to remove LIBXL_MAXMEM_CONSTANT)

Agreed, lets not to this.

Ian.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH] set pv guest default video_memkb to 0
  2014-11-18  9:26                   ` Ian Campbell
@ 2014-11-18 20:57                     ` Zhigang Wang
  2014-11-19 21:08                       ` Konrad Rzeszutek Wilk
  2014-11-20 15:29                       ` Ian Campbell
  0 siblings, 2 replies; 19+ messages in thread
From: Zhigang Wang @ 2014-11-18 20:57 UTC (permalink / raw)
  To: xen-devel; +Cc: Zhigang Wang

Before this patch, pv guest video_memkb is -1, which is an invalid value.
And it will cause the xenstore 'memory/targe' calculation wrong:

    memory/target = info->target_memkb - info->video_memkb

Signed-off-by: Zhigang Wang <zhigang.x.wang@oracle.com>
---
 tools/libxl/libxl_create.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
index b1ff5ae..1198225 100644
--- a/tools/libxl/libxl_create.c
+++ b/tools/libxl/libxl_create.c
@@ -357,6 +357,8 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc,
         break;
     case LIBXL_DOMAIN_TYPE_PV:
         libxl_defbool_setdefault(&b_info->u.pv.e820_host, false);
+        if (b_info->video_memkb == LIBXL_MEMKB_DEFAULT)
+            b_info->video_memkb = 0;
         if (b_info->shadow_memkb == LIBXL_MEMKB_DEFAULT)
             b_info->shadow_memkb = 0;
         if (b_info->u.pv.slack_memkb == LIBXL_MEMKB_DEFAULT)
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* Re: [PATCH] set pv guest default video_memkb to 0
  2014-11-18 20:57                     ` [PATCH] set pv guest default video_memkb to 0 Zhigang Wang
@ 2014-11-19 21:08                       ` Konrad Rzeszutek Wilk
  2014-11-19 21:24                         ` Wei Liu
  2014-11-20 15:29                       ` Ian Campbell
  1 sibling, 1 reply; 19+ messages in thread
From: Konrad Rzeszutek Wilk @ 2014-11-19 21:08 UTC (permalink / raw)
  To: Zhigang Wang, wei.liu2, ian.campbell, ian.jackson; +Cc: xen-devel

On Tue, Nov 18, 2014 at 03:57:08PM -0500, Zhigang Wang wrote:
> Before this patch, pv guest video_memkb is -1, which is an invalid value.
> And it will cause the xenstore 'memory/targe' calculation wrong:
> 
>     memory/target = info->target_memkb - info->video_memkb

CC-ing the maintainers.

Is this an regression as compared to Xen 4.4 or is this also in Xen 4.4?

Thanks.

> 
> Signed-off-by: Zhigang Wang <zhigang.x.wang@oracle.com>
> ---
>  tools/libxl/libxl_create.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
> index b1ff5ae..1198225 100644
> --- a/tools/libxl/libxl_create.c
> +++ b/tools/libxl/libxl_create.c
> @@ -357,6 +357,8 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc,
>          break;
>      case LIBXL_DOMAIN_TYPE_PV:
>          libxl_defbool_setdefault(&b_info->u.pv.e820_host, false);
> +        if (b_info->video_memkb == LIBXL_MEMKB_DEFAULT)
> +            b_info->video_memkb = 0;
>          if (b_info->shadow_memkb == LIBXL_MEMKB_DEFAULT)
>              b_info->shadow_memkb = 0;
>          if (b_info->u.pv.slack_memkb == LIBXL_MEMKB_DEFAULT)
> -- 
> 1.8.3.1
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH] set pv guest default video_memkb to 0
  2014-11-19 21:08                       ` Konrad Rzeszutek Wilk
@ 2014-11-19 21:24                         ` Wei Liu
  2014-11-20 15:29                           ` Ian Campbell
  0 siblings, 1 reply; 19+ messages in thread
From: Wei Liu @ 2014-11-19 21:24 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk
  Cc: ian.jackson, Zhigang Wang, wei.liu2, ian.campbell, xen-devel

On Wed, Nov 19, 2014 at 04:08:46PM -0500, Konrad Rzeszutek Wilk wrote:
> On Tue, Nov 18, 2014 at 03:57:08PM -0500, Zhigang Wang wrote:
> > Before this patch, pv guest video_memkb is -1, which is an invalid value.
> > And it will cause the xenstore 'memory/targe' calculation wrong:
> > 
> >     memory/target = info->target_memkb - info->video_memkb
> 
> CC-ing the maintainers.
> 
> Is this an regression as compared to Xen 4.4 or is this also in Xen 4.4?
> 

I don't think this is a regression, it has been broken for quite a
while.

Wei.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH] set pv guest default video_memkb to 0
  2014-11-18 20:57                     ` [PATCH] set pv guest default video_memkb to 0 Zhigang Wang
  2014-11-19 21:08                       ` Konrad Rzeszutek Wilk
@ 2014-11-20 15:29                       ` Ian Campbell
  1 sibling, 0 replies; 19+ messages in thread
From: Ian Campbell @ 2014-11-20 15:29 UTC (permalink / raw)
  To: Zhigang Wang; +Cc: xen-devel

On Tue, 2014-11-18 at 15:57 -0500, Zhigang Wang wrote:
> Before this patch, pv guest video_memkb is -1, which is an invalid value.
> And it will cause the xenstore 'memory/targe' calculation wrong:
> 
>     memory/target = info->target_memkb - info->video_memkb
> 
> Signed-off-by: Zhigang Wang <zhigang.x.wang@oracle.com>

Acked-by: Ian Campbell <ian.campbell@citrix.com>

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH] set pv guest default video_memkb to 0
  2014-11-19 21:24                         ` Wei Liu
@ 2014-11-20 15:29                           ` Ian Campbell
  2014-11-20 15:48                             ` Wei Liu
  0 siblings, 1 reply; 19+ messages in thread
From: Ian Campbell @ 2014-11-20 15:29 UTC (permalink / raw)
  To: Wei Liu; +Cc: xen-devel, Zhigang Wang, ian.jackson

On Wed, 2014-11-19 at 21:24 +0000, Wei Liu wrote:
> On Wed, Nov 19, 2014 at 04:08:46PM -0500, Konrad Rzeszutek Wilk wrote:
> > On Tue, Nov 18, 2014 at 03:57:08PM -0500, Zhigang Wang wrote:
> > > Before this patch, pv guest video_memkb is -1, which is an invalid value.
> > > And it will cause the xenstore 'memory/targe' calculation wrong:
> > > 
> > >     memory/target = info->target_memkb - info->video_memkb
> > 
> > CC-ing the maintainers.
> > 
> > Is this an regression as compared to Xen 4.4 or is this also in Xen 4.4?
> > 
> 
> I don't think this is a regression, it has been broken for quite a
> while.

I think so to.

On the other hand its a pretty clear bug to use video_memkb == -1 and
we've seen that it causes real issues. The fix is also fairly obvious.
I'm inclined towards suggesting we fix this in 4.5.

Ian.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH] set pv guest default video_memkb to 0
  2014-11-20 15:29                           ` Ian Campbell
@ 2014-11-20 15:48                             ` Wei Liu
  2014-11-20 19:44                               ` Konrad Rzeszutek Wilk
  0 siblings, 1 reply; 19+ messages in thread
From: Wei Liu @ 2014-11-20 15:48 UTC (permalink / raw)
  To: Ian Campbell; +Cc: ian.jackson, Zhigang Wang, Wei Liu, xen-devel

On Thu, Nov 20, 2014 at 03:29:51PM +0000, Ian Campbell wrote:
> On Wed, 2014-11-19 at 21:24 +0000, Wei Liu wrote:
> > On Wed, Nov 19, 2014 at 04:08:46PM -0500, Konrad Rzeszutek Wilk wrote:
> > > On Tue, Nov 18, 2014 at 03:57:08PM -0500, Zhigang Wang wrote:
> > > > Before this patch, pv guest video_memkb is -1, which is an invalid value.
> > > > And it will cause the xenstore 'memory/targe' calculation wrong:
> > > > 
> > > >     memory/target = info->target_memkb - info->video_memkb
> > > 
> > > CC-ing the maintainers.
> > > 
> > > Is this an regression as compared to Xen 4.4 or is this also in Xen 4.4?
> > > 
> > 
> > I don't think this is a regression, it has been broken for quite a
> > while.
> 
> I think so to.
> 
> On the other hand its a pretty clear bug to use video_memkb == -1 and
> we've seen that it causes real issues. The fix is also fairly obvious.
> I'm inclined towards suggesting we fix this in 4.5.
> 

I concur.

Wei.

> Ian.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH] set pv guest default video_memkb to 0
  2014-11-20 15:48                             ` Wei Liu
@ 2014-11-20 19:44                               ` Konrad Rzeszutek Wilk
  2014-11-28 12:12                                 ` Ian Campbell
  0 siblings, 1 reply; 19+ messages in thread
From: Konrad Rzeszutek Wilk @ 2014-11-20 19:44 UTC (permalink / raw)
  To: Wei Liu; +Cc: xen-devel, Zhigang Wang, ian.jackson, Ian Campbell

On Thu, Nov 20, 2014 at 03:48:17PM +0000, Wei Liu wrote:
> On Thu, Nov 20, 2014 at 03:29:51PM +0000, Ian Campbell wrote:
> > On Wed, 2014-11-19 at 21:24 +0000, Wei Liu wrote:
> > > On Wed, Nov 19, 2014 at 04:08:46PM -0500, Konrad Rzeszutek Wilk wrote:
> > > > On Tue, Nov 18, 2014 at 03:57:08PM -0500, Zhigang Wang wrote:
> > > > > Before this patch, pv guest video_memkb is -1, which is an invalid value.
> > > > > And it will cause the xenstore 'memory/targe' calculation wrong:
> > > > > 
> > > > >     memory/target = info->target_memkb - info->video_memkb
> > > > 
> > > > CC-ing the maintainers.
> > > > 
> > > > Is this an regression as compared to Xen 4.4 or is this also in Xen 4.4?
> > > > 
> > > 
> > > I don't think this is a regression, it has been broken for quite a
> > > while.
> > 
> > I think so to.
> > 
> > On the other hand its a pretty clear bug to use video_memkb == -1 and
> > we've seen that it causes real issues. The fix is also fairly obvious.
> > I'm inclined towards suggesting we fix this in 4.5.
> > 
> 
> I concur.

Lets do it then. RElease-Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> 
> Wei.
> 
> > Ian.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH] set pv guest default video_memkb to 0
  2014-11-20 19:44                               ` Konrad Rzeszutek Wilk
@ 2014-11-28 12:12                                 ` Ian Campbell
  0 siblings, 0 replies; 19+ messages in thread
From: Ian Campbell @ 2014-11-28 12:12 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk; +Cc: xen-devel, Zhigang Wang, Wei Liu, ian.jackson

On Thu, 2014-11-20 at 14:44 -0500, Konrad Rzeszutek Wilk wrote:
> On Thu, Nov 20, 2014 at 03:48:17PM +0000, Wei Liu wrote:
> > On Thu, Nov 20, 2014 at 03:29:51PM +0000, Ian Campbell wrote:
> > > On Wed, 2014-11-19 at 21:24 +0000, Wei Liu wrote:
> > > > On Wed, Nov 19, 2014 at 04:08:46PM -0500, Konrad Rzeszutek Wilk wrote:
> > > > > On Tue, Nov 18, 2014 at 03:57:08PM -0500, Zhigang Wang wrote:
> > > > > > Before this patch, pv guest video_memkb is -1, which is an invalid value.
> > > > > > And it will cause the xenstore 'memory/targe' calculation wrong:
> > > > > > 
> > > > > >     memory/target = info->target_memkb - info->video_memkb
> > > > > 
> > > > > CC-ing the maintainers.
> > > > > 
> > > > > Is this an regression as compared to Xen 4.4 or is this also in Xen 4.4?
> > > > > 
> > > > 
> > > > I don't think this is a regression, it has been broken for quite a
> > > > while.
> > > 
> > > I think so to.
> > > 
> > > On the other hand its a pretty clear bug to use video_memkb == -1 and
> > > we've seen that it causes real issues. The fix is also fairly obvious.
> > > I'm inclined towards suggesting we fix this in 4.5.
> > > 
> > 
> > I concur.
> 
> Lets do it then. RElease-Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>

APplied, thanks.

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2014-11-28 12:12 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-06 22:17 xl mem-max error Zhigang Wang
2014-11-07 11:05 ` Wei Liu
2014-11-07 14:21   ` Zhigang Wang
2014-11-10 12:37     ` Wei Liu
2014-11-10 12:44       ` Ian Campbell
2014-11-10 15:29         ` Zhigang Wang
2014-11-10 15:30           ` Ian Campbell
2014-11-10 15:38             ` Zhigang Wang
2014-11-12 12:03               ` Ian Campbell
2014-11-17 20:03                 ` Zhigang Wang
2014-11-18  9:26                   ` Ian Campbell
2014-11-18 20:57                     ` [PATCH] set pv guest default video_memkb to 0 Zhigang Wang
2014-11-19 21:08                       ` Konrad Rzeszutek Wilk
2014-11-19 21:24                         ` Wei Liu
2014-11-20 15:29                           ` Ian Campbell
2014-11-20 15:48                             ` Wei Liu
2014-11-20 19:44                               ` Konrad Rzeszutek Wilk
2014-11-28 12:12                                 ` Ian Campbell
2014-11-20 15:29                       ` Ian Campbell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.