Re: Darwin-kernel Digest, Vol 4, Issue 155
Re: Darwin-kernel Digest, Vol 4, Issue 155
- Subject: Re: Darwin-kernel Digest, Vol 4, Issue 155
- From: "BEURET Stéphane" <email@hidden>
- Date: Thu, 19 Jul 2007 21:20:10 +0200
About DTrace in Leopard,
Sun tells me there is a GUI version of DTrace in Lepoard. I suppose if there is a GUI version, there is a CLI version:)
BUT
It's just a rumor, as zfs for the root disk and so on. Normally you can trust me, but things mau be change since Leopard comes...
On 7/19/07, email@hidden <
email@hidden> wrote:Send Darwin-kernel mailing list submissions to
email@hidden
To subscribe or unsubscribe via the World Wide Web, visit
http://lists.apple.com/mailman/listinfo/darwin-kernel
or, via email, send a message with subject or body 'help' to
email@hidden
You can reach the person managing the list at
email@hidden
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Darwin-kernel digest..."
Today's Topics:
1. Re: Kernel Panic while trying to access the datastructure
parameter in ioctl call. (Herb Petschauer)
2. Re: Kernel Panic while trying to access the datastructure
parameter in ioctl call. (Terry Lambert)
3. Speed enhancement for bulk devices. (rohit dhamija)
4. Kernel Debugging Help (Arvind Dalvi)
5. Re: Kernel Debugging Help (Quinn)
6. Re: Kernel Debugging Help (Arvind Dalvi)
7. DTrace in Leopard (Arvind Dalvi)
8. Communication between NKE and IOKit driver (Rakesh Singhal)
9. Re: Communication between NKE and IOKit driver (Josh Graessley)
10. Re: Speed enhancement for bulk devices. (Garth Cummings)
11. Re: Debugging in kernel (billy lau)
----------------------------------------------------------------------
Message: 1
Date: Wed, 18 Jul 2007 12:12:05 -0700
From: "Herb Petschauer" <
email@hidden>
Subject: Re: Kernel Panic while trying to access the datastructure
parameter in ioctl call.
To: JanakiRam <
email@hidden>
Cc: email@hidden
Message-ID:
<
email@hidden>
Content-Type: text/plain; charset="iso-8859-1"
Quick look only...
What's the value of ctl->bytes? Are you logging it? Log some values for a
sanity check. Make sure you don't perform the copyin() unless ctl->bytes <=
2048 (preferably a constant not a magic number). Also, try allocating
"data" using IOMalloc() (don't forget to free it).
-H.
On 18/07/07, JanakiRam <email@hidden> wrote:
>
> Hi ALL,
>
> I'm doing maintainance of one application which has user
> space daemon and kernel extension.
>
> The User daemon sends the command to kernel extension using
> ioctl command. I've a application specific structure which is being
> passed as a parameter.
>
> This structure object is available in kernel extension in ioctl
> function pointer registered in kext start function.
>
> My Custom Structure looks like this.
>
> typedef struct {
> /* input */
> long version;
> long b;
> long c;
> long d;
> long e;
> long f;
> long g;
> long bytes;
> char * dptr; /* points to the data field */
> long filler[4];
> } IOCTL_Struct_t;
>
>
> The problem is the kernel panic is comming up when i try to access
> the data in kernel function.
>
>
> int ioctl_functionpointer(dev_t dev, u_long cmd, caddr_t arg,int
> fflag, struct proc *p)
> {
>
>
> IOCTL_Struct_t*ctl = (PF_Ctl_t*)arg;
> char data[2048];
>
>
> if (!ctl) {
>
> return -1;
> }
>
> if ((ctl->dptr) ) {
>
>
> int res = copyin((void *)ctl->dptr, (void *)data,
> ctl->bytes);
> if (res != 0)
> printf ("error in copyin");
> }
> return 0;
>
> }
>
>
> If i comment the line copyin function call , then its working
> fine.
>
> I've tried to use the copyinstr instead of copyin , then also
> its showing panic screen.
>
> Please help me to solve this.
>
>
> Thanks in Advance.
>
> -JanakiRam.
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Darwin-kernel mailing list (
>
> This email sent to email@hidden
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://lists.apple.com/mailman/private/darwin-kernel/attachments/20070718/5231a76b/attachment.html
------------------------------
Message: 2
Date: Wed, 18 Jul 2007 12:38:36 -0700
From: Terry Lambert <
email@hidden>
Subject: Re: Kernel Panic while trying to access the datastructure
parameter in ioctl call.
To: JanakiRam <
email@hidden>
Cc: email@hidden
Message-ID: <email@hidden
>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
I answered this in detail on the darwin-dev list. Please do not cross-
post your requests to multiple mailing lists, or people will ignore you.
-- Terry
On Jul 18, 2007, at 11:44 AM, JanakiRam wrote:
> Hi ALL,
>
> I'm doing maintainance of one application which has user
> space daemon and kernel extension.
>
> The User daemon sends the command to kernel extension using
> ioctl command. I've a application specific structure which is being
> passed as a parameter.
>
> This structure object is available in kernel extension in ioctl
> function pointer registered in kext start function.
>
> My Custom Structure looks like this.
>
> typedef struct {
> /* input */
> long version;
> long b;
> long c;
> long d;
> long e;
> long f;
> long g;
> long bytes;
> char * dptr; /* points to the data field */
> long filler[4];
> } IOCTL_Struct_t;
>
>
> The problem is the kernel panic is comming up when i try to access
> the data in kernel function.
>
>
> int ioctl_functionpointer(dev_t dev, u_long cmd, caddr_t arg,int
> fflag, struct proc *p)
> {
>
>
> IOCTL_Struct_t*ctl = (PF_Ctl_t*)arg;
> char data[2048];
>
>
> if (!ctl) {
>
> return -1;
> }
>
> if ((ctl->dptr) ) {
>
>
> int res = copyin((void *)ctl->dptr, (void *)data, ctl-
> >bytes);
> if (res != 0)
> printf ("error in copyin");
> }
> return 0;
>
> }
>
>
> If i comment the line copyin function call , then its working
> fine.
>
> I've tried to use the copyinstr instead of copyin , then also
> its showing panic screen.
>
> Please help me to solve this.
>
>
> Thanks in Advance.
>
> -JanakiRam.
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
Message: 3
Date: Thu, 19 Jul 2007 09:14:49 +0530
From: "rohit dhamija" <email@hidden>
Subject: Speed enhancement for bulk devices.
To: "Darwin Kernel" <
email@hidden>
Message-ID:
<email@hidden
>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Dear All,
Sorry for the repost, but i didnot get any replies from USB list forum.
My USB device is of bulk type having two endpoints.
I need to send buffer continously to my USB bulk device , each buffer
having size around 1.5 MB. As per the protocol decided with the
device, I send 40KB of data and then read a single byte data from the
device.
I have developed the kernel extension module for my device
successfully, but finding major concern in bandwidth i.e. number of
bytes transferred per second.
I am a NO expert in this field , so please all suggestions are most welcome!!
Below are my queries:
a) I am achieving around 8 MB/s of data transfer speed (checked it
with USB Analyzer), whereas the same device when run on Windows /
Linux machines gives bandwidth of more than 20 MB/s. The device is a
High speed one. What can be the reason for such huge difference? Is
macintosh USB host controller slow? Please comment.
b) I am getting different bandwidth speeds on different Macintosh
systems. For example on intel mac-mini the bandwidth achieved is
6MB/s, where as on IntelXeon Mac pro it is 10MB/s. I know that lots
depend on CPU speed. But can we apply some ways to achieve almost same
bandwidth for different machine configurations? For example can we
have DMA engine access directly to pass the memory descriptor ???
Please suggest.
c) I am mapping my 1.5 MB of data in a shared memory. Then perform
logical operations and finally pass the data to following code for
writing to my device. Is there any way to make this code more
efficient ? OR if we can add something to improve on the speed?
d) How can we check if something is going fishy under the client driver?
UInt16 myBulkDevice::WritingIntoPipe(unsigned char *memory, unsigned int pktlen)
{
IOReturn status = kIOReturnNoDevice;
IOMemoryDescriptor *memDescOut = NULL;
if( (pDevice)->isInactive())
return kIOReturnNoDevice;
if(!(pDevice)->isOpen())
return kIOReturnNoDevice;
if(!intf)
return kIOReturnNoDevice;
if( (intf)->isInactive())
return kIOReturnNoDevice;
if(!(intf)->isOpen())
return kIOReturnNoDevice;
memDescOut = IOMemoryDescriptor::withAddress( (void *)memory,
pktlen, kIODirectionOut);
if ( memDescOut == NULL )
return kIOReturnNoResources;
if(!(fOutPipe))
{
status = kIOReturnNoResources;
if(memDescOut)
{
memDescOut->release();
memDescOut = NULL;
}
return (status);
}
status = memDescOut->prepare(memDescOut->getDirection());
if(status != kIOReturnSuccess){
if(memDescOut)
{
memDescOut->release();
memDescOut = NULL;
}
return (status);
}
if((intf)->isInactive()){
status = kIOReturnError;
}
else{
status = (fOutPipe)->Write(
memDescOut,(UInt32)1,(UInt32)1,pktlen,(IOUSBCompletion*)NULL
);
}
memDescOut->complete(memDescOut->getDirection());
if(memDescOut)
{
memDescOut->release();
memDescOut = NULL;
}
return (status);
}
Please let me know incase of any clarification in this regard.
Thanks and Regards,
rohit
--
Rohit Dhamija(M) 9818446545
------------------------------
Message: 4
Date: Thu, 19 Jul 2007 09:29:19 +0100
From: "Arvind Dalvi" <
email@hidden>
Subject: Kernel Debugging Help
To: email@hidden
Message-ID:
<email@hidden>
Content-Type: text/plain; charset="iso-8859-1"
Hello Folks,
Being new to Apple Mac OS X Kernel debugging, i would appreciate if i could
be guided on the hardware & the software front.
If i need to debug a MacBook (x86) from MacMini (x86) and vice-versa, what
hardware options are available ?
a. FireWire : Any specific make-model or pin layout cable ? On the Apple
store, i found few FireWire cables (4-to-6 pin, 6-to-6 pin)
b. USB : Is this option available ?
c. Ethernet : I hope a standard cross-cable should work...correct ?
On the software front, i hope the Apple documentation should help, but few
tips from the experts should help me kick-start earlier...:)
Do i need specific kernel versions to exist on both end ? And how about the
Kernel Debug Kit ?
I read somewhere on the mailing list, that the kernel version shipped with
the Apple Mac has a little version difference to adjust to different
hardware....than compared to the open-source version available on the Apple
site.
Thanks,
Arvind
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://lists.apple.com/mailman/private/darwin-kernel/attachments/20070719/ca32fa11/attachment.html
------------------------------
Message: 5
Date: Thu, 19 Jul 2007 09:56:57 +0100
From: Quinn <
email@hidden>
Subject: Re: Kernel Debugging Help
To: email@hidden
Message-ID: <p06240806c2c4d61e623a@[
10.0.40.15]>
Content-Type: text/plain; charset="us-ascii" ; format="flowed"
At 9:29 +0100 19/7/07, Arvind Dalvi wrote:
>a. FireWire : Any specific make-model or pin layout cable ? On the
>Apple store, i found few FireWire cables (4-to-6 pin, 6-to-6 pin)
6-to-6
>b. USB : Is this option available ?
No.
>c. Ethernet : I hope a standard cross-cable should work...correct ?
Either cross over or straight cables will work. All modern Macs have
autosensing Ethernet PHYs.
>Do i need specific kernel versions to exist on both end ?
No. The kernel on the debugging machine is irrelevant.
>And how about the Kernel Debug Kit ?
You should get the KDK that matches the system software on the target
machine. It's best if you update the target machine to the latest
system software (that is,
10.4.10) and use the KDK for that.
Sometimes the system software that's HappyMac'd at the factory is a
little weird (-:
>I read somewhere on the mailing list, that the kernel version
>shipped with the Apple Mac has a little version difference to adjust
>to different hardware....
Yes. See my comment above.
>than compared to the open-source version available on the Apple site.
Yes, there is a difference between the source used to build Mac OS X
kernels and the Darwin source. However, the changes a very small and
it is generally the case that you can build a kernel from the Darwin
source, slide it under a full Mac OS X, and everything will work just
fine. Folks do this every day.
S+E
--
Quinn "The Eskimo!" <http://www.apple.com/developer/>
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
------------------------------
Message: 6
Date: Thu, 19 Jul 2007 11:08:58 +0100
From: "Arvind Dalvi" <email@hidden
>
Subject: Re: Kernel Debugging Help
To: Quinn <email@hidden>
Cc: email@hidden
Message-ID:
<email@hidden>
Content-Type: text/plain; charset="iso-8859-1"
Thanks Quinn....
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.apple.com/mailman/private/darwin-kernel/attachments/20070719/1f30b4d8/attachment.html
------------------------------
Message: 7
Date: Thu, 19 Jul 2007 12:57:56 +0100
From: "Arvind Dalvi" <email@hidden
>
Subject: DTrace in Leopard
To: email@hidden
Message-ID:
<
email@hidden>
Content-Type: text/plain; charset="iso-8859-1"
Hello,
I am not sure my query can be answered due to Apple N.D.A......Also have not
seen folks jumping on DTrace...And hence....
Do we have a full functional DTrace system in Leopard Early Start Kit ?
Thanks,
Arvind
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.apple.com/mailman/private/darwin-kernel/attachments/20070719/f66d7258/attachment.html
------------------------------
Message: 8
Date: Thu, 19 Jul 2007 18:54:25 +0530
From: "Rakesh Singhal" <email@hidden>
Subject: Communication between NKE and IOKit driver
To: email@hidden
Message-ID:
<email@hidden
>
Content-Type: text/plain; charset="iso-8859-1"
Hi all
I developed an IOkit driver(myiokit.kext) and an NKE(mynke.kext). The NKE is
included in OSBundleLibraries in info.plist of IOkit driver (For dependency
of IOKit driver on NKE). I put mynke.kext also in System/Library/Extensions
folder. When I load the myiokit.kext and it loads mynke.kext also and calls
start routine. Till now I dont have any issue.
Now I want to communicate between mynke and myiokit. I defined a function in
mynke and trying to call it from myiokit but I am getting following problem:
kextload -t /temp/myiokit.kext/
kextload: extension /temp/myiokit.kext/ appears to be valid
kld(): Undefined symbols:
__ZN5myiokit11mynke_functionEv
kextload: kld_load_from_memory() failed for module
/temp/myiokit.kext/Contents/MacOS/myiokit
kextload: a link/load error occured for kernel extension /temp/myiokit.kext/
load failed for extension /temp/myiokit.kext/
I used nm utility also.
nm -m /temp/myiokit.kext/Contents/MacOS/myiokit | grep mynke_function
(undefined) external __ZN5myiokit11mynke_functionEv
nm -m /temp2/mynke.kext/Contents/MacOS/aoenke | grep mynke_function
00000a36 (__TEXT,__text) external _mynke_function
Can anyone suggest me how to solve this issue...
Thanks in advance.
Best regards
Rakesh Singhal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.apple.com/mailman/private/darwin-kernel/attachments/20070719/2bddd37f/attachment.html
------------------------------
Message: 9
Date: Thu, 19 Jul 2007 09:10:06 -0700
From: Josh Graessley <email@hidden>
Subject: Re: Communication between NKE and IOKit driver
To: Rakesh Singhal <email@hidden>
Cc: email@hidden
Message-ID: <
email@hidden>
Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
I think you need to wrap the declaration of mynke_function in extern "C"
-josh
On Jul 19, 2007, at 6:24 AM, Rakesh Singhal wrote:
> Hi all
>
> I developed an IOkit driver(myiokit.kext) and an NKE(mynke.kext).
> The NKE is included in OSBundleLibraries in
info.plist of IOkit
> driver (For dependency of IOKit driver on NKE). I put mynke.kext
> also in System/Library/Extensions folder. When I load the
> myiokit.kext and it loads mynke.kext also and calls start routine.
> Till now I dont have any issue.
>
> Now I want to communicate between mynke and myiokit. I defined a
> function in mynke and trying to call it from myiokit but I am
> getting following problem:
>
> kextload -t /temp/myiokit.kext/
> kextload: extension /temp/myiokit.kext/ appears to be valid
> kld(): Undefined symbols:
> __ZN5myiokit11mynke_functionEv
> kextload: kld_load_from_memory() failed for module /temp/
> myiokit.kext/Contents/MacOS/myiokit
> kextload: a link/load error occured for kernel extension /temp/
> myiokit.kext/
> load failed for extension /temp/myiokit.kext/
>
> I used nm utility also.
>
> nm -m /temp/myiokit.kext/Contents/MacOS/myiokit | grep mynke_function
> (undefined) external __ZN5myiokit11mynke_functionEv
> nm -m /temp2/mynke.kext/Contents/MacOS/aoenke | grep mynke_function
> 00000a36 (__TEXT,__text) external _mynke_function
>
> Can anyone suggest me how to solve this issue...
>
> Thanks in advance.
>
> Best regards
> Rakesh Singhal
>
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Darwin-kernel mailing list (
> 40apple.com
>
> This email sent to email@hidden
------------------------------
Message: 10
Date: Thu, 19 Jul 2007 10:40:21 -0700
From: Garth Cummings <email@hidden>
Subject: Re: Speed enhancement for bulk devices.
To: rohit dhamija <
email@hidden>
Cc: Darwin Kernel <email@hidden>
Message-ID: <
email@hidden>
Content-Type: text/plain; charset="us-ascii"
Hi Rohit,
On Jul 18, 2007, at 8:44 PM, rohit dhamija wrote:
> Sorry for the repost, but i didnot get any replies from USB list
> forum.
That usually means your problem is too complex to be solved on a
mailing list. Sometimes it means that answering the question would
basically mean writing a tutorial via email and few people have time
to do that.
You should consider submitting a DTS incident if you really need the
problem addressed. Take a look at the URL in my email signature for
more info about DTS.
--gc
____________________________________________________________________
Garth Cummings email@hidden
Sr. Software Engineer
Apple Developer Technical Support
<
http://developer.apple.com/technicalsupport>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://lists.apple.com/mailman/private/darwin-kernel/attachments/20070719/8a50d947/attachment.html
------------------------------
Message: 11
Date: Thu, 19 Jul 2007 13:57:26 -0500
From: "billy lau" <
email@hidden>
Subject: Re: Debugging in kernel
To: Greg <email@hidden>
Cc:
email@hidden
Message-ID:
<email@hidden>
Content-Type: text/plain; charset="iso-8859-1"
Hi,
Does anyone know why is it that not everything that displays to the console
during startup being logged into the /var/log/system.log?
And so, is there an option to log every output that goes to the console to
any files? Or am I not looking at the right log file?
Also, could anyone help by offering any strategies to tackle the situation
where the machine actually restarts before the bootphase of kernel (in the
boot.efi)? Right now, after doing some modification to the kernel, as I boot
the new kernel, the machine just restarted itself before I can see any
printouts from the kernel_bootstrap functions. Is there a way to tell
exactly what went wrong without the usage of a second machine?
- thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://lists.apple.com/mailman/private/darwin-kernel/attachments/20070719/b10062aa/attachment.html
------------------------------
_______________________________________________
Darwin-kernel mailing list
email@hidden
http://lists.apple.com/mailman/listinfo/darwin-kernel
End of Darwin-kernel Digest, Vol 4, Issue 155
*********************************************
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden