All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 23/55] scsi-disk: report media changed via unit attention sense codes
From: Kevin Wolf @ 2011-10-31 13:29 UTC (permalink / raw)
  To: anthony; +Cc: kwolf, qemu-devel
In-Reply-To: <1320067830-12093-1-git-send-email-kwolf@redhat.com>

From: Paolo Bonzini <pbonzini@redhat.com>

Building on the previous patch, this one adds a media change callback
to scsi-disk.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 hw/scsi-bus.c  |    5 +++++
 hw/scsi-disk.c |   29 ++++++++++++++++++++++++++++-
 hw/scsi.h      |    2 ++
 3 files changed, 35 insertions(+), 1 deletions(-)

diff --git a/hw/scsi-bus.c b/hw/scsi-bus.c
index c190509..867b1a8 100644
--- a/hw/scsi-bus.c
+++ b/hw/scsi-bus.c
@@ -847,6 +847,11 @@ const struct SCSISense sense_code_RESET = {
     .key = UNIT_ATTENTION, .asc = 0x29, .ascq = 0x00
 };
 
+/* Unit attention, No medium */
+const struct SCSISense sense_code_UNIT_ATTENTION_NO_MEDIUM = {
+    .key = UNIT_ATTENTION, .asc = 0x3a, .ascq = 0x00
+};
+
 /* Unit attention, Medium may have changed */
 const struct SCSISense sense_code_MEDIUM_CHANGED = {
     .key = UNIT_ATTENTION, .asc = 0x28, .ascq = 0x00
diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c
index a6ef060..880cb22 100644
--- a/hw/scsi-disk.c
+++ b/hw/scsi-disk.c
@@ -71,6 +71,7 @@ struct SCSIDiskState
     int cluster_size;
     uint32_t removable;
     uint64_t max_lba;
+    bool media_changed;
     QEMUBH *bh;
     char *version;
     char *serial;
@@ -1198,7 +1199,21 @@ static void scsi_destroy(SCSIDevice *dev)
 
 static void scsi_cd_change_media_cb(void *opaque, bool load)
 {
-    ((SCSIDiskState *)opaque)->tray_open = !load;
+    SCSIDiskState *s = opaque;
+
+    /*
+     * When a CD gets changed, we have to report an ejected state and
+     * then a loaded state to guests so that they detect tray
+     * open/close and media change events.  Guests that do not use
+     * GET_EVENT_STATUS_NOTIFICATION to detect such tray open/close
+     * states rely on this behavior.
+     *
+     * media_changed governs the state machine used for unit attention
+     * report.  media_event is used by GET EVENT STATUS NOTIFICATION.
+     */
+    s->media_changed = load;
+    s->tray_open = !load;
+    s->qdev.unit_attention = SENSE_CODE(UNIT_ATTENTION_NO_MEDIUM);
 }
 
 static bool scsi_cd_is_tray_open(void *opaque)
@@ -1217,6 +1232,15 @@ static const BlockDevOps scsi_cd_block_ops = {
     .is_medium_locked = scsi_cd_is_medium_locked,
 };
 
+static void scsi_disk_unit_attention_reported(SCSIDevice *dev)
+{
+    SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, dev);
+    if (s->media_changed) {
+        s->media_changed = false;
+        s->qdev.unit_attention = SENSE_CODE(MEDIUM_CHANGED);
+    }
+}
+
 static int scsi_initfn(SCSIDevice *dev, uint8_t scsi_type)
 {
     SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, dev);
