Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3864e8cc authored by Linus Torvalds's avatar Linus Torvalds
Browse files
* 'for-linus' of git://git390.osdl.marist.edu/pub/scm/linux-2.6:
  [S390] monwriter: Serialization bug for multithreaded applications.
  [S390] vmur: diag14 only works with buffers below 2GB
  [S390] vmur: add "top of queue" sanity check for reader open
  [S390] vmur: reject open on z/VM reader files with status HOLD
  [S390] vmur: use DECLARE_COMPLETION_ONSTACK to keep lockdep happy
  [S390] vmur: allocate single record buffers instead of one big data buffer
  [S390] remove DEFAULT_MIGRATION_COST
  [S390] qdio: make sure data structures are correctly aligned.
  [S390] hypfs: implement show_options
  [S390] cio: avoid memory leak on error in css_alloc_subchannel().
parents 75ecb1a4 cbea66d9
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -109,10 +109,6 @@ config HOTPLUG_CPU
	  can be controlled through /sys/devices/system/cpu/cpu#.
	  Say N if you want to disable CPU hotplug.

config DEFAULT_MIGRATION_COST
	int
	default "1000000"

config MATHEMU
	bool "IEEE FPU emulation"
	depends on MARCH_G5
+12 −0
Original line number Diff line number Diff line
@@ -17,6 +17,8 @@
#include <linux/parser.h>
#include <linux/sysfs.h>
#include <linux/module.h>
#include <linux/seq_file.h>
#include <linux/mount.h>
#include <asm/ebcdic.h>
#include "hypfs.h"

@@ -256,6 +258,15 @@ static int hypfs_parse_options(char *options, struct super_block *sb)
	return 0;
}

static int hypfs_show_options(struct seq_file *s, struct vfsmount *mnt)
{
	struct hypfs_sb_info *hypfs_info = mnt->mnt_sb->s_fs_info;

	seq_printf(s, ",uid=%u", hypfs_info->uid);
	seq_printf(s, ",gid=%u", hypfs_info->gid);
	return 0;
}

