* [kvm-unit-tests PATCH] alloc: only warn once if we run out of log entries
@ 2015-07-24 12:07 Andrew Jones
2015-07-29 13:52 ` Paolo Bonzini
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Jones @ 2015-07-24 12:07 UTC (permalink / raw)
To: kvm; +Cc: pbonzini
Signed-off-by: Andrew Jones <drjones@redhat.com>
---
lib/alloc.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/lib/alloc.c b/lib/alloc.c
index 1abe4961ae9dd..fc85d5952c91c 100644
--- a/lib/alloc.c
+++ b/lib/alloc.c
@@ -44,6 +44,7 @@ void phys_alloc_init(phys_addr_t base_addr, phys_addr_t size)
base = base_addr;
top = base + size;
align_min = DEFAULT_MINIMUM_ALIGNMENT;
+ nr_regions = 0;
spin_unlock(&lock);
}
@@ -58,6 +59,7 @@ void phys_alloc_set_minimum_alignment(phys_addr_t align)
static phys_addr_t phys_alloc_aligned_safe(phys_addr_t size,
phys_addr_t align, bool safe)
{
+ static bool not_warned = true;
phys_addr_t addr, size_orig = size;
u64 top_safe = top;
@@ -72,9 +74,9 @@ static phys_addr_t phys_alloc_aligned_safe(phys_addr_t size,
size += addr - base;
if ((top_safe - base) < size) {
- printf("%s: requested=0x%llx (align=0x%llx), "
+ printf("phys_alloc: requested=0x%llx (align=0x%llx), "
"need=0x%llx, but free=0x%llx. "
- "top=0x%llx, top_safe=0x%llx\n", __func__,
+ "top=0x%llx, top_safe=0x%llx\n",
size_orig, align, size, top_safe - base,
top, top_safe);
spin_unlock(&lock);
@@ -87,9 +89,10 @@ static phys_addr_t phys_alloc_aligned_safe(phys_addr_t size,
regions[nr_regions].base = addr;
regions[nr_regions].size = size_orig;
++nr_regions;
- } else {
- printf("%s: WARNING: no free log entries, "
- "can't log allocation...\n", __func__);
+ } else if (not_warned) {
+ printf("WARNING: phys_alloc: No free log entries, "
+ "can no longer log allocations...\n");
+ not_warned = false;
}
spin_unlock(&lock);
--
2.4.3
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [kvm-unit-tests PATCH] alloc: only warn once if we run out of log entries
2015-07-24 12:07 [kvm-unit-tests PATCH] alloc: only warn once if we run out of log entries Andrew Jones
@ 2015-07-29 13:52 ` Paolo Bonzini
2015-07-29 14:16 ` Andrew Jones
0 siblings, 1 reply; 3+ messages in thread
From: Paolo Bonzini @ 2015-07-29 13:52 UTC (permalink / raw)
To: Andrew Jones, kvm
On 24/07/2015 14:07, Andrew Jones wrote:
> @@ -58,6 +59,7 @@ void phys_alloc_set_minimum_alignment(phys_addr_t align)
> static phys_addr_t phys_alloc_aligned_safe(phys_addr_t size,
> phys_addr_t align, bool safe)
> {
> + static bool not_warned = true;
I wouldn't object to not having "not" in the name of this variable. :)
Otherwise looks okay.
Paolo
> phys_addr_t addr, size_orig = size;
> u64 top_safe = top;
>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [kvm-unit-tests PATCH] alloc: only warn once if we run out of log entries
2015-07-29 13:52 ` Paolo Bonzini
@ 2015-07-29 14:16 ` Andrew Jones
0 siblings, 0 replies; 3+ messages in thread
From: Andrew Jones @ 2015-07-29 14:16 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: kvm
On Wed, Jul 29, 2015 at 03:52:51PM +0200, Paolo Bonzini wrote:
>
>
> On 24/07/2015 14:07, Andrew Jones wrote:
> > @@ -58,6 +59,7 @@ void phys_alloc_set_minimum_alignment(phys_addr_t align)
> > static phys_addr_t phys_alloc_aligned_safe(phys_addr_t size,
> > phys_addr_t align, bool safe)
> > {
> > + static bool not_warned = true;
>
> I wouldn't object to not having "not" in the name of this variable. :)
yeah, actually I don't like the not in there either, now that you mention
it. v2 coming.
Thanks,
drew
>
> Otherwise looks okay.
>
> Paolo
>
> > phys_addr_t addr, size_orig = size;
> > u64 top_safe = top;
> >
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-07-29 14:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-24 12:07 [kvm-unit-tests PATCH] alloc: only warn once if we run out of log entries Andrew Jones
2015-07-29 13:52 ` Paolo Bonzini
2015-07-29 14:16 ` Andrew Jones
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.