@@ -1329,6 +1353,7 @@ static SCSIDeviceInfo scsi_disk_info[] = {
         .init         = scsi_hd_initfn,
         .destroy      = scsi_destroy,
         .alloc_req    = scsi_new_request,
+        .unit_attention_reported = scsi_disk_unit_attention_reported,
         .qdev.props   = (Property[]) {
             DEFINE_SCSI_DISK_PROPERTIES(),
             DEFINE_PROP_BIT("removable", SCSIDiskState, removable, 0, false),
@@ -1343,6 +1368,7 @@ static SCSIDeviceInfo scsi_disk_info[] = {
         .init         = scsi_cd_initfn,
         .destroy      = scsi_destroy,
         .alloc_req    = scsi_new_request,
+        .unit_attention_reported = scsi_disk_unit_attention_reported,
         .qdev.props   = (Property[]) {
             DEFINE_SCSI_DISK_PROPERTIES(),
             DEFINE_PROP_END_OF_LIST(),
@@ -1356,6 +1382,7 @@ static SCSIDeviceInfo scsi_disk_info[] = {
         .init         = scsi_disk_initfn,
         .destroy      = scsi_destroy,
         .alloc_req    = scsi_new_request,
+        .unit_attention_reported = scsi_disk_unit_attention_reported,
         .qdev.props   = (Property[]) {
             DEFINE_SCSI_DISK_PROPERTIES(),
             DEFINE_PROP_BIT("removable", SCSIDiskState, removable, 0, false),
diff --git a/hw/scsi.h b/hw/scsi.h
index 6d40b8e..7004aaa 100644
--- a/hw/scsi.h
+++ b/hw/scsi.h
@@ -161,6 +161,8 @@ extern const struct SCSISense sense_code_IO_ERROR;
 extern const struct SCSISense sense_code_I_T_NEXUS_LOSS;
 /* Command aborted, Logical Unit failure */
 extern const struct SCSISense sense_code_LUN_FAILURE;
+/* LUN not ready, Medium not present */
+extern const struct SCSISense sense_code_UNIT_ATTENTION_NO_MEDIUM;
 /* Unit attention, Power on, reset or bus device reset occurred */
 extern const struct SCSISense sense_code_RESET;
 /* Unit attention, Medium may have changed*/
-- 
1.7.6.4

^ permalink raw reply related

* Re: [bisected] i915 dpms does not switch back light on
From: Wouter M. Koolen @ 2011-10-31 13:57 UTC (permalink / raw)
  To: Alex Davis; +Cc: linux-kernel@vger.kernel.org
In-Reply-To: <1319747904.1731.YahooMailNeo@web130113.mail.mud.yahoo.com>

On 10/27/2011 09:38 PM, Alex Davis wrote:
> If the patch above doesn't work, try this one:
>
> diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
> index 6f56676..a9e0c7b 100644
> --- a/drivers/gpu/drm/i915/intel_panel.c
> +++ b/drivers/gpu/drm/i915/intel_panel.c
> @@ -262,6 +262,8 @@ void intel_panel_disable_backlight(struct drm_device *dev)
>                  dev_priv->backlight_level = intel_panel_get_backlight(dev);
>                  dev_priv->backlight_enabled = false;
>          }
> +
> +       intel_panel_set_backlight(dev, 0);
>   }
>   
>   void intel_panel_enable_backlight(struct drm_device *dev)
Hi Alex,

That indeed solves the problem here.

Thanks for your swift response.

Wouter

^ permalink raw reply

* [U-Boot] [PATCH 0/3] netspace_v2: fixes and features
From: Simon Guinot @ 2011-10-31 13:58 UTC (permalink / raw)
  To: u-boot

From: Simon Guinot <simon.guinot@sequanux.org>

This patch series provides some bug fixes and features for the
Network Space v2 machine (and parents).

Simon Guinot (3):
  netspace_v2: fix SDRAM configuration
  netspace_v2: enable I2C EEPROM support
  netspace_v2: Read Ethernet MAC address from EEPROM

 board/LaCie/netspace_v2/kwbimage-is2.cfg      |  162 +++++++++++++++++++++++++
 board/LaCie/netspace_v2/kwbimage.cfg          |    4 +-
 board/LaCie/netspace_v2/netspace_v2.c         |   43 +++++++
 include/configs/netspace_v2.h                 |   19 +++-
 4 files changed, 225 insertions(+), 3 deletions(-)
 delete mode 100644 arch/arm/cpu/arm926ejs/kirkwood/asm-offsets.s
 create mode 100644 board/LaCie/netspace_v2/kwbimage-is2.cfg

-- 
1.7.5.1

^ permalink raw reply

* [U-Boot] [PATCH 1/3] netspace_v2: fix SDRAM configuration
From: Simon Guinot @ 2011-10-31 13:58 UTC (permalink / raw)
  To: u-boot
In-Reply-To: <1320069516-2105-1-git-send-email-simon@sequanux.org>

From: Simon Guinot <simon.guinot@sequanux.org>

Network Space (Max) v2 and Internet Space v2 boards have different
SDRAM configuration and size: respectively 256MB (DDR2??1Gb, 128Mbx8
organisation) and 128MB (DDR2??512Mb, 64Mbx8 organisation). To handle
the differences, this patch add a dedicated kwimage.cfg file for
Internet Space v2.

Additionnaly the number of SDRAM banks is fixed.

Signed-off-by: Simon Guinot <simon.guinot@sequanux.org>
---
 board/LaCie/netspace_v2/kwbimage-is2.cfg |  162 ++++++++++++++++++++++++++++++
 board/LaCie/netspace_v2/kwbimage.cfg     |    4 +-
 include/configs/netspace_v2.h            |    7 +-
 3 files changed, 170 insertions(+), 3 deletions(-)
 create mode 100644 board/LaCie/netspace_v2/kwbimage-is2.cfg

diff --git a/board/LaCie/netspace_v2/kwbimage-is2.cfg b/board/LaCie/netspace_v2/kwbimage-is2.cfg
new file mode 100644
index 0000000..590720a
--- /dev/null
+++ b/board/LaCie/netspace_v2/kwbimage-is2.cfg
@@ -0,0 +1,162 @@
+#
+# Copyright (C) 2011 Simon Guinot <sguinot@lacie.com>
+#
+# Based on Kirkwood support:
+# (C) Copyright 2009
+# Marvell Semiconductor <www.marvell.com>
+# Written-by: Prafulla Wadaskar <prafulla@marvell.com>
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# Refer docs/README.kwimage for more details about how-to configure
+# and create kirkwood boot image
+#
+
+# Boot Media configurations
+BOOT_FROM	spi	# Boot from SPI flash
+
+# SOC registers configuration using bootrom header extension
+# Maximum KWBIMAGE_MAX_CONFIG configurations allowed
+
+# Configure RGMII-0 interface pad voltage to 1.8V
+DATA 0xFFD100e0 0x1B1B1B9B
+
+#Dram initalization for SINGLE x16 CL=5 @ 400MHz
+DATA 0xFFD01400 0x43000618	# DDR Configuration register
+# bit13-0:  0xa00 (2560 DDR2 clks refresh rate)
+# bit23-14: zero
+# bit24: 1= enable exit self refresh mode on DDR access
+# bit25: 1 required
+# bit29-26: zero
+# bit31-30: 01
+
+DATA 0xFFD01404 0x35143000	# DDR Controller Control Low
+# bit 4:    0=addr/cmd in smame cycle
+# bit 5:    0=clk is driven during self refresh, we don't care for APX
+# bit 6:    0=use recommended falling edge of clk for addr/cmd
+# bit14:    0=input buffer always powered up
+# bit18:    1=cpu lock transaction enabled
+# bit23-20: 5=recommended value for CL=5 and STARTBURST_DEL disabled bit31=0
+# bit27-24: 8= CL+3, STARTBURST sample stages, for freqs 400MHz, unbuffered DIMM
+# bit30-28: 3 required
+# bit31:    0=no additional STARTBURST delay
+
+DATA 0xFFD01408 0x11012228	# DDR Timing (Low) (active cycles value +1)
+# bit7-4:   TRCD
+# bit11- 8: TRP
+# bit15-12: TWR
+# bit19-16: TWTR
+# bit20:    TRAS msb
+# bit23-21: 0x0
+# bit27-24: TRRD
+# bit31-28: TRTP
+
+DATA 0xFFD0140C 0x00000A19	#  DDR Timing (High)
+# bit6-0:   TRFC
+# bit8-7:   TR2R
+# bit10-9:  TR2W
+# bit12-11: TW2W
+# bit31-13: zero required
+
+DATA 0xFFD01410 0x00000008	#  DDR Address Control
+# bit1-0:   00, Cs0width=x8
+# bit3-2:   10, Cs0size=512Mb
+# bit5-4:   00, Cs2width=nonexistent
+# bit7-6:   00, Cs1size =nonexistent
+# bit9-8:   00, Cs2width=nonexistent
+# bit11-10: 00, Cs2size =nonexistent
+# bit13-12: 00, Cs3width=nonexistent
+# bit15-14: 00, Cs3size =nonexistent
+# bit16:    0,  Cs0AddrSel
+# bit17:    0,  Cs1AddrSel
+# bit18:    0,  Cs2AddrSel
+# bit19:    0,  Cs3AddrSel
+# bit31-20: 0 required
+
+DATA 0xFFD01414 0x00000000	#  DDR Open Pages Control
+# bit0:    0,  OpenPage enabled
+# bit31-1: 0 required
+
+DATA 0xFFD01418 0x00000000	#  DDR Operation
+# bit3-0:   0x0, DDR cmd
+# bit31-4:  0 required
+
+DATA 0xFFD0141C 0x00000632	#  DDR Mode
+# bit2-0:   2, BurstLen=2 required
+# bit3:     0, BurstType=0 required
+# bit6-4:   4, CL=5
+# bit7:     0, TestMode=0 normal
+# bit8:     0, DLL reset=0 normal
+# bit11-9:  6, auto-precharge write recovery ????????????
+# bit12:    0, PD must be zero
+# bit31-13: 0 required
+
+DATA 0xFFD01420 0x00000004	#  DDR Extended Mode
+# bit0:    0,  DDR DLL enabled
+# bit1:    1,  DDR drive strenght reduced
+# bit2:    1,  DDR ODT control lsd enabled
+# bit5-3:  000, required
+# bit6:    1,  DDR ODT control msb, enabled
+# bit9-7:  000, required
+# bit10:   0,  differential DQS enabled
+# bit11:   0, required
+# bit12:   0, DDR output buffer enabled
+# bit31-13: 0 required
+
+DATA 0xFFD01424 0x0000F07F	#  DDR Controller Control High
+# bit2-0:  111, required
+# bit3  :  1  , MBUS Burst Chop disabled
+# bit6-4:  111, required
+# bit7  :  1  , D2P Latency enabled
+# bit8  :  1  , add writepath sample stage, must be 1 for DDR freq >= 300MHz
+# bit9  :  0  , no half clock cycle addition to dataout
+# bit10 :  0  , 1/4 clock cycle skew enabled for addr/ctl signals
+# bit11 :  0  , 1/4 clock cycle skew disabled for write mesh
+# bit15-12: 1111 required
+# bit31-16: 0    required
+
+DATA 0xFFD01428 0x00085520	# DDR2 ODT Read Timing (default values)
+DATA 0xFFD0147C 0x00008552	# DDR2 ODT Write Timing (default values)
+
+DATA 0xFFD01500 0x00000000	# CS[0]n Base address to 0x0
+DATA 0xFFD01504 0x07FFFFF1	# CS[0]n Size
+# bit0:    1,  Window enabled
+# bit1:    0,  Write Protect disabled
+# bit3-2:  00, CS0 hit selected
+# bit23-4: ones, required
+# bit31-24: 0x07, Size (i.e. 128MB)
+
+DATA 0xFFD0150C 0x00000000	# CS[1]n Size, window disabled
+DATA 0xFFD01514 0x00000000	# CS[2]n Size, window disabled
+DATA 0xFFD0151C 0x00000000	# CS[3]n Size, window disabled
+
+DATA 0xFFD01494 0x00010000	#  DDR ODT Control (Low)
+# bit3-0:  1, ODT0Rd, MODT[0] asserted during read from DRAM CS0
+# bit19-16:1, ODT0Wr, MODT[0] asserted during write to DRAM CS0
+
+DATA 0xFFD01498 0x00000000	#  DDR ODT Control (High)
+# bit1-0:  00, ODT0 controlled by ODT Control (low) register above
+# bit3-2:  01, ODT1 active NEVER!
+# bit31-4: zero, required
+
+DATA 0xFFD0149C 0x0000E40F	# CPU ODT Control
+# bit3-0:  1, ODT0Rd, Internal ODT asserted during read from DRAM bank0
+# bit7-4:  1, ODT0Wr, Internal ODT asserted during write to DRAM bank0
+# bit11-10:1, DQ_ODTSel. ODT select turned on
+
+DATA 0xFFD01480 0x00000001	# DDR Initialization Control
+#bit0=1, enable DDR init upon this register write
+
+# End of Header extension
+DATA 0x0 0x0
diff --git a/board/LaCie/netspace_v2/kwbimage.cfg b/board/LaCie/netspace_v2/kwbimage.cfg
index 361feeb..7e53649 100644
--- a/board/LaCie/netspace_v2/kwbimage.cfg
+++ b/board/LaCie/netspace_v2/kwbimage.cfg
@@ -69,8 +69,8 @@ DATA 0xFFD0140C 0x00000A19	#  DDR Timing (High)
 # bit12-11: TW2W
 # bit31-13: zero required
 
-DATA 0xFFD01410 0x0000CCCC	#  DDR Address Control
-# bit1-0:   01, Cs0width=x16
+DATA 0xFFD01410 0x0000000C	#  DDR Address Control
+# bit1-0:   00, Cs0width=x8
 # bit3-2:   11, Cs0size=1Gb
 # bit5-4:   00, Cs2width=nonexistent
 # bit7-6:   00, Cs1size =nonexistent
diff --git a/include/configs/netspace_v2.h b/include/configs/netspace_v2.h
index 82a1233..5790602 100644
--- a/include/configs/netspace_v2.h
+++ b/include/configs/netspace_v2.h
@@ -60,11 +60,16 @@
  */
 #define CONFIG_SYS_TCLK			166000000 /* 166MHz */
 
+#define CONFIG_NR_DRAM_BANKS		1
+#ifdef CONFIG_INETSPACE_V2
+/* Different SDRAM configuration and size for Internet Space v2 */
+#define CONFIG_SYS_KWD_CONFIG ($(SRCTREE)/$(CONFIG_BOARDDIR)/kwbimage-is2.cfg)
+#endif
+
 /*
  * mv-common.h should be defined after CMD configs since it used them
  * to enable certain macros
  */
-#define CONFIG_NR_DRAM_BANKS		2
 #include "mv-common.h"
 
 /* Remove or override few declarations from mv-common.h */
-- 
1.7.5.1

^ permalink raw reply related

* [U-Boot] [PATCH 2/3] netspace_v2: enable I2C EEPROM support
From: Simon Guinot @ 2011-10-31 13:58 UTC (permalink / raw)
  To: u-boot
In-Reply-To: <1320069516-2105-1-git-send-email-simon@sequanux.org>

From: Simon Guinot <simon.guinot@sequanux.org>

An I2C EEPROM HT24LC04 (512B) is available on the netspace_v2 board
(and parents). This EEPROM hold data such as Ethernet MAC addresses
and power flags.

Signed-off-by: Simon Guinot <simon.guinot@sequanux.org>
---
 include/configs/netspace_v2.h |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/include/configs/netspace_v2.h b/include/configs/netspace_v2.h
index 5790602..bb27ed7 100644
--- a/include/configs/netspace_v2.h
+++ b/include/configs/netspace_v2.h
@@ -108,6 +108,17 @@
 #define CONFIG_KIRKWOOD_GPIO
 
 /*
+ * Enable I2C support
+ */
+#ifdef CONFIG_CMD_I2C
+/* I2C EEPROM HT24LC04 (512B - 32 pages of 16 Bytes) */
+#define CONFIG_CMD_EEPROM
+#define CONFIG_SYS_I2C_EEPROM_ADDR		0x50
+#define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS	4 /* 16-byte page size */
+#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN		1 /* 8-bit device address */
+#endif /* CONFIG_CMD_I2C */
+
+/*
  * File systems support
  */
 #define CONFIG_CMD_EXT2
-- 
1.7.5.1

^ permalink raw reply related

* [U-Boot] [PATCH 3/3] netspace_v2: Read Ethernet MAC address from EEPROM
From: Simon Guinot @ 2011-10-31 13:58 UTC (permalink / raw)
  To: u-boot
In-Reply-To: <1320069516-2105-1-git-send-email-simon@sequanux.org>

From: Simon Guinot <simon.guinot@sequanux.org>

Signed-off-by: Simon Guinot <simon.guinot@sequanux.org>
---
 board/LaCie/netspace_v2/netspace_v2.c         |   43 +++++++++++++++++++++++++
 include/configs/netspace_v2.h                 |    1 +
 2 files changed, 44 insertions(+), 0 deletions(-)
 delete mode 100644 arch/arm/cpu/arm926ejs/kirkwood/asm-offsets.s

diff --git a/arch/arm/cpu/arm926ejs/kirkwood/asm-offsets.s b/arch/arm/cpu/arm926ejs/kirkwood/asm-offsets.s
deleted file mode 100644
index e69de29..0000000
diff --git a/board/LaCie/netspace_v2/netspace_v2.c b/board/LaCie/netspace_v2/netspace_v2.c
index 7c4b15e..a7717b9 100644
--- a/board/LaCie/netspace_v2/netspace_v2.c
+++ b/board/LaCie/netspace_v2/netspace_v2.c
@@ -24,6 +24,7 @@
 #include <miiphy.h>
 #include <netdev.h>
 #include <command.h>
+#include <i2c.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/kirkwood.h>
 #include <asm/arch/mpp.h>
@@ -89,6 +90,48 @@ int board_init(void)
 	return 0;
 }
 
+int misc_init_r(void)
+{
+#ifdef CONFIG_CMD_I2C
+	if (!getenv("ethaddr")) {
+		ushort version;
+		uchar mac[6];
+		int ret;
+
+		/* I2C-0 for on-board EEPROM */
+		i2c_set_bus_num(0);
+
+		/* Check layout version for EEPROM data */
+		ret = i2c_read(CONFIG_SYS_I2C_EEPROM_ADDR, 0,
+				CONFIG_SYS_I2C_EEPROM_ADDR_LEN,
+				(uchar *) &version, 2);
+		if (ret != 0) {
+			printf("Error: failed to read I2C EEPROM @%02x\n",
+				CONFIG_SYS_I2C_EEPROM_ADDR);
+			return ret;
+		}
+		version = be16_to_cpu(version);
+		if (version < 1 || version > 3) {
+			printf("Error: unknown version %d for EEPROM data\n",
+				version);
+			return -1;
+		}
+
+		/* Read Ethernet MAC address from EEPROM */
+		ret = i2c_read(CONFIG_SYS_I2C_EEPROM_ADDR, 2,
+				CONFIG_SYS_I2C_EEPROM_ADDR_LEN, mac, 6);
+		if (ret != 0) {
+			printf("Error: failed to read I2C EEPROM @%02x\n",
+				CONFIG_SYS_I2C_EEPROM_ADDR);
+			return ret;
+		}
+		eth_setenv_enetaddr("ethaddr", mac);
+	}
+#endif /* CONFIG_CMD_I2C */
+
+	return 0;
+}
+
 void mv_phy_88e1116_init(char *name)
 {
 	u16 reg;
diff --git a/include/configs/netspace_v2.h b/include/configs/netspace_v2.h
index bb27ed7..1ddf4b4 100644
--- a/include/configs/netspace_v2.h
+++ b/include/configs/netspace_v2.h
@@ -87,6 +87,7 @@
  * Ethernet Driver configuration
  */
 #ifdef CONFIG_CMD_NET
+#define CONFIG_MISC_INIT_R /* Call misc_init_r() to initialize MAC address */
 #define CONFIG_MVGBE_PORTS		{1, 0} /* enable port 0 only */
 #define CONFIG_NETCONSOLE
 #endif
-- 
1.7.5.1

^ permalink raw reply related

* Re: [Xenomai-help] configuring user-space xenomai 2.6
From: Łukasz Sacha @ 2011-10-31 13:58 UTC (permalink / raw)
  To: xenomai
In-Reply-To: <4EAEA88E.3030500@domain.hid>

On Mon, Oct 31, 2011 at 14:54, Gilles Chanteperdrix
<gilles.chanteperdrix@xenomai.org> wrote:
> To start using xenomai, you simply have to run make install, then copy
> the installed file to the embedded root filesystem.

So both skins are included in xenomai by default and which I chose
depends on my lking only (assuming both are switched on in the
kernel)?

> I already gave you URLs for documents giving a bit more details on how
> to use the native and posix skins.
yes, thank you.

> Also, could you avoid top-posting?
Yes, of course. Sorry about that.

regards,
-- 
LS


^ permalink raw reply

* Re: [MIPS]clocks_calc_mult_shift() may gen a too big mult value
From: zhangfx @ 2011-10-31 13:59 UTC (permalink / raw)
  To: John Stultz
  Cc: Chen Jie, Yong Zhang, linux-mips, LKML, tglx, yanhua,
	项宇, 孙海勇
In-Reply-To: <1320066197.2266.11.camel@js-netbook>

Dear Sirs,
>> Thanks for the suggestion. And sorry for I didn't notice the upstream
>> code has already hooked to clocksource_register_hz() in csrc-r4k.c
>> (We're using r4000 clock source)
>>
>> I'm afraid this still doesn't fix my case. Through
>> clocksource_register_hz()->__clocksource_register_scale()->__clocksource_updatefreq_scale,
>> I got a calculated maxsec = (0xffffffff - (0xffffffff>>5))/250000500 =
>> 16        # assume mips_hpt_frequency=250000500
>>
>> With this maxsec, I got a mult of 0xffffde72, still too big.
> Hrmm. Yong Zang is right to suggest clocksource_register_hz(), as the
> intention of that code is to try to avoid these sorts of issues.
>
> What is the corresponding shift value you're getting for the value
> above?
>
> Could you annotate clocks_calc_mult_shift() a little bit to see where
> things might be going wrong?
Let me give some real world data:
in one machine with 500MHz freq,
the calculated freq = 500084016, and clocks_calc_mult_shift() give
   mult = 4294245725
   shift = 30

but in the 1785th call to update_wall_time, due to error correction 
algorithm, the mult become 4293964632,
in next update_wall_time, the ntp_error is 0x301c93b7927c, which lead to 
an adj of 20, then mult is overflow:
    mult = 4293964632 + (1<<20) = 45912
with this mult, if anyone call timekeeping_get_ns or others using mult, 
the time concept will be extremely wrong, so some sleep will 
(almost)never return => virtually hang

We are not abosulately sure that the error source is normal, but anyway 
it is a possible for the code to overflow, and it will cause hang.

For this case, the timekeeping_bigadjust should be able to control adj 
to a maximum of around 20 with the lookahead for any error. So if the 
mult is chosen at shift = 29, then mult becomes 4294245725/2, it will 
not be possible to be overflowed.

In short, choosing a mult close to 2^32 is dangerous. But I don't know 
what's the best way to avoid it for general cases, because I don't know 
how big error can be and the adj can be for different systems.

Regards

Yours
Fuxin Zhang

>
> thanks
> -john
>
>

^ permalink raw reply

* Re: [GIT PULL] Queue free fix (was Re: [PATCH] block: Free queue resources at blk_release_queue())
From: Mike Snitzer @ 2011-10-31 14:01 UTC (permalink / raw)
  To: Heiko Carstens
  Cc: James Bottomley, Jun'ichi Nomura, Steffen Maier,
	linux-scsi@vger.kernel.org, Jens Axboe, Hannes Reinecke,
	Linux Kernel, Alan Stern, Thadeu Lima de Souza Cascardo,
	Taraka R. Bodireddy, Seshagiri N. Ippili,
	Manvanthara B. Puttashankar, Jeff Moyer, Shaohua Li, gmuelas,
	dm-devel
In-Reply-To: <20111031134050.GC4768@osiris.boeblingen.de.ibm.com>

On Mon, Oct 31 2011 at  9:40am -0400,
Heiko Carstens <heiko.carstens@de.ibm.com> wrote:

> On Mon, Oct 31, 2011 at 09:21:58AM -0400, Mike Snitzer wrote:
> > > > It _looks_ like we do not hit the BUG_ON() that. This time we get this instead:
> > > > 
> > > > [ 4024.937870] Unable to handle kernel pointer dereference at virtual kernel address 000003e004d41000
> > > > [ 4024.937886] Oops: 0011 [#1] PREEMPT SMP DEBUG_PAGEALLOC
> > > > [ 4024.937899] Modules linked in: dm_round_robin sunrpc ipv6 qeth_l2 binfmt_misc dm_multipath scsi_dh dm_mod qeth ccwgroup [las
> > > > t unloaded: scsi_wait_scan]
> > > > [ 4024.937925] CPU: 1 Not tainted 3.0.7-50.x.20111021-s390xdefault #1
> > > > [ 4024.937930] Process ksoftirqd/1 (pid: 1942, task: 0000000079c6c750, ksp: 0000000073adfc50)
> > > > [ 4024.937936] Krnl PSW : 0704000180000000 000003e00126263a (dm_softirq_done+0x72/0x140 [dm_mod])
> > > > [ 4024.937959]            R:0 T:1 IO:1 EX:1 Key:0 M:1 W:0 P:0 AS:0 CC:0 PM:0 EA:3
> > > > [ 4024.937966] Krnl GPRS: 000000007b9156b0 000003e004d41100 000000000e14b600 000000000000006d
> > > > [ 4024.937971]            00000000715332b0 000000000c140ce8 000000000090d2ef 0000000000000005
> > > > [ 4024.937977]            0000000000000001 0000000000000101 000000000c140d00 0000000000000000
> > > > [ 4024.937983]            000003e001260000 000003e00126f098 0000000073adfd08 0000000073adfcb8
> > > > [ 4024.938001] Krnl Code: 000003e00126262a: f0a0000407f1        srp     4(11,%r0),2033,0
> > > > [ 4024.938009]            000003e001262630: e31050080004        lg      %r1,8(%r5)
> > > > [ 4024.938017]            000003e001262636: 58b05180            l       %r11,384(%r5)
> > > > [ 4024.938024]           >000003e00126263a: e31010080004        lg      %r1,8(%r1)
> > > > [ 4024.938031]            000003e001262640: e31010500004        lg      %r1,80(%r1)
> > > > [ 4024.938038]            000003e001262646: b9020011            ltgr    %r1,%r1
> > > > [ 4024.938045]            000003e00126264a: a784ffdf            brc     8,3e001262608
> > > > [ 4024.938053]            000003e00126264e: e32050080004        lg      %r2,8(%r5)
> > > > [ 4024.938060] Call Trace:
> > > > [ 4024.938063] ([<070000000040716c>] 0x70000000040716c)
> > > > [ 4024.938069]  [<000000000040d29c>] blk_done_softirq+0xd4/0xf0
> > > > [ 4024.938080]  [<00000000001587c2>] __do_softirq+0xda/0x398
> > > > [ 4024.938088]  [<0000000000158ba0>] run_ksoftirqd+0x120/0x23c
> > > > [ 4024.938095]  [<000000000017c2aa>] kthread+0xa6/0xb0
> > > > [ 4024.938102]  [<000000000061970e>] kernel_thread_starter+0x6/0xc
> > > > [ 4024.938112]  [<0000000000619708>] kernel_thread_starter+0x0/0xc
> > > > [ 4024.938118] INFO: lockdep is turned off.
> > > > [ 4024.938121] Last Breaking-Event-Address:
> > > > [ 4024.938124]  [<000003e001262600>] dm_softirq_done+0x38/0x140 [dm_mod]
> > > > [ 4024.938135]  
> > > > [ 4024.938139] Kernel panic - not syncing: Fatal exception in interrupt
> > > > [ 4024.938144] CPU: 1 Tainted: G      D     3.0.7-50.x.20111021-s390xdefault #1
> > > > [ 4024.938150] Process ksoftirqd/1 (pid: 1942, task: 0000000079c6c750, ksp: 0000000073adfc50)
> > > > [ 4024.938155] 0000000073adf958 0000000073adf8d8 0000000000000002 0000000000000000 
> > > > [ 4024.938164]        0000000073adf978 0000000073adf8f0 0000000073adf8f0 000000000061386a 
> > > > [ 4024.938174]        0000000000000000 0000000000000000 0000000000000005 0000000000100ec6 
> > > > [ 4024.938184]        000000000000000d 000000000000000c 0000000073adf940 0000000000000000 
> > > > [ 4024.938194]        0000000000000000 0000000000100a18 0000000073adf8d8 0000000073adf918 
> > > > [ 4024.938205] Call Trace:
> > > > [ 4024.938208] ([<0000000000100926>] show_trace+0xee/0x144)
> > > > [ 4024.938216]  [<0000000000613694>] panic+0xb0/0x234
> > > > [ 4024.938224]  [<0000000000100ec6>] die+0x15a/0x168
> > > > [ 4024.938230]  [<000000000011fb9e>] do_no_context+0xba/0xf8
> > > > [ 4024.938306]  [<000000000061c074>] do_dat_exception+0x378/0x3e4
> > > > [ 4024.938314]  [<0000000000619e02>] pgm_exit+0x0/0x4
> > > > [ 4024.938319]  [<000003e00126263a>] dm_softirq_done+0x72/0x140 [dm_mod]
> > > > [ 4024.938329] ([<070000000040716c>] 0x70000000040716c)
> > > > [ 4024.938334]  [<000000000040d29c>] blk_done_softirq+0xd4/0xf0
> > > > [ 4024.938341]  [<00000000001587c2>] __do_softirq+0xda/0x398
> > > > [ 4024.938347]  [<0000000000158ba0>] run_ksoftirqd+0x120/0x23c
> > > > [ 4024.938354]  [<000000000017c2aa>] kthread+0xa6/0xb0
> > > > [ 4024.938360]  [<000000000061970e>] kernel_thread_starter+0x6/0xc
> > > > [ 4024.938366]  [<0000000000619708>] kernel_thread_starter+0x0/0xc
> > > > [ 4024.938373] INFO: lockdep is turned off.
> > > > 
> > > > So we thought we might as well upgrade to 3.1 but immediately got a
> > > > 
> > > > kernel BUG at block/blk-flush.c:323!
> > > > 
> > > > which was handled here https://lkml.org/lkml/2011/10/4/105 and
> > > > here https://lkml.org/lkml/2011/10/12/408 .
> > > > 
> > > > But no patches for that one went upstream AFAICS.
> > > 
> > > Well, all I can say is "hm".  You put only a BUG_ON() in the code, which
> > > wasn't triggered, but now we get a completely different oops.  However,
> > > I think it does point to the dm barrier handling code.  Can you turn off
> > > barriers and see if all oopses go away?
> > 
> > There are two 3.1-stable fixes from Jeff Moyer that Jens staged for
> > Linus to pick up (but seems Jens hasn't sent his 3.2 pull to Linus yet):
> > 
> > http://git.kernel.dk/?p=linux-block.git;a=commit;h=8f02b3a09b1b7d2a4d24b8cd7008f2a441f19a14
> > http://git.kernel.dk/?p=linux-block.git;a=commit;h=f26d8f0562da76731cb049943a0e9d9fa81d946a
> 
> Those two fixes would only address the "kernel BUG at block/blk-flush.c:323!" but not the
> crash report above, right?

Right.

> Since looking at the changelog they refer to a patch that went in with 3.1-rc1 while the
> crash report above is with 3.0.7. Oh well...

Good data point.  This is the second request-based DM report I've seen
now with 3.0 (first was with fedora on btrfs and request-based DM).

Will look closer but it should be noted that DM didn't change
significantly in 3.0.  So it is likely a lingering oversight from the
block changes introduced for onstack plugging (from 2.6.39) or some
other change.

^ permalink raw reply

* [PATCH 00/11] Memory/resource leaks and unchecked return fixes
From: Jes.Sorensen @ 2011-10-31 14:02 UTC (permalink / raw)
  To: neilb; +Cc: linux-raid

From: Jes Sorensen <Jes.Sorensen@redhat.com>

Hi,

This is another pile of patches to fixup memory leaks and buffer
overflows found in the coverity run. 

Cheers,
Jes


Jes Sorensen (11):
  Fix memory leaks in reshape_array()
  Fix memory leak
  Fix memory leak
  Fix memory leak of 'st3' in array_try_spare()
  partition_try_spare() use closedir() to release DIR * returned by
    opendir()
  Fix memory leak
  Add missing return in case of trying to grow sub-array
  Avoid memory leak
  policy_add(): Add missing va_end()
  Write_rules(): Avoid stack corruption if using extremely long udev
    pathname
  mdmon(): Error out if failing to connect to victim monitor

 Assemble.c    |    1 +
 Detail.c      |    1 +
 Grow.c        |   16 ++++++++++++++--
 Incremental.c |    6 +++++-
 mdmon.c       |    8 +++++++-
 policy.c      |    4 +++-
 super-gpt.c   |    4 +++-
 super-intel.c |    1 +
 8 files changed, 35 insertions(+), 6 deletions(-)

-- 
1.7.6.4


^ permalink raw reply

* [PATCH 01/11] Fix memory leaks in reshape_array()
From: Jes.Sorensen @ 2011-10-31 14:02 UTC (permalink / raw)
  To: neilb; +Cc: linux-raid
In-Reply-To: <1320069759-13361-1-git-send-email-Jes.Sorensen@redhat.com>

From: Jes Sorensen <Jes.Sorensen@redhat.com>

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
---
 Grow.c |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/Grow.c b/Grow.c
index 08581d2..05350dd 100644
--- a/Grow.c
+++ b/Grow.c
@@ -1882,8 +1882,8 @@ static int reshape_array(char *container, int fd, char *devname,
 	struct mddev_dev *dv;
 	int added_disks;
 
-	int *fdlist;
-	unsigned long long *offsets;
+	int *fdlist = NULL;
+	unsigned long long *offsets = NULL;
 	int d;
 	int nrdisks;
 	int err;
@@ -2339,6 +2339,9 @@ started:
 		abort_reshape(sra);
 		goto release;
 	default:
+		free(fdlist);
+		free(offsets);
+		sysfs_free(sra);
 		return 0;
 	case 0:
 		map_fork();
@@ -2366,6 +2369,9 @@ started:
 			d - odisks, fdlist+odisks,
 			offsets+odisks);
 
+	free(fdlist);
+	free(offsets);
+
 	if (backup_file && done)
 		unlink(backup_file);
 	if (!done) {
@@ -2381,6 +2387,7 @@ started:
 		/* no need to wait for the reshape to finish as
 		 * there is nothing more to do.
 		 */
+		sysfs_free(sra);
 		exit(0);
 	}
 	wait_reshape(sra);
@@ -2445,17 +2452,21 @@ started:
 			st->update_tail = NULL;
 	}
 out:
+	sysfs_free(sra);
 	if (forked)
 		return 0;
 	unfreeze(st);
 	exit(0);
 
 release:
+	free(fdlist);
+	free(offsets);
 	if (orig_level != UnSet && sra) {
 		c = map_num(pers, orig_level);
 		if (c && sysfs_set_str(sra, NULL, "level", c) == 0)
 			fprintf(stderr, Name ": aborting level change\n");
 	}
+	sysfs_free(sra);
 	if (!forked)
 		unfreeze(st);
 	return 1;
-- 
1.7.6.4


^ permalink raw reply related

* [PATCH 02/11] Fix memory leak
From: Jes.Sorensen @ 2011-10-31 14:02 UTC (permalink / raw)
  To: neilb; +Cc: linux-raid
In-Reply-To: <1320069759-13361-1-git-send-email-Jes.Sorensen@redhat.com>

From: Jes Sorensen <Jes.Sorensen@redhat.com>

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
---
 Assemble.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/Assemble.c b/Assemble.c
index ac1115d..4ded58c 100644
--- a/Assemble.c
+++ b/Assemble.c
@@ -1375,6 +1375,7 @@ int Assemble(struct supertype *st, char *mddev,
 							sysfs_set_num(sra, NULL,
 								      "stripe_cache_size",
 								      (4 * content->array.chunk_size / 4096) + 1);
+						sysfs_free(sra);
 					}
 				}
 				if (okcnt < (unsigned)content->array.raid_disks) {
-- 
1.7.6.4


^ permalink raw reply related

* [PATCH 03/11] Fix memory leak
From: Jes.Sorensen @ 2011-10-31 14:02 UTC (permalink / raw)
  To: neilb; +Cc: linux-raid
In-Reply-To: <1320069759-13361-1-git-send-email-Jes.Sorensen@redhat.com>

From: Jes Sorensen <Jes.Sorensen@redhat.com>

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
---
 Detail.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/Detail.c b/Detail.c
index ca34abe..c564786 100644
--- a/Detail.c
+++ b/Detail.c
@@ -587,6 +587,7 @@ This is pretty boring
 out:
 	close(fd);
 	free(subarray);
+	sysfs_free(sra);
 	return rv;
 }
 
-- 
1.7.6.4


^ permalink raw reply related

* [PATCH 04/11] Fix memory leak of 'st3' in array_try_spare()
From: Jes.Sorensen @ 2011-10-31 14:02 UTC (permalink / raw)
  To: neilb; +Cc: linux-raid
In-Reply-To: <1320069759-13361-1-git-send-email-Jes.Sorensen@redhat.com>

From: Jes Sorensen <Jes.Sorensen@redhat.com>

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
---
 Incremental.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/Incremental.c b/Incremental.c
index 98a3a74..7e345c5 100644
--- a/Incremental.c
+++ b/Incremental.c
@@ -956,8 +956,10 @@ static int array_try_spare(char *devname, int *dfdp, struct dev_policy *pol,
 			 * to obtain minimum spare size */
 			struct supertype *st3 = dup_super(st2);
 			int mdfd = open_dev(mp->devnum);
-			if (!mdfd)
+			if (!mdfd) {
+				free(st3);
 				goto next;
+			}
 			if (st3->ss->load_container &&
 			    !st3->ss->load_container(st3, mdfd, mp->path)) {
 				component_size = st3->ss->min_acceptable_spare_size(st3);
-- 
1.7.6.4


^ permalink raw reply related

* [PATCH 05/11] partition_try_spare() use closedir() to release DIR * returned by opendir()
From: Jes.Sorensen @ 2011-10-31 14:02 UTC (permalink / raw)
  To: neilb; +Cc: linux-raid
In-Reply-To: <1320069759-13361-1-git-send-email-Jes.Sorensen@redhat.com>

From: Jes Sorensen <Jes.Sorensen@redhat.com>

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
---
 Incremental.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/Incremental.c b/Incremental.c
index 7e345c5..cc50a79 100644
--- a/Incremental.c
+++ b/Incremental.c
@@ -1199,6 +1199,8 @@ static int partition_try_spare(char *devname, int *dfdp, struct dev_policy *pol,
 			close(fd);
 	}
 
+	closedir(dir);
+
 	if (!chosen)
 		return 1;
 
-- 
1.7.6.4


^ permalink raw reply related

* [PATCH 06/11] Fix memory leak
From: Jes.Sorensen @ 2011-10-31 14:02 UTC (permalink / raw)
  To: neilb; +Cc: linux-raid
In-Reply-To: <1320069759-13361-1-git-send-email-Jes.Sorensen@redhat.com>

From: Jes Sorensen <Jes.Sorensen@redhat.com>

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
---
 super-gpt.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/super-gpt.c b/super-gpt.c
index 6f852aa..b8c9aae 100644
--- a/super-gpt.c
+++ b/super-gpt.c
@@ -179,8 +179,10 @@ static struct supertype *match_metadata_desc(char *arg)
 
 	if (!st)
 		return st;
-	if (strcmp(arg, "gpt") != 0)
+	if (strcmp(arg, "gpt") != 0) {
+		free(st);
 		return NULL;
+	}
 
 	st->ss = &gpt;
 	st->info = NULL;
-- 
1.7.6.4


^ permalink raw reply related

* [PATCH 07/11] Add missing return in case of trying to grow sub-array
From: Jes.Sorensen @ 2011-10-31 14:02 UTC (permalink / raw)
  To: neilb; +Cc: linux-raid
In-Reply-To: <1320069759-13361-1-git-send-email-Jes.Sorensen@redhat.com>

From: Jes Sorensen <Jes.Sorensen@redhat.com>

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
---
 Grow.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/Grow.c b/Grow.c
index 05350dd..4ac24a1 100644
--- a/Grow.c
+++ b/Grow.c
@@ -134,6 +134,7 @@ int Grow_Add_device(char *devname, int fd, char *newdev)
 		fprintf(stderr, Name ": Cannot grow linear sub-arrays yet\n");
 		free(subarray);
 		free(st);
+		return 1;
 	}
 
 	nfd = open(newdev, O_RDWR|O_EXCL|O_DIRECT);
-- 
1.7.6.4


^ permalink raw reply related

* [PATCH 08/11] Avoid memory leak
From: Jes.Sorensen @ 2011-10-31 14:02 UTC (permalink / raw)
  To: neilb; +Cc: linux-raid
In-Reply-To: <1320069759-13361-1-git-send-email-Jes.Sorensen@redhat.com>

From: Jes Sorensen <Jes.Sorensen@redhat.com>

In case of second posix_memalign() failing, release memory allocated
in first posix_memalign() call.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
---
 super-intel.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/super-intel.c b/super-intel.c
index 3525dae..1caee70 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -4200,6 +4200,7 @@ static int init_super_imsm_volume(struct supertype *st, mdu_array_info_t *info,
 				__func__);
 			free(super->buf);
 			free(super);
+			free(mpb_new);
 			return 0;
 		}
 		memcpy(mpb_new, mpb, size_old);
-- 
1.7.6.4


^ permalink raw reply related

* [PATCH 09/11] policy_add(): Add missing va_end()
From: Jes.Sorensen @ 2011-10-31 14:02 UTC (permalink / raw)
  To: neilb; +Cc: linux-raid
In-Reply-To: <1320069759-13361-1-git-send-email-Jes.Sorensen@redhat.com>

From: Jes Sorensen <Jes.Sorensen@redhat.com>

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
---
 policy.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/policy.c b/policy.c
index 7959c97..1114286 100644
--- a/policy.c
+++ b/policy.c
@@ -510,6 +510,7 @@ void policy_add(char *type, ...)
 	}
 	pr->next = config_rules;
 	config_rules = pr;
+	va_end(ap);
 }
 
 void policy_free(void)
-- 
1.7.6.4


^ permalink raw reply related

* [PATCH 10/11] Write_rules(): Avoid stack corruption if using extremely long udev pathname
From: Jes.Sorensen @ 2011-10-31 14:02 UTC (permalink / raw)
  To: neilb; +Cc: linux-raid
In-Reply-To: <1320069759-13361-1-git-send-email-Jes.Sorensen@redhat.com>

From: Jes Sorensen <Jes.Sorensen@redhat.com>

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
---
 policy.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/policy.c b/policy.c
index 1114286..cd260c6 100644
--- a/policy.c
+++ b/policy.c
@@ -883,7 +883,8 @@ int Write_rules(char *rule_name)
        char udev_rule_file[PATH_MAX];
 
        if (rule_name) {
-	       strcpy(udev_rule_file, rule_name);
+	       strncpy(udev_rule_file, rule_name, sizeof(udev_rule_file) - 6);
+	       udev_rule_file[sizeof(udev_rule_file) - 6] = '\0';
 	       strcat(udev_rule_file, ".temp");
                fd = creat(udev_rule_file,
                           S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
-- 
1.7.6.4


^ permalink raw reply related

* [PATCH 11/11] mdmon(): Error out if failing to connect to victim monitor
From: Jes.Sorensen @ 2011-10-31 14:02 UTC (permalink / raw)
  To: neilb; +Cc: linux-raid
In-Reply-To: <1320069759-13361-1-git-send-email-Jes.Sorensen@redhat.com>

From: Jes Sorensen <Jes.Sorensen@redhat.com>

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
---
 mdmon.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/mdmon.c b/mdmon.c
index ee68e3c..bdcda0e 100644
--- a/mdmon.c
+++ b/mdmon.c
@@ -457,8 +457,14 @@ static int mdmon(char *devname, int devnum, int must_fork, int takeover)
 	sigaction(SIGPIPE, &act, NULL);
 
 	victim = mdmon_pid(container->devnum);
-	if (victim >= 0)
+	if (victim >= 0) {
 		victim_sock = connect_monitor(container->devname);
+		if (victim_sock < 0) {
+			fprintf(stderr, "mdmon: %s unable to connect monitor\n",
+				container->devname);
+			exit(3);
+		}
+	}
 
 	ignore = chdir("/");
 	if (!takeover && victim > 0 && victim_sock >= 0) {
-- 
1.7.6.4


^ permalink raw reply related

* Re: [PATCH] echo: fix octal escaping with \1...\7
From: Eric Blake @ 2011-10-31 14:03 UTC (permalink / raw)
  To: Paul Gilmartin; +Cc: dash
In-Reply-To: <ACAAFE20-00AB-46BC-BEE4-3BFAA1F0141A@aim.com>

On 10/31/2011 07:35 AM, Paul Gilmartin wrote:
> I used to know a statement in POSIX that builtins should behave
> identically to the executables in /bin (or perhaps /usr/bin)
> except for performance.

Only in regards to standardized use of those utilities.  'echo "\1"' is 
not standardized, so it is allowed to differ between the dash built-in 
and /bin/echo.

-- 
Eric Blake   eblake@redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

^ permalink raw reply

* Re: [PATCH] document 'T' status from git-status
From: Mark Dominus @ 2011-10-31 14:04 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <7vpqhdrdys.fsf@alter.siamese.dyndns.org>


> It is trivial if

Yes, it was very stupid of me to miss that.

> I dunno.
>
> An obvious alternative is to add T next to all occurrences of M in the
> table where we say "M is possible", but unless it is accompanied by an
> explanation "T is just a special case of M", I suspect the resulting
> description would be harder to understand than currently is, and as long
> as the reader understands "T is just a special case of M", then there
> isn't much point adding T everywhere M appears in the table anyway, so...

If you are suggesting that the patch you gave is preferable to actually 
including T in the table, then I agree. Your patch is also better than 
what I sent because it includes the unusual word "filetype", which the 
user is likely to search for after seeing it in the git-status output.

^ permalink raw reply

* Re: ceph on btrfs [was Re: ceph on non-btrfs file systems]
From: Josef Bacik @ 2011-10-31 14:04 UTC (permalink / raw)
  To: Christian Brunner; +Cc: Josef Bacik, Sage Weil, linux-btrfs
In-Reply-To: <CAO47_-8Enj-mBCYJMAonn8Zc2KWtpfGaEkw6aLRye0VhObn9LQ@mail.gmail.com>

On Mon, Oct 31, 2011 at 02:29:44PM +0100, Christian Brunner wrote:
> 2011/10/31 Christian Brunner <chb@muc.de>:
> > 2011/10/31 Christian Brunner <chb@muc.de>:
> >> 2011/10/31 Christian Brunner <chb@muc.de>:
> >>>
> >>> The patch didn't hurt, but I've to tell you that I'm still seeing=
 the
> >>> same old problems. Load is going up again:
> >>>
> >>> =A0PID USER =A0 =A0 =A0PR =A0NI =A0VIRT =A0RES =A0SHR S %CPU %MEM=
 =A0 =A0TIME+ =A0COMMAND
> >>> =A05502 root =A0 =A0 =A020 =A0 0 =A0 =A0 0 =A0 =A00 =A0 =A00 S 52=
=2E5 0.0 106:29.97 btrfs-endio-wri
> >>> =A01976 root =A0 =A0 =A020 =A0 0 =A0601m 211m 1464 S 28.3 0.9 115=
:10.62 ceph-osd
> >>>
> >>> And I have hit our warning again:
> >>>
> >>> [223560.970713] ------------[ cut here ]------------
> >>> [223560.976043] WARNING: at fs/btrfs/inode.c:2118
> >>> btrfs_orphan_commit_root+0xb0/0xc0 [btrfs]()
> >>> [223560.985411] Hardware name: ProLiant DL180 G6
> >>> [223560.990491] Modules linked in: btrfs zlib_deflate libcrc32c s=
unrpc
> >>> bonding ipv6 sg serio_raw pcspkr ghes hed iTCO_wdt iTCO_vendor_su=
pport
> >>> i7core_edac edac_core ixgbe dca mdio iomemory_vsl(P) hpsa squashf=
s
> >>> [last unloaded: scsi_wait_scan]
> >>> [223561.014748] Pid: 2079, comm: ceph-osd Tainted: P
> >>> 3.0.6-1.fits.9.el6.x86_64 #1
> >>> [223561.023874] Call Trace:
> >>> [223561.026738] =A0[<ffffffff8106344f>] warn_slowpath_common+0x7f=
/0xc0
> >>> [223561.033564] =A0[<ffffffff810634aa>] warn_slowpath_null+0x1a/0=
x20
> >>> [223561.040272] =A0[<ffffffffa0282120>] btrfs_orphan_commit_root+=
0xb0/0xc0 [btrfs]
> >>> [223561.048278] =A0[<ffffffffa027ce55>] commit_fs_roots+0xc5/0x1b=
0 [btrfs]
> >>> [223561.055534] =A0[<ffffffff8154c231>] ? mutex_lock+0x31/0x60
> >>> [223561.061666] =A0[<ffffffffa027ddbe>]
> >>> btrfs_commit_transaction+0x3ce/0x820 [btrfs]
> >>> [223561.069876] =A0[<ffffffffa027d1b8>] ? wait_current_trans+0x28=
/0x110 [btrfs]
> >>> [223561.077582] =A0[<ffffffffa027e325>] ? join_transaction+0x25/0=
x250 [btrfs]
> >>> [223561.085065] =A0[<ffffffff81086410>] ? wake_up_bit+0x40/0x40
> >>> [223561.091251] =A0[<ffffffffa025a329>] btrfs_sync_fs+0x59/0xd0 [=
btrfs]
> >>> [223561.098187] =A0[<ffffffffa02abc65>] btrfs_ioctl+0x495/0xd50 [=
btrfs]
> >>> [223561.105120] =A0[<ffffffff8125ed20>] ? inode_has_perm+0x30/0x4=
0
> >>> [223561.111575] =A0[<ffffffff81261a2c>] ? file_has_perm+0xdc/0xf0
> >>> [223561.117924] =A0[<ffffffff8117086a>] do_vfs_ioctl+0x9a/0x5a0
> >>> [223561.124072] =A0[<ffffffff81170e11>] sys_ioctl+0xa1/0xb0
> >>> [223561.129842] =A0[<ffffffff81555702>] system_call_fastpath+0x16=
/0x1b
> >>> [223561.136699] ---[ end trace 176e8be8996f25f6 ]---
> >>
> >> [ Not sending this to the lists, as the attachment is large ].
> >>
> >> I've spent a little time to do some tracing with ftrace. Its outpu=
t
> >> seems to be right (at least as far as I can tell). I hope that its
> >> output can give you an insight on whats going on.
> >>
> >> The interesting PIDs in the trace are:
> >>
> >> =A05502 root =A0 =A0 =A020 =A0 0 =A0 =A0 0 =A0 =A00 =A0 =A00 S 33.=
6 0.0 118:28.37 btrfs-endio-wri
> >> =A05518 root =A0 =A0 =A020 =A0 0 =A0 =A0 0 =A0 =A00 =A0 =A00 S 29.=
3 0.0 41:23.58 btrfs-endio-wri
> >> =A08059 root =A0 =A0 =A020 =A0 0 =A0400m =A048m 2756 S =A08.0 =A00=
=2E2 =A0 8:31.56 ceph-osd
> >> =A07993 root =A0 =A0 =A020 =A0 0 =A0401m =A041m 2808 S 13.6 =A00.2=
 =A0 7:58.38 ceph-osd
> >>
> >
> > [ adding linux-btrfs again ]
> >
> > I've been digging into this a bit further:
> >
> > Attached is another ftrace report that I've filtered for "btrfs_*"
> > calls and limited to CPU0 (this is where PID 5502 was running).
> >
> > From what I can see there is a lot of time consumed in
> > btrfs_reserve_extent(). I this normal?
>=20
> Sorry for spamming, but in the meantime I'm almost certain that the
> problem is inside find_free_extent (called from btrfs_reserve_extent)=
=2E
>=20
> When I'm running ftrace for a sample period of 10s my system is
> wasting a total of 4,2 seconds inside find_free_extent(). Each call t=
o
> find_free_extent() is taking an average of 4 milliseconds to complete=
=2E
> On a recently rebooted system this is only 1-2 us!
>=20
> I'm not sure if the problem is occurring suddenly or slowly over time=
=2E
> (At the moment I suspect that its occurring suddenly, but I still hav=
e
> to investigate this).
>

Ugh ok then this is lxo's problem with our clustering stuff taking way =
too much
time.  I guess it's time to actually take a hard look at that code.  Th=
anks,

Josef=20
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" =
in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [Qemu-devel] [PATCH v2] trace: Add wildcard trace event support
From: Stefan Hajnoczi @ 2011-10-31 14:05 UTC (permalink / raw)
  To: Mark Wu; +Cc: Stefan Hajnoczi, qemu-devel
In-Reply-To: <1320031744-3016-1-git-send-email-wudxw@linux.vnet.ibm.com>

On Mon, Oct 31, 2011 at 11:29:04AM +0800, Mark Wu wrote:
> A basic wildcard matching is supported in both the monitor command
> "trace-event" and the events list file. That means you can enable/disable
> the events having a common prefix in a batch. For example, virtio-blk trace
> events could be enabled using:
>     trace-event virtio_blk_* on
> 
> Signed-off-by: Mark Wu <wudxw@linux.vnet.ibm.com>
> ---
>  docs/tracing.txt |    9 ++++++++-
>  net/queue.c      |    1 +
>  trace/simple.c   |   19 +++++++++++++++++--
>  trace/stderr.c   |   17 ++++++++++++++++-
>  4 files changed, 42 insertions(+), 4 deletions(-)

Thanks, applied to the tracing tree:
http://repo.or.cz/w/qemu/stefanha.git/shortlog/refs/heads/tracing

I removed the net/queue.c hunk from the patch.

Stefan

^ permalink raw reply


This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.