static int hypfs_fill_super(struct super_block *sb, void *data, int silent)
{
	struct inode *root_inode;
@@ -459,6 +470,7 @@ static struct file_system_type hypfs_type = {
static struct super_operations hypfs_s_ops = {
	.statfs		= simple_statfs,
	.drop_inode	= hypfs_drop_inode,
	.show_options	= hypfs_show_options,
};

static decl_subsys(s390, NULL, NULL);
+6 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
#include <linux/miscdevice.h>
#include <linux/ctype.h>
#include <linux/poll.h>
#include <linux/mutex.h>
#include <asm/uaccess.h>
#include <asm/ebcdic.h>
#include <asm/io.h>
@@ -41,6 +42,7 @@ struct mon_private {
	size_t hdr_to_read;
	size_t data_to_read;
	struct mon_buf *current_buf;
	struct mutex thread_mutex;
};

/*
@@ -179,6 +181,7 @@ static int monwrite_open(struct inode *inode, struct file *filp)
		return -ENOMEM;
	INIT_LIST_HEAD(&monpriv->list);
	monpriv->hdr_to_read = sizeof(monpriv->hdr);
	mutex_init(&monpriv->thread_mutex);
	filp->private_data = monpriv;
	return nonseekable_open(inode, filp);
}
@@ -209,6 +212,7 @@ static ssize_t monwrite_write(struct file *filp, const char __user *data,
	void *to;
	int rc;

	mutex_lock(&monpriv->thread_mutex);
	for (written = 0; written < count; ) {
		if (monpriv->hdr_to_read) {
			len = min(count - written, monpriv->hdr_to_read);
@@ -247,11 +251,13 @@ static ssize_t monwrite_write(struct file *filp, const char __user *data,
		}
		monpriv->hdr_to_read = sizeof(monpriv->hdr);
	}
	mutex_unlock(&monpriv->thread_mutex);
	return written;

out_error:
	monpriv->data_to_read = 0;
	monpriv->hdr_to_read = sizeof(struct monwrite_hdr);
	mutex_unlock(&monpriv->thread_mutex);
	return rc;
}

+108 −68
Original line number Diff line number Diff line
@@ -119,10 +119,12 @@ static void urdev_put(struct urdev *urd)
/*
 * Low-level functions to do I/O to a ur device.
 *     alloc_chan_prog
 *     free_chan_prog
 *     do_ur_io
 *     ur_int_handler
 *
 * alloc_chan_prog allocates and builds the channel program
 * free_chan_prog frees memory of the channel program
 *
 * do_ur_io issues the channel program to the device and blocks waiting
 * on a completion event it publishes at urd->io_done. The function
@@ -137,6 +139,16 @@ static void urdev_put(struct urdev *urd)
 * address pointer that alloc_chan_prog returned.
 */

static void free_chan_prog(struct ccw1 *cpa)
{
	struct ccw1 *ptr = cpa;

	while (ptr->cda) {
		kfree((void *)(addr_t) ptr->cda);
		ptr++;
	}
	kfree(cpa);
}

/*
 * alloc_chan_prog
@@ -144,44 +156,45 @@ static void urdev_put(struct urdev *urd)
 * with a final NOP CCW command-chained on (which ensures that CE and DE
 * are presented together in a single interrupt instead of as separate
 * interrupts unless an incorrect length indication kicks in first). The
 * data length in each CCW is reclen. The caller must ensure that count
 * is an integral multiple of reclen.
 * The channel program pointer returned by this function must be freed
 * with kfree. The caller is responsible for checking that
 * count/reclen is not ridiculously large.
 * data length in each CCW is reclen.
 */
static struct ccw1 *alloc_chan_prog(char *buf, size_t count, size_t reclen)
static struct ccw1 *alloc_chan_prog(const char __user *ubuf, int rec_count,
				    int reclen)
{
	size_t num_ccws;
	struct ccw1 *cpa;
	void *kbuf;
	int i;

	TRACE("alloc_chan_prog(%p, %zu, %zu)\n", buf, count, reclen);
	TRACE("alloc_chan_prog(%p, %i, %i)\n", ubuf, rec_count, reclen);

	/*
	 * We chain a NOP onto the writes to force CE+DE together.
	 * That means we allocate room for CCWs to cover count/reclen
	 * records plus a NOP.
	 */
	num_ccws = count / reclen + 1;
	cpa = kmalloc(num_ccws * sizeof(struct ccw1), GFP_KERNEL | GFP_DMA);
	cpa = kzalloc((rec_count + 1) * sizeof(struct ccw1),
		      GFP_KERNEL | GFP_DMA);
	if (!cpa)
		return NULL;
		return ERR_PTR(-ENOMEM);

	for (i = 0; count; i++) {
	for (i = 0; i < rec_count; i++) {
		cpa[i].cmd_code = WRITE_CCW_CMD;
		cpa[i].flags = CCW_FLAG_CC | CCW_FLAG_SLI;
		cpa[i].count = reclen;
		cpa[i].cda = __pa(buf);
		buf += reclen;
		count -= reclen;
		kbuf = kmalloc(reclen, GFP_KERNEL | GFP_DMA);
		if (!kbuf) {
			free_chan_prog(cpa);
			return ERR_PTR(-ENOMEM);
		}
		cpa[i].cda = (u32)(addr_t) kbuf;
		if (copy_from_user(kbuf, ubuf, reclen)) {
			free_chan_prog(cpa);
			return ERR_PTR(-EFAULT);
		}
		ubuf += reclen;
	}
	/* The following NOP CCW forces CE+DE to be presented together */
	cpa[i].cmd_code = CCW_CMD_NOOP;
	cpa[i].flags = 0;
	cpa[i].count = 0;
	cpa[i].cda = 0;

	return cpa;
}

@@ -189,7 +202,7 @@ static int do_ur_io(struct urdev *urd, struct ccw1 *cpa)
{
	int rc;
	struct ccw_device *cdev = urd->cdev;
	DECLARE_COMPLETION(event);
	DECLARE_COMPLETION_ONSTACK(event);

	TRACE("do_ur_io: cpa=%p\n", cpa);

@@ -325,24 +338,11 @@ static ssize_t do_write(struct urdev *urd, const char __user *udata,
			size_t count, size_t reclen, loff_t *ppos)
{
	struct ccw1 *cpa;
	char *buf;
	int rc;

	/* Data buffer must be under 2GB line for fmt1 CCWs: hence GFP_DMA */
	buf = kmalloc(count, GFP_KERNEL | GFP_DMA);
	if (!buf)
		return -ENOMEM;

	if (copy_from_user(buf, udata, count)) {
		rc = -EFAULT;
		goto fail_kfree_buf;
	}

	cpa = alloc_chan_prog(buf, count, reclen);
	if (!cpa) {
		rc = -ENOMEM;
		goto fail_kfree_buf;
	}
	cpa = alloc_chan_prog(udata, count / reclen, reclen);
	if (IS_ERR(cpa))
		return PTR_ERR(cpa);

	rc = do_ur_io(urd, cpa);
	if (rc)
@@ -354,10 +354,9 @@ static ssize_t do_write(struct urdev *urd, const char __user *udata,
	}
	*ppos += count;
	rc = count;

fail_kfree_cpa:
	kfree(cpa);
fail_kfree_buf:
	kfree(buf);
	free_chan_prog(cpa);
	return rc;
}

@@ -473,7 +472,7 @@ static ssize_t diag14_read(struct file *file, char __user *ubuf, size_t count,
		return rc;

	len = min((size_t) PAGE_SIZE, count);
	buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
	buf = (char *) __get_free_page(GFP_KERNEL | GFP_DMA);
	if (!buf)
		return -ENOMEM;

@@ -500,7 +499,7 @@ static ssize_t diag14_read(struct file *file, char __user *ubuf, size_t count,
	*offs += copied;
	rc = copied;
fail:
	kfree(buf);
	free_page((unsigned long) buf);
	return rc;
}

@@ -543,56 +542,97 @@ static int diag_read_next_file_info(struct file_control_block *buf, int spid)
	}
}

static int verify_device(struct urdev *urd)
static int verify_uri_device(struct urdev *urd)
{
	struct file_control_block fcb;
	struct file_control_block *fcb;
	char *buf;
	int rc;

	switch (urd->class) {
	case DEV_CLASS_UR_O:
		return 0; /* no check needed here */
	case DEV_CLASS_UR_I:
	fcb = kmalloc(sizeof(*fcb), GFP_KERNEL | GFP_DMA);
	if (!fcb)
		return -ENOMEM;

	/* check for empty reader device (beginning of chain) */
		rc = diag_read_next_file_info(&fcb, 0);
	rc = diag_read_next_file_info(fcb, 0);
	if (rc)
			return rc;
		goto fail_free_fcb;

	/* if file is in hold status, we do not read it */
	if (fcb->file_stat & (FLG_SYSTEM_HOLD | FLG_USER_HOLD)) {
		rc = -EPERM;
		goto fail_free_fcb;
	}

	/* open file on virtual reader	*/
		buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
		if (!buf)
			return -ENOMEM;
	buf = (char *) __get_free_page(GFP_KERNEL | GFP_DMA);
	if (!buf) {
		rc = -ENOMEM;
		goto fail_free_fcb;
	}
	rc = diag_read_file(urd->dev_id.devno, buf);
		kfree(buf);

	if ((rc != 0) && (rc != -ENODATA)) /* EOF does not hurt */
		goto fail_free_buf;

	/* check if the file on top of the queue is open now */
	rc = diag_read_next_file_info(fcb, 0);
	if (rc)
		goto fail_free_buf;
	if (!(fcb->file_stat & FLG_IN_USE)) {
		rc = -EMFILE;
		goto fail_free_buf;
	}
	rc = 0;

fail_free_buf:
	free_page((unsigned long) buf);
fail_free_fcb:
	kfree(fcb);
	return rc;
		return 0;
}

static int verify_device(struct urdev *urd)
{
	switch (urd->class) {
	case DEV_CLASS_UR_O:
		return 0; /* no check needed here */
	case DEV_CLASS_UR_I:
		return verify_uri_device(urd);
	default:
		return -ENOTSUPP;
	}
}

static int get_file_reclen(struct urdev *urd)
static int get_uri_file_reclen(struct urdev *urd)
{
	struct file_control_block fcb;
	struct file_control_block *fcb;
	int rc;

	fcb = kmalloc(sizeof(*fcb), GFP_KERNEL | GFP_DMA);
	if (!fcb)
		return -ENOMEM;
	rc = diag_read_next_file_info(fcb, 0);
	if (rc)
		goto fail_free;
	if (fcb->file_stat & FLG_CP_DUMP)
		rc = 0;
	else
		rc = fcb->rec_len;

fail_free:
	kfree(fcb);
	return rc;
}

static int get_file_reclen(struct urdev *urd)
{
	switch (urd->class) {
	case DEV_CLASS_UR_O:
		return 0;
	case DEV_CLASS_UR_I:
		rc = diag_read_next_file_info(&fcb, 0);
		if (rc)
			return rc;
		break;
		return get_uri_file_reclen(urd);
	default:
		return -ENOTSUPP;
	}
	if (fcb.file_stat & FLG_CP_DUMP)
		return 0;

	return fcb.rec_len;
}

static int ur_open(struct inode *inode, struct file *file)
+4 −1
Original line number Diff line number Diff line
@@ -50,7 +50,10 @@ struct file_control_block {
	char  rest[200];
} __attribute__ ((packed));

#define FLG_SYSTEM_HOLD	0x04
#define FLG_CP_DUMP	0x10
#define FLG_USER_HOLD	0x20
#define FLG_IN_USE	0x80

/*
 * A struct urdev is created for each ur device that is made available
Loading