From owner-svn-src-all@freebsd.org Mon Aug 28 19:52:15 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0576AE13048; Mon, 28 Aug 2017 19:52:15 +0000 (UTC) (envelope-from rlibby@gmail.com) Received: from mail-pg0-f50.google.com (mail-pg0-f50.google.com [74.125.83.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CD8FE29F1; Mon, 28 Aug 2017 19:52:14 +0000 (UTC) (envelope-from rlibby@gmail.com) Received: by mail-pg0-f50.google.com with SMTP id b8so4268399pgn.5; Mon, 28 Aug 2017 12:52:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=InuCf5obs3BkRHHm+Vt/XFypbnFpENeeDIF8UjysIRs=; b=K1b82CEJ1OlrTWxxxfcWzko6/HUJx1GR4ogxB0dFcKInYgJwgQNZdcQWrnS9rRYAHw HZXngHLCAa2c/fVO7vzUdijEr3xfAK3aguIhM8kRq4abJWhfHSpGw61RlgPz0PY0wdRS cueaY3nOSGzaVLZAXU/0DcKtSfKIU/nVE8VOpkWgq3dTD0T9XP208N0gsEfxVO6u//gL AnxfJt0wzYu3xaFZsNP5GV9Ouopma7VYousfCsKcdO9gDSd4g6DRHDwu2KNROquodila T1RsJA8jSajokQrjEBRlhRVnBpSJyCoGrcuGZf7OCysWzvnqVs7pR00NqXUBGLu+bKdL WCfw== X-Gm-Message-State: AHYfb5jcM5BhaEZe8eXjewjw8OIzfiJiCS6PMfkM9gfjFVSLkX9qi0ra XHgcpWxBNq/qTxS8mP4meQ== X-Received: by 10.84.216.29 with SMTP id m29mr2117574pli.151.1503949610047; Mon, 28 Aug 2017 12:46:50 -0700 (PDT) Received: from mail-pf0-f169.google.com (mail-pf0-f169.google.com. [209.85.192.169]) by smtp.gmail.com with ESMTPSA id s81sm1961417pfg.78.2017.08.28.12.46.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 Aug 2017 12:46:49 -0700 (PDT) Received: by mail-pf0-f169.google.com with SMTP id z87so3987212pfi.3; Mon, 28 Aug 2017 12:46:49 -0700 (PDT) X-Received: by 10.98.58.193 with SMTP id v62mr1603360pfj.222.1503949608879; Mon, 28 Aug 2017 12:46:48 -0700 (PDT) MIME-Version: 1.0 Received: by 10.100.207.193 with HTTP; Mon, 28 Aug 2017 12:46:48 -0700 (PDT) In-Reply-To: References: <201708281554.v7SFs8fr014268@repo.freebsd.org> <7384187.efIiCynxO3@ralph.baldwin.cx> From: Ryan Libby Date: Mon, 28 Aug 2017 12:46:48 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r322969 - in head: sbin/mdconfig sys/dev/md sys/sys To: Maxim Sobolev Cc: John Baldwin , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Aug 2017 19:52:15 -0000 On Mon, Aug 28, 2017 at 11:24 AM, Maxim Sobolev wrote: > Hi John, > > Thanks for your feedback! To address the points that you've raised: > > 1. I've tested on both 32 and 64 bit platforms, it seems not to be the > case. See imp's comment and my reply here > https://reviews.freebsd.org/D10457#216855 . Did I miss something? Can you > post piece of C code that produces different sizeof(struct old) vs. > sizeof(struct new) on some platform? [...] > On Mon, Aug 28, 2017 at 9:19 AM, John Baldwin wrote: > >> On Monday, August 28, 2017 03:54:08 PM Maxim Sobolev wrote: >> > Author: sobomax >> > Date: Mon Aug 28 15:54:07 2017 >> > New Revision: 322969 >> > URL: https://svnweb.freebsd.org/changeset/base/322969 >> > >> > Log: >> > Add ability to label md(4) devices. >> > >> > This feature comes from the fact that we rely memory-backed md(4) >> > in our build process heavily. However, if the build goes haywire >> > the allocated resources (i.e. swap and memory-backed md(4)'s) need >> > to be purged. It is extremely useful to have ability to attach >> > arbitrary labels to each of the virtual disks so that they can >> > be identified and GC'ed if neecessary. >> > >> > MFC after: 4 weeks >> > Differential Revision: https://reviews.freebsd.org/D10457 >> > >> > Modified: >> > head/sbin/mdconfig/mdconfig.8 >> > head/sbin/mdconfig/mdconfig.c >> > head/sys/dev/md/md.c >> > head/sys/sys/mdioctl.h >> > >> > Modified: head/sys/sys/mdioctl.h >> > ============================================================ >> ================== >> > --- head/sys/sys/mdioctl.h Mon Aug 28 14:49:26 2017 (r322968) >> > +++ head/sys/sys/mdioctl.h Mon Aug 28 15:54:07 2017 (r322969) >> > @@ -49,7 +49,7 @@ enum md_types {MD_MALLOC, MD_PRELOAD, MD_VNODE, MD_SWA >> > * Ioctl definitions for memory disk pseudo-device. >> > */ >> > >> > -#define MDNPAD 97 >> > +#define MDNPAD 96 >> > struct md_ioctl { >> > unsigned md_version; /* Structure layout version */ >> > unsigned md_unit; /* unit number */ >> > @@ -61,6 +61,7 @@ struct md_ioctl { >> > u_int64_t md_base; /* base address */ >> > int md_fwheads; /* firmware heads */ >> > int md_fwsectors; /* firmware sectors */ >> > + char *md_label; /* label of the device */ >> > int md_pad[MDNPAD]; /* padding for future ideas */ >> > }; >> >> This isn't correct on 64-bit platforms. MDNPAD needs to be 95 on those >> platforms. [...] Can you report sizeof(md_ioctl) before and after for 32-bit and 64-bit? I think it may be: 32-bit before: 440 32-bit after: 440 64-bit before: 448 64-bit after: 448 In other words, it looks like it used to produce different sizes on the different architectures, and still does. It also looks like 32-bit before and after and 64-bit before included some undeclared padding after md_pad, so that this would fail: CTASSERT(sizeof(md_ioctl) == offsetof(struct md_ioctl, md_pad) + sizeof(((struct md_ioctl *)NULL)->md_pad)); In any case a CTASSERT(sizeof(md_ioctl) == XXX) may increase confidence in the ABI here.