From owner-svn-src-stable-9@FreeBSD.ORG Tue May 15 20:53:56 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 04E91106564A; Tue, 15 May 2012 20:53:56 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-lpp01m010-f54.google.com (mail-lpp01m010-f54.google.com [209.85.215.54]) by mx1.freebsd.org (Postfix) with ESMTP id A2A178FC0A; Tue, 15 May 2012 20:53:54 +0000 (UTC) Received: by laai10 with SMTP id i10so19399laa.13 for ; Tue, 15 May 2012 13:53:48 -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 :content-transfer-encoding; bh=/aKU4eYaAISkq8X0F004AI3rIXlGSqLzO4RrH2wj+e4=; b=f3grAxSaeLCL0gl4JK1D5/6YlNvJUrf20en5e9bHtQIK6IoRgR6D6u5Mi+04leKPqP 0Uruk6vkQ6Pr+Xpa1oiy75imsPNgzgbFu9yzD3TzJPevHz/adWAKqtssclNKyKv9FMaf b0Pxd+ig9SKF9tOwzOSPCuL1sX24dFi9UIt6NcFQ2mQ66eYrr6jx7zT1Rf2oPS7RCxzS qMVh4wQfVteh+c9ayPC/XhVE/9cRtkSNvbBXNCOWmwfLLX8hbAfW/2W43ySv//cQEJq1 ezVwH1RuYPZomN7hFZu6SRF7dtL3ZA7UxNRHU8lxo5oNIbcktOxzgvbFedCWAhGW/DVL 5utA== MIME-Version: 1.0 Received: by 10.112.82.165 with SMTP id j5mr185921lby.50.1337115228242; Tue, 15 May 2012 13:53:48 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.112.27.65 with HTTP; Tue, 15 May 2012 13:53:48 -0700 (PDT) In-Reply-To: <20120515203832.GE2358@deviant.kiev.zoral.com.ua> References: <201205151721.q4FHLlgq097452@svn.freebsd.org> <20120515182747.GD2358@deviant.kiev.zoral.com.ua> <4FB2B7C5.2080604@FreeBSD.org> <20120515203832.GE2358@deviant.kiev.zoral.com.ua> Date: Tue, 15 May 2012 21:53:48 +0100 X-Google-Sender-Auth: y8hQw4h8ssx8ZC6NGYFIRQjQlhg Message-ID: From: Attilio Rao To: Konstantin Belousov Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-9@freebsd.org, Andriy Gapon Subject: Re: svn commit: r235480 - in stable/9/sys: dev/usb geom geom/mountver i386/conf kern sys X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 May 2012 20:53:56 -0000 2012/5/15 Konstantin Belousov : > On Tue, May 15, 2012 at 11:08:37PM +0300, Andriy Gapon wrote: >> on 15/05/2012 21:27 Konstantin Belousov said the following: >> > On Tue, May 15, 2012 at 05:21:47PM +0000, Andriy Gapon wrote: >> >> Author: avg Date: Tue May 15 17:21:46 2012 New Revision: 235480 URL: >> >> http://svn.freebsd.org/changeset/base/235480 >> >> >> >> Log: MFC r230643: stop_scheduler -> td_stopsched Modified: >> >> stable/9/sys/sys/proc.h >> >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >> >> >> >> >> --- stable/9/sys/sys/proc.h =C2=A0 Tue May 15 17:11:00 2012 =C2=A0 =C2= =A0 =C2=A0 =C2=A0(r235479) >> >> +++ stable/9/sys/sys/proc.h =C2=A0 =C2=A0 =C2=A0 =C2=A0Tue May 15 17:= 21:46 2012 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r235480) @@ -235,6 >> >> +235,7 @@ struct thread { short =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0td_locks; =C2=A0 =C2=A0 =C2=A0 /* (k) Count of non-spin >> >> locks. */ short =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0td_rw_rlocks= ; =C2=A0 /* (k) Count of rwlock read locks. */ >> >> short =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0td_lk_slocks; = =C2=A0 /* (k) Count of lockmgr shared locks. */ + =C2=A0 =C2=A0 =C2=A0short >> >> td_stopsched; =C2=A0 =C2=A0 =C2=A0/* (k) Scheduler stopped. */ struct= turnstile *td_blocked; >> >> /* (t) Lock thread is blocked on. */ const char =C2=A0 =C2=A0*td_lock= name; =C2=A0 /* (t) Name >> >> of lock blocked on. */ LIST_HEAD(, turnstile) td_contested; =C2=A0 = =C2=A0 =C2=A0 =C2=A0/* (q) >> >> Contested locks. */ >> >> >> > Did you verified that there is a gap between td_lk_slocks and td_block= ed an >> > all tier-1 architectures large enough to adopt td_stopsched without >> > changing the layout of struct thread after the new member ? >> >> I haven't verified that. but I presumed that the gap was either 2 bytes = on >> 32-bit architectures or 6 bytes on 64-bit ones. >> What is the proper and doable way of verifying this? > I think that p sizeof(struct thread) from gdb on previous and current > version of the kernel would be a good indicator. If sizes differ, it is > bad. > > To be completely sure, calculate offset of the next member in the structu= re: > in gdb, > p &(((struct thread *)0)->td_blocked) > for previous and current kernels. > >> >> > If not, this breaks KBI. >> >> I can just revert the commit to not risk an obscure breakage. >> What would you suggest? > Move the new member to the end of the struct thread, and do explicit > zeroing on the thread allocation, if commit changed the layout. That member position is strategic. It is left as close as possible to the recurse flags because they will very likely be already cached when td_schedstop is hit, which means td_schedstop will be already cached likely and this will avoid to pollute an extra cache line. Attilio --=20 Peace can only be achieved by understanding - A. Einstein