Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 22 May 2014 15:10:51 +0200
From:      Hans Petter Selasky <hps@selasky.org>
To:        Aleksandr Rybalko <ray@FreeBSD.org>, src-committers@freebsd.org,  svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r265927 - head/sys/dev/vt
Message-ID:  <537DF75B.9040607@selasky.org>
In-Reply-To: <537D0AAB.3090303@selasky.org>
References:  <201405121929.s4CJTcBx010967@svn.freebsd.org> <537D0AAB.3090303@selasky.org>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------060600010908060603090709
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

On 05/21/14 22:20, Hans Petter Selasky wrote:
> On 05/12/14 21:29, Aleksandr Rybalko wrote:
>> Author: ray
>> Date: Mon May 12 19:29:38 2014
>> New Revision: 265927
>> URL: http://svnweb.freebsd.org/changeset/base/265927
>>
>> Log:
>>    Update terminal sizes in any case when new vt(4) driver arrive.
>>    (Plus remove one unused newline)
>>
>>    Sponsored by:    The FreeBSD Foundation
>>
>> Modified:
>>    head/sys/dev/vt/vt_core.c
>>
>
> This patch causes panic when booting the RPI-B:
>
> VT: initialize with new VT driver "fb".
> panic: mtx_lock() of spin mutex (null) @
> /usr/img/freebsd/sys/dev/vt/vt_core.c:2037
> KDB: enter: panic
> [ thread pid 0 tid 100000 ]
> Stopped at      $d:     ldrb    r15, [r15, r15, ror r15]!
>
> __mtx_lock_flags() at
> vt_resize() at vt_upgrade() at
> mi_startup() at mi_startup+0x11c
>
>
> --HPS
>

This patch fixes it. Not sure if it is correct.

--HPS

> diff --git a/sys/dev/vt/vt_core.c b/sys/dev/vt/vt_core.c
> index 39b9265..d85d5e8 100644
> --- a/sys/dev/vt/vt_core.c
> +++ b/sys/dev/vt/vt_core.c
> @@ -145,6 +145,7 @@ static int vt_late_window_switch(struct vt_window *);
>  static int vt_proc_alive(struct vt_window *);
>  static void vt_resize(struct vt_device *);
>  static void vt_update_static(void *);
> +static void vt_upgrade_static(void *);
>
>  SET_DECLARE(vt_drv_set, struct vt_driver);
>
> @@ -203,23 +204,28 @@ DATA_SET(cons_set, vt_consterm_consdev);
>   * Right after kmem is done to allow early drivers to use locking and allocate
>   * memory.
>   */
> -SYSINIT(vt_update_static, SI_SUB_KMEM, SI_ORDER_ANY, vt_update_static,
> -    &vt_consdev);
> +SYSINIT(vt_init_1, SI_SUB_KMEM, SI_ORDER_ANY, vt_update_static, NULL);
>  /* Delay until all devices attached, to not waste time. */
> -SYSINIT(vt_early_cons, SI_SUB_INT_CONFIG_HOOKS, SI_ORDER_ANY, vt_upgrade,
> -    &vt_consdev);
> +SYSINIT(vt_init_2, SI_SUB_INT_CONFIG_HOOKS, SI_ORDER_ANY, vt_upgrade_static, NULL);
>
>  /* Initialize locks/mem depended members. */
>  static void
>  vt_update_static(void *dummy)
>  {
> +	if (main_vd == NULL)
> +		return;
> +	printf("VT: running with driver \"%s\".\n",
> +	    main_vd->vd_driver->vd_name);
> +	mtx_init(&main_vd->vd_lock, "vtdev", NULL, MTX_DEF);
> +	cv_init(&main_vd->vd_winswitch, "vtwswt");
> +}
>
> -	if (main_vd != NULL) {
> -		printf("VT: running with driver \"%s\".\n",
> -		    main_vd->vd_driver->vd_name);
> -		mtx_init(&main_vd->vd_lock, "vtdev", NULL, MTX_DEF);
> -		cv_init(&main_vd->vd_winswitch, "vtwswt");
> -	}
> +static void
> +vt_upgrade_static(void *dummy)
> +{
> +	if (main_vd == NULL)
> +		return;
> +	vt_upgrade(main_vd);
>  }
>
>  static void






--------------060600010908060603090709
Content-Type: text/x-diff;
 name="vt.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="vt.diff"

diff --git a/sys/dev/vt/vt_core.c b/sys/dev/vt/vt_core.c
index 39b9265..d85d5e8 100644
--- a/sys/dev/vt/vt_core.c
+++ b/sys/dev/vt/vt_core.c
@@ -145,6 +145,7 @@ static int vt_late_window_switch(struct vt_window *);
 static int vt_proc_alive(struct vt_window *);
 static void vt_resize(struct vt_device *);
 static void vt_update_static(void *);
+static void vt_upgrade_static(void *);
 
 SET_DECLARE(vt_drv_set, struct vt_driver);
 
@@ -203,23 +204,28 @@ DATA_SET(cons_set, vt_consterm_consdev);
  * Right after kmem is done to allow early drivers to use locking and allocate
  * memory.
  */
-SYSINIT(vt_update_static, SI_SUB_KMEM, SI_ORDER_ANY, vt_update_static,
-    &vt_consdev);
+SYSINIT(vt_init_1, SI_SUB_KMEM, SI_ORDER_ANY, vt_update_static, NULL);
 /* Delay until all devices attached, to not waste time. */
-SYSINIT(vt_early_cons, SI_SUB_INT_CONFIG_HOOKS, SI_ORDER_ANY, vt_upgrade,
-    &vt_consdev);
+SYSINIT(vt_init_2, SI_SUB_INT_CONFIG_HOOKS, SI_ORDER_ANY, vt_upgrade_static, NULL);
 
 /* Initialize locks/mem depended members. */
 static void
 vt_update_static(void *dummy)
 {
+	if (main_vd == NULL)
+		return;
+	printf("VT: running with driver \"%s\".\n",
+	    main_vd->vd_driver->vd_name);
+	mtx_init(&main_vd->vd_lock, "vtdev", NULL, MTX_DEF);
+	cv_init(&main_vd->vd_winswitch, "vtwswt");
+}
 
-	if (main_vd != NULL) {
-		printf("VT: running with driver \"%s\".\n",
-		    main_vd->vd_driver->vd_name);
-		mtx_init(&main_vd->vd_lock, "vtdev", NULL, MTX_DEF);
-		cv_init(&main_vd->vd_winswitch, "vtwswt");
-	}
+static void
+vt_upgrade_static(void *dummy)
+{
+	if (main_vd == NULL)
+		return;
+	vt_upgrade(main_vd);
 }
 
 static void

--------------060600010908060603090709--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?537DF75B.9040607>