From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Message-ID: <56E2AE87.4060209@arm.com> Date: Fri, 11 Mar 2016 11:39:51 +0000 From: James Morse MIME-Version: 1.0 Subject: Re: [PATCH v14 14/20] arm64/kexec: Add pr_debug output References: In-Reply-To: List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "kexec" Errors-To: kexec-bounces+dwmw2=infradead.org@lists.infradead.org To: Geoff Levand Cc: Mark Rutland , marc.zyngier@arm.com, Catalin Marinas , Will Deacon , AKASHI Takahiro , kexec@lists.infradead.org, linux-arm-kernel@lists.infradead.org Hi Geoff, On 04/03/16 23:51, Geoff Levand wrote: > To aid in debugging kexec problems or when adding new functionality to kexec add > a new routine kexec_image_info() and several inline pr_debug statements. > > Signed-off-by: Geoff Levand [ ... snip ...] > +/** > + * kexec_image_info - For debugging output. > + */ > +#define kexec_image_info(_i) _kexec_image_info(__func__, __LINE__, _i) > +static void _kexec_image_info(const char *func, int line, > + const struct kimage *kimage) > +{ > + unsigned long i; > + > +#ifndef DEBUG > + return; > +#endif >From include/linux/printk.h on pr_foo(): > * All of these will print unconditionally, although note that pr_debug() > * and other debug macros are compiled out unless either DEBUG is defined So you can remove the #ifdef ... return, as all the pr_debug() calls will be removed by the compiler in this case. (which also explains why it doesn't complain about unreachable code!) > + pr_debug("%s:%d:\n", func, line); > + pr_debug(" kexec kimage info:\n"); > + pr_debug(" type: %d\n", kimage->type); > + pr_debug(" start: %lx\n", kimage->start); > + pr_debug(" head: %lx\n", kimage->head); > + pr_debug(" nr_segments: %lu\n", kimage->nr_segments); > + > + for (i = 0; i < kimage->nr_segments; i++) { > + pr_debug(" segment[%lu]: %016lx - %016lx, 0x%lx bytes, %lu pages%s\n", > + i, > + kimage->segment[i].mem, > + kimage->segment[i].mem + kimage->segment[i].memsz, > + kimage->segment[i].memsz, > + kimage->segment[i].memsz / PAGE_SIZE, > + (kexec_is_dtb(kimage->segment[i].buf) ? > + ", dtb segment" : "")); > + } > +} > + > void machine_kexec_cleanup(struct kimage *kimage) > { > /* Empty routine needed to avoid build errors. */ Thanks, James _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec