From owner-freebsd-hackers@FreeBSD.ORG Wed Sep 10 07:46:23 2014 Return-Path: Delivered-To: freebsd-hackers@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 ESMTPS id 35441519 for ; Wed, 10 Sep 2014 07:46:23 +0000 (UTC) Received: from mail-qc0-x236.google.com (mail-qc0-x236.google.com [IPv6:2607:f8b0:400d:c01::236]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id ECF8691B for ; Wed, 10 Sep 2014 07:46:22 +0000 (UTC) Received: by mail-qc0-f182.google.com with SMTP id x13so5682441qcv.13 for ; Wed, 10 Sep 2014 00:46:22 -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=DYn9ZIbBvOzdcMcbMNzOtgspGCAXE29jnfN0d39nzzA=; b=Cg3ock4nwmP8mYWtUMDyXJmc7+H73blUsQaFJbHtiIXtKsPBrl+hBMFUnrtQwsplOG 8gqMsu6TfcCQHZMZqA8Dbe/1Y6StcCaGDBL/Jc/fQ6H9IU6d6x/sq5ZsPzWJCWacUw1m qJkraz5dUYuBW7D82IPIcvBdnnPj8WrJwKjx3BodjCwIC3mObL8hZ1ZqI/kouxKX1wK9 mWrnXLr1LlDvG5WODs9BoplB9uVjuSlqSD6krYZ37aSZCd9QkDVYlEZuTDo7E358SkTd Kf/zYxKBOsurBgupvF5XjUZv3ReE9Jgqnsi7KXlOIifNT1lDidDDE8Qb2OdWoXopD2Ue nmjQ== MIME-Version: 1.0 X-Received: by 10.140.100.237 with SMTP id s100mr34694155qge.92.1410335182002; Wed, 10 Sep 2014 00:46:22 -0700 (PDT) Received: by 10.140.105.245 with HTTP; Wed, 10 Sep 2014 00:46:21 -0700 (PDT) Date: Wed, 10 Sep 2014 09:46:21 +0200 Message-ID: Subject: subr_witness.c "rm_spinlock" and "smp rendezvous" wrong declaration order From: Philippe Jalaber To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Sep 2014 07:46:23 -0000 Hello there, I have been playing with SMP and witness and looking at subr_witness.c. I suspect there is a bug in the declaration order of locks "rm_spinlock" and "smp rendezvous". It leads witness to fire a wrong LOR in SMP. Details: _rm_wlock in kern/kern_rmlock.c calls smp_rendezvous_cpus who locks smp_ipi_mtx then calls smp_rendezvous_action who calls rm_cleanIPI who locks rm_spinlock. So "smp_rendezvous" should be declared before "rm_spinlock" in subr_witness.c Thanks for reading me, Philippe