All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jan Beulich" <JBeulich@suse.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>, Xen-devel <xen-devel@lists.xen.org>
Subject: Re: [PATCH] x86/mm: Drop MEM_LOG() and correct some printed information
Date: Wed, 29 Mar 2017 07:06:38 -0600	[thread overview]
Message-ID: <58DBCD7E020000780014A093@prv-mh.provo.novell.com> (raw)
In-Reply-To: <1490790572-19840-1-git-send-email-andrew.cooper3@citrix.com>

>>> On 29.03.17 at 14:29, <andrew.cooper3@citrix.com> wrote:
>  * Use 0x prefix for otherwise unqualified hex numbers.

I'm glad this in fact refers to just a single place.

> @@ -1057,10 +1062,10 @@ get_page_from_l1e(
>                  put_page_type(page);
>              put_page(page);
>  
> -            MEM_LOG("Error updating mappings for mfn %lx (pfn %lx,"
> -                    " from L1 entry %" PRIpte ") for %d",
> -                    mfn, get_gpfn_from_mfn(mfn),
> -                    l1e_get_intpte(l1e), l1e_owner->domain_id);
> +            gdprintk(XENLOG_WARNING, "Error updating mappings for mfn %" PRI_mfn
> +                     " (pfn %" PRI_pfn ", from L1 entry %" PRIpte ") for d%d\n",
> +                     mfn, get_gpfn_from_mfn(mfn),
> +                     l1e_get_intpte(l1e), l1e_owner->domain_id);
>              return err;
>          }
>      }
> @@ -1068,10 +1073,10 @@ get_page_from_l1e(
>      return 0;
>  
>   could_not_pin:
> -    MEM_LOG("Error getting mfn %lx (pfn %lx) from L1 entry %" PRIpte
> -            " for l1e_owner=%d, pg_owner=%d",
> -            mfn, get_gpfn_from_mfn(mfn),
> -            l1e_get_intpte(l1e), l1e_owner->domain_id, pg_owner->domain_id);
> +    gdprintk(XENLOG_WARNING, "Error getting mfn %" PRI_mfn " (pfn %" PRI_pfn
> +             ") from L1 entry %" PRIpte " for l1e_owner d%d, pg_owner d%d",
> +             mfn, get_gpfn_from_mfn(mfn),
> +             l1e_get_intpte(l1e), l1e_owner->domain_id, pg_owner->domain_id);

Especially here the wrapping of the format string is rather
unfortunate. Didn't we agree to allow format strings to exceed
the 80 column restriction anyway?

> @@ -1388,7 +1398,7 @@ static int alloc_l1_table(struct page_info *page)
>      return 0;
>  
>   fail:
> -    MEM_LOG("Failure in alloc_l1_table: entry %d", i);
> +    gdprintk(XENLOG_WARNING, "Failure in alloc_l1_table: entry %d\n", i);

%u (or even %03x; same in alloc_l[234]_table())

> @@ -1979,7 +1991,8 @@ static int mod_l2_entry(l2_pgentry_t *pl2e,
>  
>      if ( unlikely(!is_guest_l2_slot(d, type, pgentry_ptr_to_slot(pl2e))) )
>      {
> -        MEM_LOG("Illegal L2 update attempt in Xen-private area %p", pl2e);
> +        gdprintk(XENLOG_WARNING,
> +                 "Illegal L2 update attempt in Xen-private area %p\n", pl2e);

Could you make this message useful at once? The pointer is
not really helpful to diagnose anything, I think. Same for
mod_l[34]_entry() then.

> @@ -3179,7 +3208,7 @@ long do_mmuext_op(
>  
>          if ( unlikely(__copy_from_guest(&op, uops, 1) != 0) )
>          {
> -            MEM_LOG("Bad __copy_from_guest");
> +            gdprintk(XENLOG_WARNING, "Bad __copy_from_guest\n");

I'd suggest to drop this one altogether.

> @@ -3195,7 +3224,8 @@ long do_mmuext_op(
>              case MMUEXT_UNPIN_TABLE:
>                  break;
>              default:
> -                MEM_LOG("Invalid extended pt command %#x", op.cmd);
> +                gdprintk(XENLOG_WARNING,
> +                         "Invalid extended pt command %#x\n", op.cmd);

And this one too.

> @@ -3297,7 +3329,8 @@ long do_mmuext_op(
>              page = get_page_from_gfn(pg_owner, op.arg1.mfn, NULL, P2M_ALLOC);
>              if ( unlikely(!page) )
>              {
> -                MEM_LOG("Mfn %lx bad domain", op.arg1.mfn);
> +                gdprintk(XENLOG_WARNING,
> +                         "mfn %" PRI_mfn " bad domain\n", op.arg1.mfn);

Perhaps also include the domain which was supposedly bad?

> @@ -3458,7 +3493,8 @@ long do_mmuext_op(
>                  rc = -EPERM;
>              else if ( unlikely(!cache_flush_permitted(d)) )
>              {
> -                MEM_LOG("Non-physdev domain tried to FLUSH_CACHE.");
> +                gdprintk(XENLOG_WARNING,
> +                         "Non-physdev domain tried to FLUSH_CACHE\n");
>                  rc = -EACCES;
>              }
>              else
> @@ -3484,7 +3520,8 @@ long do_mmuext_op(
>              }
>              else
>              {
> -                MEM_LOG("Non-physdev domain tried to FLUSH_CACHE_GLOBAL");
> +                gdprintk(XENLOG_WARNING,
> +                         "Non-physdev domain tried to FLUSH_CACHE_GLOBAL\n");
>                  rc = -EINVAL;
>              }
>              break;

I think these could also be dropped (and perhaps a few more right
below here).

> @@ -3734,7 +3779,7 @@ long do_mmu_update(
>  
>          if ( unlikely(__copy_from_guest(&req, ureqs, 1) != 0) )
>          {
> -            MEM_LOG("Bad __copy_from_guest");
> +            gdprintk(XENLOG_WARNING, "Bad __copy_from_guest\n");

And this one.

> @@ -4201,7 +4250,8 @@ static int replace_grant_va_mapping(
>      /* Delete pagetable entry. */
>      if ( unlikely(!UPDATE_ENTRY(l1, pl1e, ol1e, nl1e, gl1mfn, v, 0)) )
>      {
> -        MEM_LOG("Cannot delete PTE entry at %p", (unsigned long *)pl1e);
> +        gdprintk(XENLOG_WARNING,
> +                 "Cannot delete PTE entry at %p\n", (unsigned long *)pl1e);

Please drop the stray cast.

> @@ -4316,7 +4367,7 @@ int replace_grant_host_mapping(
>          if ( !new_addr )
>              return destroy_grant_pte_mapping(addr, frame, curr->domain);
>          
> -        MEM_LOG("Unsupported grant table operation");
> +        gdprintk(XENLOG_WARNING, "Unsupported grant table operation\n");
>          return GNTST_general_error;
>      }

Drop again?

> @@ -4408,10 +4460,11 @@ int donate_page(
>  
>   fail:
>      spin_unlock(&d->page_alloc_lock);
> -    MEM_LOG("Bad donate %lx: ed=%d sd=%d caf=%08lx taf=%" PRtype_info,
> -            page_to_mfn(page), d->domain_id,
> -            owner ? owner->domain_id : DOMID_INVALID,
> -            page->count_info, page->u.inuse.type_info);
> +    gdprintk(XENLOG_WARNING, "Bad donate mfn %" PRI_mfn
> +             ": ed=%d sd=%d caf=%08lx taf=%" PRtype_info "\n",
> +             page_to_mfn(page), d->domain_id,
> +             owner ? owner->domain_id : DOMID_INVALID,
> +             page->count_info, page->u.inuse.type_info);

Why did you not use d%d formatting here?

> @@ -4459,10 +4512,11 @@ int steal_page(
>  
>   fail:
>      spin_unlock(&d->page_alloc_lock);
> -    MEM_LOG("Bad page %lx: ed=%d sd=%d caf=%08lx taf=%" PRtype_info,
> -            page_to_mfn(page), d->domain_id,
> -            owner ? owner->domain_id : DOMID_INVALID,
> -            page->count_info, page->u.inuse.type_info);
> +    gdprintk(XENLOG_WARNING, "Bad mfn %" PRI_mfn
> +             ": ed=%d sd=%d caf=%08lx taf=%" PRtype_info "\n",
> +             page_to_mfn(page), d->domain_id,
> +             owner ? owner->domain_id : DOMID_INVALID,
> +             page->count_info, page->u.inuse.type_info);

Same here.

Is this intended for 4.9?

Jan

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

  reply	other threads:[~2017-03-29 13:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-29 12:29 [PATCH] x86/mm: Drop MEM_LOG() and correct some printed information Andrew Cooper
2017-03-29 13:06 ` Jan Beulich [this message]
2017-03-29 13:50   ` Andrew Cooper
2017-03-29 14:01     ` Jan Beulich
2017-03-29 14:06       ` Andrew Cooper

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=58DBCD7E020000780014A093@prv-mh.provo.novell.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.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 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.