We developed an embedded system using ZYNQ7020 SoC with petalinux 2015-4 as OS, the kernel version is 4.0.0-xilinx. In the system, we use a 4G SanDisk SD card as extra storage. The system runs pretty stable most of time. But occasionally, we got kernel panic issue due to “Unable to handle kernel NULL pointer” problem. With our debugging, the problem happens in the driver of MMC sdhci related. Here are the details.
The dumped original kernel error messages are:
Unable to handle kernel NULL pointer dereference at virtual address 00000008
pgd = dd6a4000
[00000008] *pgd=1d67c831, *pte=00000000, *ppte=00000000
Internal error: Oops - BUG: 17 [#1] PREEMPT SMP ARM
Modules linked in: ipv6
CPU: 0 PID: 915 Comm: bramservice Not tainted 4.0.0-xilinx #47
Hardware name: Xilinx Zynq Platform
task: de517040 ti: dd41a000 task.ti: dd41a000
PC is at sdhci_send_command+0x39c/0x9c8
LR is at sdhci_send_command+0x4a0/0x9c8
pc : [<c0387ae0>] lr : [<c0387be4>] psr: 800d0193
sp : dd41beb8 ip : c001c5d4 fp : 00000001
r10: 161c4000 r9 : 00000000 r8 : 00000000
r7 : df041008 r6 : dd4ec890 r5 : dd4ec8f8 r4 : de5ff300
r3 : 00000002 r2 : 00000003 r1 : 1e7f0600 r0 : 00000000
Flags: Nzcv IRQs off FIQs on Mode SVC_32 ISA ARM Segment user
Control: 18c5387d Table: 1d6a404a DAC: 00000015
Process bramservice (pid: 915, stack limit = 0xdd41a210)
Stack: (0xdd41beb8 to 0xdd41c000)
bea0: 00000001 00000000
bec0: 00000001 00000400 de7f0600 1e7f0600 000005bd 00000000 00000000 de5ff300
bee0: 00000001 00000000 00000001 00000000 c0baa444 00000000 b54acd3c c03887f4
bf00: de5ff418 00000100 00000010 c00444b4 c0baa088 dd41a000 40000005 dd517640
bf20: 00000000 00000093 00000000 de4fa700 00000000 00000000 b54acd3c c00505a4
bf40: dd41a000 de4fa700 de4fa760 dd517640 00000093 de402400 00000000 c0050698
bf60: de4fa700 c0bb83c4 de4fa760 c0052fac 00000093 00000000 c0ba4bd4 c004fda0
bf80: 00000000 c0050064 f8f00100 c0baaf7c dd41bfb0 18c5387d 18c5387d c000860c
bfa0: 000aa2a4 200d0010 ffffffff c0011ac4 00255e58 00000046 00000070 00255e58
bfc0: 00000000 bec26a10 00000000 00000152 b648cf80 00000000 00000000 b54acd3c
bfe0: b644cdd8 b54acd30 000a7bbc 000aa2a4 200d0010 ffffffff ebfffffe ea0000c9
[<c0387ae0>] (sdhci_send_command) from [<c03887f4>] (sdhci_irq+0x23c/0x794)
[<c03887f4>] (sdhci_irq) from [<c00505a4>] (handle_irq_event_percpu+0x28/0xe0)
[<c00505a4>] (handle_irq_event_percpu) from [<c0050698>] (handle_irq_event+0x3c/0x5c)
[<c0050698>] (handle_irq_event) from [<c0052fac>] (handle_fasteoi_irq+0xa4/0x11c)
[<c0052fac>] (handle_fasteoi_irq) from [<c004fda0>] (generic_handle_irq+0x20/0x30)
[<c004fda0>] (generic_handle_irq) from [<c0050064>] (__handle_domain_irq+0x8c/0xb4)
[<c0050064>] (__handle_domain_irq) from [<c000860c>] (gic_handle_irq+0x38/0x5c)
[<c000860c>] (gic_handle_irq) from [<c0011ac4>] (__irq_usr+0x44/0x60)
Exception stack(0xdd41bfb0 to 0xdd41bff8)
bfa0: 00255e58 00000046 00000070 00255e58
bfc0: 00000000 bec26a10 00000000 00000152 b648cf80 00000000 00000000 b54acd3c
bfe0: b644cdd8 b54acd30 000a7bbc 000aa2a4 200d0010 ffffffff
Code: e58d1014 e5943178 e15b0003 aa000042 (e5993008)
---[ end trace ef6ec1f8e3ce8554 ]---
We reverse them via symbol table, and get the call stack as following:
sdhci_adma_table_pre() drivers/mmc/host/sdhci.c:521
sdhci_prepare_data() drivers/mmc/host/sdhci.c:829
sdhci_send_command() drivers/mmc/host/sdhci.c:1049
sdhci_finish_command() drivers/mmc/host/sdhci.c:1113
sdhci_cmd_irq() drivers/mmc/host/sdhci.c:2428
sdhci_irq() drivers/mmc/host/sdhci.c:2638
handle_irq_event_percpu() kernel/irq/handle.c:143
handle_irq_event() kernel/irq/handle.c:192
handle_fasteoi_irq() kernel/irq/chip.c:536
generic_handle_irq_desc() include/linux/irqdesc.h:129
generic_handle_irq() kernel/irq/irqdesc.c:351
__handle_domain_irq() kernel/irq/irqdesc.c:388
handle_domain_irq() include/linux/irqdesc.h:147
gic_handle_irq() drivers/irqchip/irq-gic.c:291
__irq_usr() arch/arm/kernel/entry-armv.S:448
At line 521 of sdhci_adma_table_pre(), sg_dma_len(sg) , but sg is a NULL pointer.
We are using the default sdhci driver code of the kernel, and never made any changes on SD Controller and the driver part. So, we are confused how the problem could happen. Is it a problem caused by the SD card, or is there any known issues in that version of kernel/driver? Any suggestions will be much appreciated.
Related
I'm trying to build ruby 2.7.0 from source but I get some errors with openssl/libressl after doing make:
compiling ossl_ocsp.c
ossl_ocsp.c:1096:38: error: incomplete definition of type 'struct ocsp_basic_response_st'
sk_X509_num(x509s) && sk_X509_num(bs->certs)) {
~~^
/usr/include/openssl/safestack.h:1505:43: note: expanded from macro 'sk_X509_num'
#define sk_X509_num(st) SKM_sk_num(X509, (st))
^~
/usr/include/openssl/safestack.h:144:32: note: expanded from macro 'SKM_sk_num'
sk_num(CHECKED_STACK_OF(type, st))
^~
/usr/include/openssl/safestack.h:72:21: note: expanded from macro 'CHECKED_STACK_OF'
((_STACK*) (1 ? p : (STACK_OF(type)*)0))
^
/usr/include/openssl/ocsp.h:160:16: note: forward declaration of 'struct ocsp_basic_response_st'
typedef struct ocsp_basic_response_st OCSP_BASICRESP;
^
1 error generated.
*** Error 1 in ext/openssl (Makefile:313 'ossl_ocsp.o': # cc -I.
-I../../.ext/include/x86_64-openbsd7.1 -I../.././include
-I../.././ext/open...)
*** Error 2 in . (exts.mk:250 'ext/openssl/all': #cd ext/openssl
&& exec make UPDATE_LIBRARIES=no EXTENCS=dmyenc.o
libdir=/home/computer/.rub...)
*** Error 2 in /home/computer/ruby27/ruby-2.7.0 (Makefile:984
'build-ext': #make -f exts.mk
libdir="/home/computer/.rubies/2.7.0/lib" LIBRUBY_E...)
$ openssl version
LibreSSL 3.5.2
If you have any idea thank you :)
Im kinda stuck on some work. To find the the cpi i would need to multiply the percentage of instructions with the clock cycle but what is shown is avg stall cycles. I don't really understand how to approach this problem. Any help would be appreciated.
A computer with a 5 stage pipeline is measured and has the following characteristics
Instruction Type % of instructions. Avg. stall cycles/instructions
Branches .3 .7
Loads & Stores .2 .2
ALU ops .4 0
Other .1 .2
a) what is the average CPI for the computer?
b) What is the speedup for this machine?
In your last comment, you have the correct weighted average of stall cycles per instruction. But you need the total cycles per instruction presumably.
As for speedup, it's unclear what your baseline is.
I use InnerActive as my default Ad provide for my Windows Phone apps. I being using it since June 2013 and on my end of year analysis I realized InnerActive ads are my main source of my app crashes. The worst part is, it's code don't I don't have any control over. I already placed a "try catch" around every operation that requests Inneractive Ads.
Does anyone have any idea how can I resolve this issue?
Where is the code I use to request the Ads:
private void LoadInnerActiveAds()
{
try
{
if (DeviceNetworkInformation.IsNetworkAvailable)
{
// Watch location
if (_allowAdLocationTracker)
{
IaLocationClass iaLocation = new IaLocationClass();
iaLocation.Done += new EventHandler<IaLocationEventArgs>(InnerActiveLocation_Done);
iaLocation.StartWatchLocation();
}
optionalParams = new Dictionary<InneractiveAd.IaOptionalParams, string>();
//optionalParams.Add(InneractiveAd.IaOptionalParams.Key_Gender, "m");
optionalParams.Add(InneractiveAd.IaOptionalParams.Key_Ad_Alignment, InneractiveAd.IaAdAlignment.CENTER.ToString());
optionalParams.Add(InneractiveAd.IaOptionalParams.Key_OptionalAdWidth, "480");
optionalParams.Add(InneractiveAd.IaOptionalParams.Key_OptionalAdHeight, "80");
}
//Show Add Banner. Remarks: pay attention to use Application Id from NAX
//naxAd.Childred.Count()==0 => just to add one banner control on a page. Without this, code would add as many banners as you navigate to page where banner is placed
if (optionalParams != null && AdsUIContainer.Children.Count == 0)
{
InneractiveAd iaBanner = new InneractiveAd(AdsAppId, InneractiveAd.IaAdType.IaAdType_Banner, 30, optionalParams);
iaBanner.AdFailed += new InneractiveAd.IaAdFailed(InneractiveAd_AdFailed);
Deployment.Current.Dispatcher.BeginInvoke(() => { UpdateUI(iaBanner); });
}
}
catch (Exception ex)
{
InneractiveAd_AdFailed(ex);
}
}
This stacktrace might help, but keep in mind this is code I don't control.
Frame Image Function Offset
0 system_xml_ni System.Xml.XmlTextReaderImpl.Throw 0x00000036
1 system_xml_ni System.Xml.XmlTextReaderImpl.ParseDocumentContent 0x00000438
2 system_xml_ni System.Xml.XmlTextReaderImpl.Read 0x00000036
3 system_xml_ni System.Xml.XmlReader.ReadToFollowing 0x0000003c
4 inneractive_ad_ni Inneractive.Ad.InneractiveAdControl.ParseCPDXml 0x0000007c
5 inneractive_ad_ni Inneractive.Ad.InneractiveAdControl.webClient_UploadStringCompleted 0x000000aa
6 system_net_ni System.Net.WebClient.OnUploadStringCompleted 0x00000010
7 system_net_ni System.Net.WebClient.UploadStringOperationCompleted 0x00000034
Solution:
Following Soonts suggestion, this is what I came up with:
In App.xaml.cs file locate "Application_UnhandledException" method and replace it with:
// Code to execute on Unhandled Exceptions
private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
{
if (e.ExceptionObject.StackTrace.Contains("Inneractive.Ad.InneractiveAdControl"))
{
// Recover from the error
e.Handled = true;
return;
}
if (Debugger.IsAttached)
{
// An unhandled exception has occurred; break into the debugger
Debugger.Break();
}
}
Please let me know if you find better alternatives.
First, contact InnerActive telling them to fix their software. It's their responsibility.
Meanwhile, if you know how to reproduce the problem, you can try following. Subscribe for all unhandled exceptions (start with Application.UnhandledException, also there're AppDomain.UnhandledException and TaskScheduler.UnobservedTaskException), in the handler search for “Inneractive.Ad.InneractiveAdControl” in the Exception.StackTrace, if found — ignore the exception, and optionally hide or reload the inneractive banner.
I try to solve a problem for a few weeks, but I don't find answer.
I try to get that the last frame freeze when the animation ends.
This is my animation code:
-(IBAction)play {
image.animationImages = [NSArray arrayWithObjects:
[UIImage imageNamed:#"1.png"],
[UIImage imageNamed:#"2.png"],
[UIImage imageNamed:#"3.png"],
[UIImage imageNamed:#"4.png"],
[UIImage imageNamed:#"5.png"],
[UIImage imageNamed:#"6.png"],
[UIImage imageNamed:#"7.png"],
[UIImage imageNamed:#"8.png"],
[UIImage imageNamed:#"9.png"],
[UIImage imageNamed:#"10.png"],
[UIImage imageNamed:#"11.png"],
[UIImage imageNamed:#"12.png"],
[UIImage imageNamed:#"13.png"],nil];
[image setAnimationRepeatCount: 1];
image.animationDuration = 0.5;
[image startAnimating];
}
-(IBAction)stop{
[image stopAnimating];
}
When I press the button play, the animation runs and when I press button stop, the animation stop and disapear the image.
I like do this thing without stop button, when the animation end, the last frame is visible.
Thank you for the help.
I don't know if it is the easiest way to do it, but it works. Here you are:
- (IBAction)stop {
CGSize screenSize = [[UIScreen mainScreen] applicationFrame].size;
CGContextRef context = CGBitmapContextCreate(nil, screenSize.width, screenSize.height, 8, 4 * (int)screenSize.width, CGColorSpaceCreateDeviceRGB(), kCGImageAlphaPremultipliedLast);
CGBitmapContextCreateImage(context);
CGContextTranslateCTM(context, 0.0, screenSize.height);
CGContextScaleCTM(context, 1.0, -1.0);
[(CALayer*)self.layer renderInContext:context];
CGImageRef cgImage = CGBitmapContextCreateImage(context);
UIImage *lastFrame = [[UIImage alloc] initWithCGImage:cgImage];
CGImageRelease(cgImage);
CGContextRelease(context);
image.image = lastFrame;
[lastFrame release];
}
What if you just do:
-(IBAction)stop {
[image stopAnimating];
image.image = [image.animationImages objectAtIndex:12]; //or 0 to jump to the first image
}
Worked for me:)
If i have a # {} , like #{results}, in the snippet below:
results = Array.new
f = open("/Users/kahmed/messages", "r")
f.each_line do |line|
results << "#{$.} #{line}" if line =~ /NFE/
puts #{results}
end
How can i use it in the following ssh.exec command
Net::SSH.start( HOST, USER, :password => PASS ) do|ssh|
ssh.exec(#{results})
Something like:
Net::SSH.start( HOST, USER, :password => PASS ) do|ssh|
results.each{|line| ssh.exec( line)}
end