From owner-svn-src-head@FreeBSD.ORG Sat Dec 22 12:24:34 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1E375681; Sat, 22 Dec 2012 12:24:34 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-la0-f48.google.com (mail-la0-f48.google.com [209.85.215.48]) by mx1.freebsd.org (Postfix) with ESMTP id 290FC8FC0A; Sat, 22 Dec 2012 12:24:32 +0000 (UTC) Received: by mail-la0-f48.google.com with SMTP id m13so6563094lah.35 for ; Sat, 22 Dec 2012 04:24:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=+rZ/sGQcaoUm28rznp9FZQbzxgRE9yUJD2y5sV3r7K0=; b=Jzl3py/3LuI8/yDH7zky19FBjq1j9cf6MB1+POhozcqiMF8QuoT6G+dVQWcbpo47GL y8cO5Hhg7kPkSZSoE9XdCziEoJ8EztrK23lEP7QHeVMciEaubVZjn/F0+4B+0qVO9pSX okIlwthJL9ZoIm7KpS4a9CWWVmEjRdV6PuQMirMxEvFN/zwW3ZbXXUruw5UXRCHfziNC 9YeGlWzAA815yveyYWnJ2fzoNMX7MMSHozu5uKm+lTJn4FEu4AG/zzBdFwnDxQoYa8Hn EknX0g8fGFM2Ib1qnQSpEu+o9PAqGLa5HwAfpL+x87Tigs2xsmX7/AY/wp6X73in5fC7 vujQ== MIME-Version: 1.0 Received: by 10.152.129.197 with SMTP id ny5mr15211840lab.43.1356179071630; Sat, 22 Dec 2012 04:24:31 -0800 (PST) Sender: asmrookie@gmail.com Received: by 10.112.84.193 with HTTP; Sat, 22 Dec 2012 04:24:31 -0800 (PST) In-Reply-To: <20121222230402.P1765@besplex.bde.org> References: <201212220937.qBM9bYQK050680@svn.freebsd.org> <20121222204409.V1410@besplex.bde.org> <20121222230402.P1765@besplex.bde.org> Date: Sat, 22 Dec 2012 13:24:31 +0100 X-Google-Sender-Auth: cjonDreKcTq4D8nJFjruigMMJe0 Message-ID: Subject: Re: svn commit: r244582 - head/sys/kern From: Attilio Rao To: Bruce Evans Content-Type: text/plain; charset=UTF-8 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: attilio@FreeBSD.org List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Dec 2012 12:24:34 -0000 On Sat, Dec 22, 2012 at 1:20 PM, Bruce Evans wrote: > On Sat, 22 Dec 2012, Attilio Rao wrote: > >> On Sat, Dec 22, 2012 at 10:51 AM, Bruce Evans >> wrote: >>> >>> On Sat, 22 Dec 2012, Attilio Rao wrote: >>> >>>> Log: >>>> Fixup r240424: On entering KDB backends, the hijacked thread to run >>>> interrupt context can still be idlethread. At that point, without the >>>> panic condition, it can still happen that idlethread then will try to >>>> acquire some locks to carry on some operations. >>>> >>>> Skip the idlethread check on block/sleep lock operations when KDB is >>>> active. >>> >>> >>> This seems backwards to me. It is an error to go near normal locking >>> code when kdb is active. >> >> >> I completely agree, but this is not what happens nowadays with FreeBSD >> kernel. >> In my view, KDB should not call into normal code, but in special >> wrappers which skip locking entirely, in particular because other cpus >> are stopped, so there is no race going on. >> However, this requires a big change and as long as this doesn't happen >> we need to stuck with similar hacks. > > > But this sort of hack only breaks accidental detection of a bug (maybe > the bug causes deadlock or data corruption soon). The type of hack > that helps is 'if (kdb_active) skip_locking();' deep in code that > shouldn't even be called if kdb is active. Here it is 'if (kdb_active) > skip_checking();' I agree, but our kernel relies on this stuff for kdb heavily (see all the duplicate checks around). We need to change that all together. We need to provide lockless version for KDB command. >> >> >> I do not understand. For kdb_active == 0 it still checks for >> IDLETHREAD if it is not idlethread it doesn't panic, it panics >> otherwise, which seems the right to me. > > > I just mean that the correct kdb_active KASSERT() is independent of the > idlethread one. It should also have a different message. I forgot to > provide a message. If you want to use a better message, be my guest. Attilio -- Peace can only be achieved by understanding - A. Einstein