NetBSD Problem Report #48873

From www@NetBSD.org  Wed Jun  4 23:57:36 2014
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	(using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 86C8AA6516
	for <gnats-bugs@gnats.NetBSD.org>; Wed,  4 Jun 2014 23:57:36 +0000 (UTC)
Message-Id: <20140604235735.3CD88A6605@mollari.NetBSD.org>
Date: Wed,  4 Jun 2014 23:57:35 +0000 (UTC)
From: tucker@brkt.com
Reply-To: tucker@brkt.com
To: gnats-bugs@NetBSD.org
Subject: xbdback kernel thread created with wrong priority
X-Send-Pr-Version: www-1.0

>Number:         48873
>Category:       port-xen
>Synopsis:       xbdback kernel thread created with wrong priority
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    port-xen-maintainer
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jun 05 00:00:00 +0000 2014
>Closed-Date:    Sat Jun 23 15:33:28 +0000 2018
>Last-Modified:  Sat Jun 23 15:33:28 +0000 2018
>Originator:     Andy Tucker
>Release:        6.1.4
>Organization:
Bracket Computing
>Environment:
>Description:
I noticed that the xbdback_xenbus driver (the backend driver for the Xen virtual block device) is passing the wrong value for the thread priority when creating a worker thread. It has:

	if (kthread_create(IPL_NONE, KTHREAD_MPSAFE, NULL,
	    xbdback_thread, xbdi, NULL, "%s", xbdi->xbdi_name) == 0)

but the first argument of kthread_create is a thread priority, not an IPL. IPL_NONE evaluates to 0 on amd64, which results in a priority of 0. I assume that what was intended was PRI_NONE, which will result in a priority of PRI_KTHREAD or 96.

A priority of 0 could result in a priority inversion problem with user threads, where a spinning user level process prevents the xbdback thread from running and processing block I/O requests.
>How-To-Repeat:

>Fix:
Change IPL_NONE to PRI_NONE.

>Release-Note:

>Audit-Trail:

State-Changed-From-To: open->closed
State-Changed-By: jdolecek@NetBSD.org
State-Changed-When: Sat, 23 Jun 2018 15:33:28 +0000
State-Changed-Why:
Fixed in rev. 1.61 of xbdback_xenbus.c on 2015-11-15 already. Thanks for report.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.