xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
To: Juergen Gross <jgross@suse.com>
Cc: minios-devel@lists.xenproject.org,
	xen-devel@lists.xenproject.org, wei.liu2@citrix.com
Subject: Re: [PATCH v2 03/18] mini-os: remove MM_DEBUG code
Date: Wed, 10 Aug 2016 22:03:12 +0200	[thread overview]
Message-ID: <20160810200312.GP16772@var.home> (raw)
In-Reply-To: <1470418562-11234-4-git-send-email-jgross@suse.com>

Juergen Gross, on Fri 05 Aug 2016 19:35:47 +0200, wrote:
> mm.c contains unused code inside #ifdef MM_DEBUG areas. Its usability
> is rather questionable and some parts are even wrong (e.g.
> print_chunks() called with nr_pages > 1000 will clobber an arbitrary
> stack content with a 0 byte).
> 
> Remove this code.
> 
> Signed-off-by: Juergen Gross <jgross@suse.com>
> Reviewed-by: Wei Liu <wei.liu2@citrix.com>

Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>

> ---
>  mm.c | 60 ------------------------------------------------------------
>  1 file changed, 60 deletions(-)
> 
> diff --git a/mm.c b/mm.c
> index 31aaf83..0dd4862 100644
> --- a/mm.c
> +++ b/mm.c
> @@ -42,13 +42,6 @@
>  #include <mini-os/lib.h>
>  #include <mini-os/xmalloc.h>
>  
> -#ifdef MM_DEBUG
> -#define DEBUG(_f, _a...) \
> -    printk("MINI_OS(file=mm.c, line=%d) " _f "\n", __LINE__, ## _a)
> -#else
> -#define DEBUG(_f, _a...)    ((void)0)
> -#endif
> -
>  /*********************
>   * ALLOCATION BITMAP
>   *  One bit per page of memory. Bit set => page is allocated.
> @@ -140,59 +133,6 @@ static chunk_head_t  free_tail[FREELIST_SIZE];
>  #define round_pgdown(_p)  ((_p)&PAGE_MASK)
>  #define round_pgup(_p)    (((_p)+(PAGE_SIZE-1))&PAGE_MASK)
>  
> -#ifdef MM_DEBUG
> -/*
> - * Prints allocation[0/1] for @nr_pages, starting at @start
> - * address (virtual).
> - */
> -USED static void print_allocation(void *start, int nr_pages)
> -{
> -    unsigned long pfn_start = virt_to_pfn(start);
> -    int count;
> -    for(count = 0; count < nr_pages; count++)
> -        if(allocated_in_map(pfn_start + count)) printk("1");
> -        else printk("0");
> -        
> -    printk("\n");        
> -}
> -
> -/*
> - * Prints chunks (making them with letters) for @nr_pages starting
> - * at @start (virtual).
> - */
> -USED static void print_chunks(void *start, int nr_pages)
> -{
> -    char chunks[1001], current='A';
> -    int order, count;
> -    chunk_head_t *head;
> -    unsigned long pfn_start = virt_to_pfn(start);
> -   
> -    memset(chunks, (int)'_', 1000);
> -    if(nr_pages > 1000) 
> -    {
> -        DEBUG("Can only pring 1000 pages. Increase buffer size.");
> -    }
> -    
> -    for(order=0; order < FREELIST_SIZE; order++)
> -    {
> -        head = free_head[order];
> -        while(!FREELIST_EMPTY(head))
> -        {
> -            for(count = 0; count < 1UL<< head->level; count++)
> -            {
> -                if(count + virt_to_pfn(head) - pfn_start < 1000)
> -                    chunks[count + virt_to_pfn(head) - pfn_start] = current;
> -            }
> -            head = head->next;
> -            current++;
> -        }
> -    }
> -    chunks[nr_pages] = '\0';
> -    printk("%s\n", chunks);
> -}
> -#endif
> -
> -
>  /*
>   * Initialise allocator, placing addresses [@min,@max] in free pool.
>   * @min and @max are PHYSICAL addresses.
> -- 
> 2.6.6
> 

-- 
Samuel
Be warned that typing \fBkillall \fIname\fP may not have the desired
effect on non-Linux systems, especially when done by a privileged user.
(From the killall manual page)

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  reply	other threads:[~2016-08-10 20:03 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-05 17:35 [PATCH v2 00/18] mini-os: support of auto-ballooning Juergen Gross
2016-08-05 17:35 ` [PATCH v2 01/18] mini-os: correct first free pfn Juergen Gross
2016-08-10 20:02   ` Samuel Thibault
2016-08-05 17:35 ` [PATCH v2 02/18] mini-os: remove unused alloc_contig_pages() function Juergen Gross
2016-08-10 20:02   ` Samuel Thibault
2016-08-05 17:35 ` [PATCH v2 03/18] mini-os: remove MM_DEBUG code Juergen Gross
2016-08-10 20:03   ` Samuel Thibault [this message]
2016-08-05 17:35 ` [PATCH v2 04/18] mini-os: add description of x86 memory usage Juergen Gross
2016-08-10 20:04   ` Samuel Thibault
2016-08-05 17:35 ` [PATCH v2 05/18] mini-os: add nr_free_pages counter Juergen Gross
2016-08-10 20:05   ` Samuel Thibault
2016-08-05 17:35 ` [PATCH v2 06/18] mini-os: let memory allocation fail if no free page available Juergen Gross
2016-08-10 20:06   ` Samuel Thibault
2016-08-05 17:35 ` [PATCH v2 07/18] mini-os: add ballooning config item Juergen Gross
2016-08-10 20:10   ` Samuel Thibault
2016-08-05 17:35 ` [PATCH v2 08/18] mini-os: get maximum memory size from hypervisor Juergen Gross
2016-08-10 20:11   ` Samuel Thibault
2016-08-05 17:35 ` [PATCH v2 09/18] mini-os: modify virtual memory layout for support of ballooning Juergen Gross
2016-08-10 20:16   ` Samuel Thibault
2016-08-05 17:35 ` [PATCH v2 10/18] mini-os: remove unused mem_test() function Juergen Gross
2016-08-10 20:17   ` Samuel Thibault
2016-08-05 17:35 ` [PATCH v2 11/18] mini-os: add checks for out of memory Juergen Gross
2016-08-10 20:18   ` Samuel Thibault
2016-08-05 17:35 ` [PATCH v2 12/18] mini-os: don't allocate new pages for level 1 p2m tree Juergen Gross
2016-08-10 20:24   ` Samuel Thibault
2016-08-05 17:35 ` [PATCH v2 13/18] mini-os: add function to map one frame Juergen Gross
2016-08-10 20:26   ` Samuel Thibault
2016-08-05 17:35 ` [PATCH v2 14/18] mini-os: move p2m related macros to header file Juergen Gross
2016-08-10 20:29   ` Samuel Thibault
2016-08-05 17:35 ` [PATCH v2 15/18] mini-os: remap p2m list in case of ballooning Juergen Gross
2016-08-10 20:35   ` Samuel Thibault
2016-08-10 20:41   ` Samuel Thibault
2016-08-11  4:04     ` Juergen Gross
2016-08-05 17:36 ` [PATCH v2 16/18] mini-os: map page allocator's bitmap to virtual kernel area for ballooning Juergen Gross
2016-08-10 20:45   ` Samuel Thibault
2016-08-11  4:05     ` Juergen Gross
2016-08-05 17:36 ` [PATCH v2 17/18] mini-os: add support for ballooning up Juergen Gross
2016-08-10 21:02   ` Samuel Thibault
2016-08-11  5:50     ` Juergen Gross
2016-08-05 17:36 ` [PATCH v2 18/18] mini-os: balloon up in case of oom Juergen Gross
2016-08-10 21:07   ` Samuel Thibault
2016-08-11  5:51     ` Juergen Gross
2016-08-10 21:07 ` [PATCH v2 00/18] mini-os: support of auto-ballooning Samuel Thibault
2016-08-11  5:52   ` Juergen Gross

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160810200312.GP16772@var.home \
    --to=samuel.thibault@ens-lyon.org \
    --cc=jgross@suse.com \
    --cc=minios-devel@lists.xenproject.org \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).