From owner-freebsd-drivers@FreeBSD.ORG Sun Jul 21 02:05:20 2013 Return-Path: Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id F0E63C24; Sun, 21 Jul 2013 02:05:19 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-we0-x233.google.com (mail-we0-x233.google.com [IPv6:2a00:1450:400c:c03::233]) by mx1.freebsd.org (Postfix) with ESMTP id 396AFCA7; Sun, 21 Jul 2013 02:05:19 +0000 (UTC) Received: by mail-we0-f179.google.com with SMTP id t57so216665wes.24 for ; Sat, 20 Jul 2013 19:05:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=yfiPGAAMhhprUKeCqT5akxlEnQHgAJzS/gznEUOvkns=; b=B1kcOBUFfiI6MABXNxICPc0OMj5YtMDshB+eSiRtWzQ75vXUo1PCArO9JxntaXqV+M zJLviNOQA5GGzqFckAWHz6C9BsJBIj1QZ51urZhoXqxWv8IkHh+YK7tvgWoB7ZMzacZm 4R9d2M6Q7tDknO6NAuiInPdUy2QjdRIqtfzovyotSNT09BPMy7nlztkOkbwXewjNlEzC ichBoNsUH07HzZHM3tTgnBSkL+nvzn+TjdkrttUoh2+Hk1jYk22IlUt4twv7ya7YoMAq j7G6pZGqjhc600o4eUBB1QRtHO063KaJtzQ1U7AULPJrjO7q12Smo/UumkYx0QStbQsc ANqA== MIME-Version: 1.0 X-Received: by 10.194.11.72 with SMTP id o8mr16036672wjb.0.1374372318365; Sat, 20 Jul 2013 19:05:18 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.217.94.132 with HTTP; Sat, 20 Jul 2013 19:05:18 -0700 (PDT) In-Reply-To: <001901ce85a2$de9b29f0$9bd17dd0$@info> References: <006a01ce8553$f81d4290$e857c7b0$@info> <007e01ce855e$11ae78f0$350b6ad0$@info> <008101ce8561$5c618560$15249020$@info> <000001ce859b$e50b9650$af22c2f0$@info> <001901ce85a2$de9b29f0$9bd17dd0$@info> Date: Sat, 20 Jul 2013 19:05:18 -0700 X-Google-Sender-Auth: IXIbuZ4fA8H5WSkRaOlzFLTliHE Message-ID: Subject: Re: IWN Review From: Adrian Chadd To: Cedric GROSS Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Cc: Adrian Chadd , "freebsd-wireless@freebsd.org" , "freebsd-drivers@freebsd.org" X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Jul 2013 02:05:20 -0000 I saw, cool! Thanks for this! -adrian On Saturday, July 20, 2013, Cedric GROSS wrote: > Diff sent to you Adrian.**** > > ** ** > > *De :* adrian.chadd@gmail.com 'adrian.chadd@gmail.com');> [mailto:adrian.chadd@gmail.com] > *De la part de* Adrian Chadd > *Envoy=E9 :* dimanche 21 juillet 2013 00:55 > *=C0 :* Cedric GROSS > *Cc :* Adrian Chadd; freebsd-wireless@freebsd.org 'cvml', 'freebsd-wireless@freebsd.org');>; freebsd-drivers@freebsd.org > *Objet :* Re: IWN Review**** > > ** ** > > yup! against -HEAD would be great!**** > > ** ** > > ** ** > > ** ** > > -adrian**** > > > On Saturday, July 20, 2013, Cedric GROSS wrote:**** > > > De : adrian.chadd@gmail.com [mailto:adrian.chadd@gmail.com] De la part > de > Adrian Chadd > > Envoy=E9 : samedi 20 juillet 2013 23:42 > > > > Hi! > > > > This is great news! > > > > Are you able to merge this into the iwn driver? Is it feasible? I'd > > rather not have two drivers in the tree for the same family of NICs. > > It's already IWN. But may be do you prefer a diff ? > > Cedric > > > > > Thanks! > > > > > > > > -adrian > >**** > From owner-freebsd-drivers@FreeBSD.ORG Sun Jul 21 04:06:30 2013 Return-Path: Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 1CE82DC5; Sun, 21 Jul 2013 04:06:30 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-wg0-x231.google.com (mail-wg0-x231.google.com [IPv6:2a00:1450:400c:c00::231]) by mx1.freebsd.org (Postfix) with ESMTP id 878D512F; Sun, 21 Jul 2013 04:06:29 +0000 (UTC) Received: by mail-wg0-f49.google.com with SMTP id a12so5041882wgh.16 for ; Sat, 20 Jul 2013 21:06:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=qQSu3bvZqW+AUqmnxUWn+ii+1qxrOm9bJUtqmfe+GwE=; b=IA/BAELbHk+4hQgUIhNpo6tIpHdYEodMdKWlPvQDVLUlo2iyhsIveZ+RwveUEKaijw 1aXVTEXloZZoeIR5WfDid6lqW+72MoWNdLIq5sWaJ8RWdEdh1RjZWKWQWJaozf9ycXq7 upLUtY1itEHeKaP1xZkhix3hGVQgxFVRxSh5tlK3UAyy/9txUJrLe0GGcpY5NbKRnFEe Lf8KHui6UDGsekY5S591XxmlfNDE1Zo3yy9xpuog13T0owWIJODmiCyZISOSy3hA7zP+ 5grcQhnzkmYi98HLC4Wk9a2bsYrB/kwvltUwzIopkHdm5XKekhfaUmFIZ/upXlZPM4Ub Z+/A== MIME-Version: 1.0 X-Received: by 10.194.63.229 with SMTP id j5mr15494461wjs.79.1374379588743; Sat, 20 Jul 2013 21:06:28 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.217.94.132 with HTTP; Sat, 20 Jul 2013 21:06:28 -0700 (PDT) In-Reply-To: <006a01ce8553$f81d4290$e857c7b0$@info> References: <006a01ce8553$f81d4290$e857c7b0$@info> Date: Sat, 20 Jul 2013 21:06:28 -0700 X-Google-Sender-Auth: 6TkhimYUBHPfQZFX8ui83RQg4H4 Message-ID: Subject: Re: IWN Review From: Adrian Chadd To: Cedric GROSS Content-Type: text/plain; charset=ISO-8859-1 Cc: freebsd-wireless@freebsd.org, freebsd-drivers@freebsd.org X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Jul 2013 04:06:30 -0000 Hi! so, my feedback! * Why'd you disable including opt_wlan.h ? It's required * What merge issues did you have? I'd like to get this tree updated to the latest -HEAD, including whatever my recent changes for rate selection, so we can get this stuff tidied up for -HEAD * Why was ieee80211_resume_all() commented out? Did you do this? There's some stuff we can merge in right now into -HEAD: * the debug improvements * the changes from hard-coded checks for features based on the chipset, to a bitmap of features that get set during probe/attach So, let's try to get your stuff updated to the latest -HEAD, then get it tested out. I'll then start merging this stuff into -HEAD as we figure out what all these pieces do. Thanks for all this hard work! -adrian On 20 July 2013 07:18, Cedric GROSS wrote: > Hello dear all, > > > > I'm please to announce that I completed my work on IWN. > > > > My version available here https://github.com/KreizIT/FreeBSD-IWN include > improvement issued by seanbruno (https://github.com/seanbruno/freebsd-iwl) > but also mine to support centrino N 2230 NIC (it's my NIC) > > > > I set up a new parameters system which more sensitive. I port back all NIC > parameters to this new system. I hope that I haven't do some mistake. > > So I'll be really please if Intel's NIC owner could check my work and let me > know. > > > > By the way, if commiters would include my work, please do. > > > > Cheers > > Cedric > > > > _______________________________________________ > freebsd-wireless@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-wireless > To unsubscribe, send any mail to "freebsd-wireless-unsubscribe@freebsd.org" From owner-freebsd-drivers@FreeBSD.ORG Sun Jul 21 15:39:47 2013 Return-Path: Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 4DA1B25D; Sun, 21 Jul 2013 15:39:47 +0000 (UTC) (envelope-from cg@cgross.info) Received: from alpha.kreiz-it.fr (alpha.kreiz-it.fr [178.32.219.166]) by mx1.freebsd.org (Postfix) with ESMTP id 1AB2167F; Sun, 21 Jul 2013 15:39:46 +0000 (UTC) Received: from DirTech (lnr56-1-82-246-51-185.fbx.proxad.net [82.246.51.185]) by alpha.kreiz-it.fr (Postfix) with ESMTPSA id B64CDEAD; Sun, 21 Jul 2013 17:39:43 +0200 (CEST) From: "Cedric GROSS" To: "'Adrian Chadd'" References: <006a01ce8553$f81d4290$e857c7b0$@info> In-Reply-To: Subject: RE: IWN Review Date: Sun, 21 Jul 2013 17:39:42 +0200 Message-ID: <001201ce8628$8748c4b0$95da4e10$@info> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: Ac6Fx7FOT0JkP8fJT5CUA1upzMaXlgAYB1dg Content-Language: fr Cc: freebsd-wireless@freebsd.org, freebsd-drivers@freebsd.org X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Jul 2013 15:39:47 -0000 > De=A0: adrian.chadd@gmail.com [mailto:adrian.chadd@gmail.com] De la = part > de Adrian Chadd > Envoy=E9=A0: dimanche 21 juillet 2013 06:06 > =C0=A0: Cedric GROSS > Cc=A0: freebsd-wireless@freebsd.org; freebsd-drivers@freebsd.org >=20 > Hi! >=20 > so, my feedback! >=20 > * Why'd you disable including opt_wlan.h ? It's required Just because I worked with a 9.1-release and I don't reach to compile = iwn with this include. Forget to enable it again. > * What merge issues did you have? I'd like to get this tree updated to > the latest -HEAD, including whatever my recent changes for rate > selection, so we can get this stuff tidied up for -HEAD Ok I will try. > * Why was ieee80211_resume_all() commented out? Did you do this? This things was not in original IWL so I commented it to be sure that my version of IWN work as iwl do. Plan to uncomment when merging to HEAD. >=20 > There's some stuff we can merge in right now into -HEAD: >=20 > * the debug improvements > * the changes from hard-coded checks for features based on the = chipset, > to a bitmap of features that get set during probe/attach >=20 > So, let's try to get your stuff updated to the latest -HEAD, then get > it tested out. I'll then start merging this stuff into -HEAD as we > figure out what all these pieces do. >=20 > Thanks for all this hard work! >=20 >=20 >=20 > -adrian >=20 >=20 > On 20 July 2013 07:18, Cedric GROSS wrote: > > Hello dear all, > > > > > > > > I'm please to announce that I completed my work on IWN. > > > > > > > > My version available here https://github.com/KreizIT/FreeBSD-IWN > > include improvement issued by seanbruno > > (https://github.com/seanbruno/freebsd-iwl) > > but also mine to support centrino N 2230 NIC (it's my NIC) > > > > > > > > I set up a new parameters system which more sensitive. I port back > all > > NIC parameters to this new system. I hope that I haven't do some > mistake. > > > > So I'll be really please if Intel's NIC owner could check my work = and > > let me know. > > > > > > > > By the way, if commiters would include my work, please do. > > > > > > > > Cheers > > > > Cedric > > > > > > > > _______________________________________________ > > freebsd-wireless@freebsd.org mailing list > > http://lists.freebsd.org/mailman/listinfo/freebsd-wireless > > To unsubscribe, send any mail to "freebsd-wireless- > unsubscribe@freebsd.org" From owner-freebsd-drivers@FreeBSD.ORG Tue Jul 23 09:12:58 2013 Return-Path: Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 7911A50B; Tue, 23 Jul 2013 09:12:58 +0000 (UTC) (envelope-from jyoti.mickey@gmail.com) Received: from mail-ve0-x22b.google.com (mail-ve0-x22b.google.com [IPv6:2607:f8b0:400c:c01::22b]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 2DBD7221E; Tue, 23 Jul 2013 09:12:58 +0000 (UTC) Received: by mail-ve0-f171.google.com with SMTP id b10so5939313vea.16 for ; Tue, 23 Jul 2013 02:12:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=TRFGU/wmhI6hXANgB+P0tMfFYaPIBlJdU15iDtTLhf4=; b=vrobjmQt3t15l70dU0bWS/QqA328/0SXXO8zCgIrUuT3vSK4WPzFQRd5OKOlrVqACb kq/Hy4okSX8pOq+gC2/DygCgOylvcheGms51glRKIW74gpL/tQbVnAh+RfdJ0tsi8TY1 6c0VSQBzfUv0wNRf5lRJ/1sC8pFi8Y96ioxRhYZ4J9GkppT3Ah23pndWcHSl/5gfdhDu SS5Xb2nvylWOYo7cawDVcZQ2IJXTYW+Xapmt86efnyBepm5U3zIOLOYY1DK+/zCZxE2U M3e6VDjAzxwe+/z5OHz6NfMWmGC/bNo82EbShHXA+aNSYMeEQYwitsPdy8bpUwHvMJ2K G/Gg== MIME-Version: 1.0 X-Received: by 10.220.225.2 with SMTP id iq2mr10588563vcb.59.1374570777339; Tue, 23 Jul 2013 02:12:57 -0700 (PDT) Received: by 10.221.8.193 with HTTP; Tue, 23 Jul 2013 02:12:57 -0700 (PDT) Date: Tue, 23 Jul 2013 14:42:57 +0530 Message-ID: Subject: How to debug FreeBSD 8.2 booting problem on ESXi 5.1.0? From: Jyoti Sharma To: freebsd-drivers@freebsd.org, freebsd-dtrace@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jul 2013 09:12:58 -0000 I am booting from livecd and the booting process hangs at: Booting [/boot/kernel/kernel] What should I do to debug this? The vm has 2 gb ram assigned to it. Regards, Jyoti From owner-freebsd-drivers@FreeBSD.ORG Sat Jul 27 04:46:10 2013 Return-Path: Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id CAA05F45 for ; Sat, 27 Jul 2013 04:46:10 +0000 (UTC) (envelope-from retval42@gmail.com) Received: from mail-oa0-x241.google.com (mail-oa0-x241.google.com [IPv6:2607:f8b0:4003:c02::241]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 965D32779 for ; Sat, 27 Jul 2013 04:46:10 +0000 (UTC) Received: by mail-oa0-f65.google.com with SMTP id k14so2111298oag.4 for ; Fri, 26 Jul 2013 21:46:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=2gZr6j6phwhFfxt14KYL7pKWKb2zdxceWrYosfzlNf8=; b=1GR26ggQqMqAUav5FmB5bLXHVIptGFhjdW7n1zYG6eDnIqHxevwtsUeR1XD76On+f+ 3ouZcYkteijulZm3zWKmQJCuxd7qOf0gbUVFChY4q6jz2u+V+cjwKMITnNUbFJbWOT8b PL69kRBqjZXs9xFPGWdxAq2YK37KwmuTdsgupHtSyqy+15Rpvx3TeuowDhLnbb3imSoK 5qDSil1bAI/5zE0s1r6fvygl3gP+YKhJU05FcDtqXAnAw1jswpzqqRHY08DXyXE+AMq1 hDfRDlJ8ssupUAT5yA8sC+AE+MtNxhuh9giZSOkVcJiG3IBJPUnbOtvMAZuYMVC5IQL9 evOA== MIME-Version: 1.0 X-Received: by 10.43.65.144 with SMTP id xm16mr20623141icb.112.1374900369577; Fri, 26 Jul 2013 21:46:09 -0700 (PDT) Received: by 10.64.101.103 with HTTP; Fri, 26 Jul 2013 21:46:09 -0700 (PDT) Date: Sat, 27 Jul 2013 00:46:09 -0400 Message-ID: Subject: mysterious locking issue From: ret val To: freebsd-drivers@freebsd.org Content-Type: multipart/mixed; boundary=bcaec51b1b6f215daa04e276f0ae X-Content-Filtered-By: Mailman/MimeDel 2.1.14 X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Jul 2013 04:46:10 -0000 --bcaec51b1b6f215daa04e276f0ae Content-Type: text/plain; charset=ISO-8859-1 I'm working on porting a driver form Linux that uses the usermode helper API to call a user land program from the driver. Yes, I know this is ugly. Yes, I'm sure sure there would of been many better other ways to go about this... For right now I'm just doing a straight port. Anyway, I working on my own routine for this but unfortunately I get a kernel panic on boot when my module is loaded. Oddly enough it works fine if I load it by hand after boot. I get the following: panic: mutex Giant owned at /usr/src/sys/kern/kern_thread.c:616 The backtrace looks like: panic _mtx_assert thread_single kern_execve event_handler Ive tried switching to SI_SUB_EXEC without any luck. Does anyone know how to go about fixing this? I cant seem to wrap my head around this. Incase I cant attach my code, here it is: #include #include #include #include #include #include #include #include #include int DEBUG=1; static int make_args(struct image_args *args, char *fname, char **argv, char **envv) { int i; size_t length; memset(args, 0, sizeof(struct image_args)); if(exec_alloc_args(args) != 0) { if(DEBUG) { printf("exec_alloc_args() failed\n"); uprintf("exec_alloc_args() failed\n"); } return ENOMEM; } // fname args->fname = args->buf; length = 1 + strlen(fname); memcpy(args->fname, fname, length); // args args->begin_argv = args->buf + 1 + strlen(fname); args->endp = args->begin_argv; for(i = 0; argv[i] != NULL; ++i) { length = 1 + strlen(argv[i]); memcpy(args->endp, argv[i], length); args->stringspace -= length; args->endp += length; (args->argc)++; } // envv args->begin_envv = args->endp; args->endp = args->begin_envv; for(i = 0; envv[i] != NULL; ++i) { length = 1 + strlen(envv[i]); memcpy(args->endp, envv[i], length); args->stringspace -= length; args->endp += length; (args->envc)++; } return 0; } static int runapp_init(void) { int error; char *argv[] = { "/usr/bin/logger", "it works", NULL }; char *envv[] = { NULL }; struct image_args args; error = make_args(&args, argv[0], argv, envv); if(error != 0) { return error; } error = kern_execve(curthread, &args, NULL); if(error != 0) { if(DEBUG) { printf("kern_execve() failed\n"); uprintf("kern_execve() failed\n"); } return error; } return 0; } static int event_handler(struct module *module, int event, void *arg) { switch(event) { case MOD_LOAD: printf("Hello, World! I'm loaded!\n"); uprintf("Hello, World! I'm loaded!\n"); return runapp_init(); case MOD_UNLOAD: case MOD_QUIESCE: printf("Bye Bye Cruel World!\n"); printf("Bye Bye Cruel World!\n"); return 0; } return EOPNOTSUPP; } static moduledata_t runapp_conf = { "runapp", /* module name */ event_handler, /* event handler */ NULL /* extra data */ }; DECLARE_MODULE(runapp, runapp_conf, SI_SUB_DRIVERS, SI_ORDER_ANY); --bcaec51b1b6f215daa04e276f0ae-- From owner-freebsd-drivers@FreeBSD.ORG Sat Jul 27 06:12:13 2013 Return-Path: Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id DBF8B652 for ; Sat, 27 Jul 2013 06:12:12 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 229AA2930 for ; Sat, 27 Jul 2013 06:12:11 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.7/8.14.7) with ESMTP id r6R6C14T020005; Sat, 27 Jul 2013 09:12:01 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.8.3 kib.kiev.ua r6R6C14T020005 Received: (from kostik@localhost) by tom.home (8.14.7/8.14.7/Submit) id r6R6C158020004; Sat, 27 Jul 2013 09:12:01 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 27 Jul 2013 09:12:01 +0300 From: Konstantin Belousov To: ret val Subject: Re: mysterious locking issue Message-ID: <20130727061201.GU5991@kib.kiev.ua> References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="QMcAIMJS2LNMCtSQ" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on tom.home Cc: freebsd-drivers@freebsd.org X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Jul 2013 06:12:13 -0000 --QMcAIMJS2LNMCtSQ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Jul 27, 2013 at 12:46:09AM -0400, ret val wrote: > I'm working on porting a driver form Linux that uses the usermode helper > API to call a user land program from the driver. Yes, I know this is ugly. > Yes, I'm sure sure there would of been many better other ways to go about > this... For right now I'm just doing a straight port. Kernel startup is single-threaded and owns the Giant. You are trying to call kern_execve() from the startup thread, which is the immediate cause of your problem. If you think about this some more, you would see that this cannot work when module is initialized at the boot. Because kernel is not fully initialized yet, the scheduler and usermode does not work, and there is no filesystem mounted from which to execute the image. Much worse is that you are trying to change the executing image of the usermode program for a situation where there is no usermode and the process which is executing is the kernel startup. FWIW, your code also does not quite work for the kldload case as well. You are execing in the context of the kldload, not allowing the normal kldload operation to finish. >=20 > Anyway, I working on my own routine for this but unfortunately I get a > kernel panic on boot when my module is loaded. Oddly enough it works fine > if I load it by hand after boot. I get the following: panic: mutex Giant > owned at /usr/src/sys/kern/kern_thread.c:616 >=20 > The backtrace looks like: > panic > _mtx_assert > thread_single > kern_execve > event_handler >=20 > Ive tried switching to SI_SUB_EXEC without any luck. Does anyone know how > to go about fixing this? I cant seem to wrap my head around this. This is not fixable. >=20 > Incase I cant attach my code, here it is: > #include > #include > #include > #include > #include > #include > #include > #include > #include >=20 > int DEBUG=3D1; >=20 > static int make_args(struct image_args *args, char *fname, char **argv, > char **envv) { > int i; > size_t length; >=20 > memset(args, 0, sizeof(struct image_args)); > if(exec_alloc_args(args) !=3D 0) { > if(DEBUG) { > printf("exec_alloc_args() failed\n"); > uprintf("exec_alloc_args() failed\n"); > } > return ENOMEM; > } > // fname > args->fname =3D args->buf; > length =3D 1 + strlen(fname); > memcpy(args->fname, fname, length); > // args > args->begin_argv =3D args->buf + 1 + strlen(fname); > args->endp =3D args->begin_argv; >=20 > for(i =3D 0; argv[i] !=3D NULL; ++i) { > length =3D 1 + strlen(argv[i]); > memcpy(args->endp, argv[i], length); > args->stringspace -=3D length; > args->endp +=3D length; > (args->argc)++; > } > // envv > args->begin_envv =3D args->endp; > args->endp =3D args->begin_envv; > for(i =3D 0; envv[i] !=3D NULL; ++i) { > length =3D 1 + strlen(envv[i]); > memcpy(args->endp, envv[i], length); > args->stringspace -=3D length; > args->endp +=3D length; > (args->envc)++; > } > return 0; > } >=20 > static int runapp_init(void) { > int error; > char *argv[] =3D { "/usr/bin/logger", "it works", NULL }; > char *envv[] =3D { NULL }; > struct image_args args; > error =3D make_args(&args, argv[0], argv, envv); > if(error !=3D 0) { > return error; > } > error =3D kern_execve(curthread, &args, NULL); > if(error !=3D 0) { > if(DEBUG) { > printf("kern_execve() failed\n"); > uprintf("kern_execve() failed\n"); > } > return error; > } > return 0; > } >=20 > static int event_handler(struct module *module, int event, void *arg) { > switch(event) { > case MOD_LOAD: > printf("Hello, World! I'm loaded!\n"); > uprintf("Hello, World! I'm loaded!\n"); > return runapp_init(); > case MOD_UNLOAD: > case MOD_QUIESCE: > printf("Bye Bye Cruel World!\n"); > printf("Bye Bye Cruel World!\n"); > return 0; > } >=20 > return EOPNOTSUPP; > } >=20 > static moduledata_t runapp_conf =3D { > "runapp", /* module name */ > event_handler, /* event handler */ > NULL /* extra data */ > }; >=20 > DECLARE_MODULE(runapp, runapp_conf, SI_SUB_DRIVERS, SI_ORDER_ANY); > _______________________________________________ > freebsd-drivers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-drivers > To unsubscribe, send any mail to "freebsd-drivers-unsubscribe@freebsd.org" --QMcAIMJS2LNMCtSQ Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.20 (FreeBSD) iQIcBAEBAgAGBQJR82SwAAoJEJDCuSvBvK1BuyYP/0SPZFQRd9sh0+XICE+8gdJi 5Wa6LnQluN3NjPPOOtFGva6ZsSzZ8VNUreGfFCETNQZ3fXz9F5M8WHIDdtAi1qFB GNWnS+lhyno7zpT4+SEWv1TowCJzrKYpiMPrFN4D4xQTIueBT5MNsWMSAOemCAi7 cVv7qaYp0azRmg4V0+ZjrsXHE/Wa8Lcz4vnpwKfjgvqIoTQ6TmGEbgMnSYR/dXZv WTk26Wn8K3pLe6jC2tqqJVEzy8EoRk7x5YCmTatNYFCFcQe3z2upFX004qtM/WSo 5I1w4SqNAiMOWXkPw2aBYK6pq2TacTQ0d/OIbcenFu2mef1ML9jWEwrg0kjAmBBn 1RjF5MCeomMkA59IGMpvzFyspul0qRXAeDYElpz5iht1VV9FGkqrIE+b7xJqRMb4 yr7BT/c0jN62hsAzRW9JQRgBICt3qoSWboRs2+q4MqZD5ZuVGOmruQZMxTDHWEen CgjzR2+uHl5IfMU6Qp5gwACFcuSHLwtkRXkzUHMURdwMMHGtL7dyM+KCcs7IDGNw /4d2b58/sLWv9jKvnjwuHQvZul/8wyeYLm0OUZzcN6MWEiIgsFecGCmLhATN2N5g Al1KDvelQ5I5QKCpVfb6V4HLzkQd+YPpZUGAyP0CIVUSOghEthqaFGVbxG8/s8zd jFNz+YkmInFrGIiWxWY2 =yCKh -----END PGP SIGNATURE----- --QMcAIMJS2LNMCtSQ-- From owner-freebsd-drivers@FreeBSD.ORG Sat Jul 27 16:35:41 2013 Return-Path: Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 47AAF62B for ; Sat, 27 Jul 2013 16:35:41 +0000 (UTC) (envelope-from retval42@gmail.com) Received: from mail-oa0-x243.google.com (mail-oa0-x243.google.com [IPv6:2607:f8b0:4003:c02::243]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 127A42BEF for ; Sat, 27 Jul 2013 16:35:41 +0000 (UTC) Received: by mail-oa0-f67.google.com with SMTP id i4so885047oah.10 for ; Sat, 27 Jul 2013 09:35:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=+r1AwjaWkz4IRa0+9GFgjJlCSfBJh9hdxH8O+le4wPY=; b=MZ2ELWWjMetq3wpB0SJpKYnjGs6CWtAA8ErbccRfw+YyVEqiwzR/8aWAM9TiY74ujr pSV2dy4UC0cwLhQ/ahcZiIc19pu10aeEvN5StpjGdw9mOqzmZya9ixATLooilYNPoxxe wqqafdrOpit0OnaS9zXZkUrkqMokP5QtynRCNxE9iWP//X3FnxBSu4v4HvehYpmVAohw uFZbCb86mGJC2WhIkV5ZOB5vbHdenCgMfcqHKtWTiHlBPrN1W9ey6Pg+0YgkZhG0MKXc 5a9/CZO62JSWgXg9RLv52kH4bmkbSpYSbVyDVqHI+arn0m76gvHpAJ8gmWYoiBsqoeJz cQ4Q== MIME-Version: 1.0 X-Received: by 10.50.40.35 with SMTP id u3mr344546igk.23.1374942940332; Sat, 27 Jul 2013 09:35:40 -0700 (PDT) Received: by 10.64.41.102 with HTTP; Sat, 27 Jul 2013 09:35:40 -0700 (PDT) In-Reply-To: <20130727061201.GU5991@kib.kiev.ua> References: <20130727061201.GU5991@kib.kiev.ua> Date: Sat, 27 Jul 2013 12:35:40 -0400 Message-ID: Subject: Re: mysterious locking issue From: ret val To: Konstantin Belousov Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Cc: freebsd-drivers@freebsd.org X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Jul 2013 16:35:41 -0000 Alright, this is making much more sense now. Thank you. Would it be possible to create a new thread and sleep until the kernel is fully initialized? Is there some event I could possible wait for? While my approach now seems wrong, It seems like this should be doable. On Sat, Jul 27, 2013 at 2:12 AM, Konstantin Belousov wrote: > On Sat, Jul 27, 2013 at 12:46:09AM -0400, ret val wrote: > > I'm working on porting a driver form Linux that uses the usermode helper > > API to call a user land program from the driver. Yes, I know this is > ugly. > > Yes, I'm sure sure there would of been many better other ways to go about > > this... For right now I'm just doing a straight port. > Kernel startup is single-threaded and owns the Giant. You are trying > to call kern_execve() from the startup thread, which is the immediate > cause of your problem. > > If you think about this some more, you would see that this cannot work > when module is initialized at the boot. Because kernel is not fully > initialized yet, the scheduler and usermode does not work, and there > is no filesystem mounted from which to execute the image. Much worse > is that you are trying to change the executing image of the usermode > program for a situation where there is no usermode and the process which > is executing is the kernel startup. > > FWIW, your code also does not quite work for the kldload case as well. > You are execing in the context of the kldload, not allowing the normal > kldload operation to finish. > > > > > Anyway, I working on my own routine for this but unfortunately I get a > > kernel panic on boot when my module is loaded. Oddly enough it works fine > > if I load it by hand after boot. I get the following: panic: mutex Giant > > owned at /usr/src/sys/kern/kern_thread.c:616 > > > > The backtrace looks like: > > panic > > _mtx_assert > > thread_single > > kern_execve > > event_handler > > > > Ive tried switching to SI_SUB_EXEC without any luck. Does anyone know how > > to go about fixing this? I cant seem to wrap my head around this. > This is not fixable. > > > > > Incase I cant attach my code, here it is: > > #include > > #include > > #include > > #include > > #include > > #include > > #include > > #include > > #include > > > > int DEBUG=1; > > > > static int make_args(struct image_args *args, char *fname, char **argv, > > char **envv) { > > int i; > > size_t length; > > > > memset(args, 0, sizeof(struct image_args)); > > if(exec_alloc_args(args) != 0) { > > if(DEBUG) { > > printf("exec_alloc_args() failed\n"); > > uprintf("exec_alloc_args() failed\n"); > > } > > return ENOMEM; > > } > > // fname > > args->fname = args->buf; > > length = 1 + strlen(fname); > > memcpy(args->fname, fname, length); > > // args > > args->begin_argv = args->buf + 1 + strlen(fname); > > args->endp = args->begin_argv; > > > > for(i = 0; argv[i] != NULL; ++i) { > > length = 1 + strlen(argv[i]); > > memcpy(args->endp, argv[i], length); > > args->stringspace -= length; > > args->endp += length; > > (args->argc)++; > > } > > // envv > > args->begin_envv = args->endp; > > args->endp = args->begin_envv; > > for(i = 0; envv[i] != NULL; ++i) { > > length = 1 + strlen(envv[i]); > > memcpy(args->endp, envv[i], length); > > args->stringspace -= length; > > args->endp += length; > > (args->envc)++; > > } > > return 0; > > } > > > > static int runapp_init(void) { > > int error; > > char *argv[] = { "/usr/bin/logger", "it works", NULL }; > > char *envv[] = { NULL }; > > struct image_args args; > > error = make_args(&args, argv[0], argv, envv); > > if(error != 0) { > > return error; > > } > > error = kern_execve(curthread, &args, NULL); > > if(error != 0) { > > if(DEBUG) { > > printf("kern_execve() failed\n"); > > uprintf("kern_execve() failed\n"); > > } > > return error; > > } > > return 0; > > } > > > > static int event_handler(struct module *module, int event, void *arg) { > > switch(event) { > > case MOD_LOAD: > > printf("Hello, World! I'm loaded!\n"); > > uprintf("Hello, World! I'm loaded!\n"); > > return runapp_init(); > > case MOD_UNLOAD: > > case MOD_QUIESCE: > > printf("Bye Bye Cruel World!\n"); > > printf("Bye Bye Cruel World!\n"); > > return 0; > > } > > > > return EOPNOTSUPP; > > } > > > > static moduledata_t runapp_conf = { > > "runapp", /* module name */ > > event_handler, /* event handler */ > > NULL /* extra data */ > > }; > > > > DECLARE_MODULE(runapp, runapp_conf, SI_SUB_DRIVERS, SI_ORDER_ANY); > > > _______________________________________________ > > freebsd-drivers@freebsd.org mailing list > > http://lists.freebsd.org/mailman/listinfo/freebsd-drivers > > To unsubscribe, send any mail to " > freebsd-drivers-unsubscribe@freebsd.org" > >