Tuesday, March 2, 2010

linux.kernel - 26 new messages in 17 topics - digest

linux.kernel
http://groups.google.com/group/linux.kernel?hl=en

linux.kernel@googlegroups.com

Today's topics:

* 'sar' issue or core dump issue? - 1 messages, 1 author
http://groups.google.com/group/linux.kernel/t/7de13e8ac7c5c85d?hl=en
* DMAENGINE: COH 901 318 lli sg offset fix - 1 messages, 1 author
http://groups.google.com/group/linux.kernel/t/b72551fee789c39f?hl=en
* DMAENGINE: COH 901 318 cleanups - 1 messages, 1 author
http://groups.google.com/group/linux.kernel/t/2c9ff4fdb6df76fc?hl=en
* DMAENGINE: COH 901 318 remove irq counting - 1 messages, 1 author
http://groups.google.com/group/linux.kernel/t/d6d2a9322b862053?hl=en
* This patch fixes the "no connectors reported" bug on Sony VGN-BX196VP and -
1 messages, 1 author
http://groups.google.com/group/linux.kernel/t/d53d504a4eb354bb?hl=en
* DMAENGINE: COH 901 318 configure channel direction - 1 messages, 1 author
http://groups.google.com/group/linux.kernel/t/35b769d8d44e337d?hl=en
* [PATCH 3/7] xen/hvm: Xen PV extension of HVM initialization - 1 messages, 1
author
http://groups.google.com/group/linux.kernel/t/fbe37dafcb007f26?hl=en
* DMAENGINE: COH 901 318 descriptor pool refactoring - 1 messages, 1 author
http://groups.google.com/group/linux.kernel/t/e0a623ed9e188724?hl=en
* nfs: use 4*rsize readahead size - 1 messages, 1 author
http://groups.google.com/group/linux.kernel/t/0ded33f7779e13c7?hl=en
* slab: add memory hotplug support - 1 messages, 1 author
http://groups.google.com/group/linux.kernel/t/a8beda1232363b5e?hl=en
* Revert "lsm: Remove the socket_post_accept() hook" - 6 messages, 1 author
http://groups.google.com/group/linux.kernel/t/c533f45a163fc63a?hl=en
* [RFC] time: add wait_interruptible_timeout macro to sleep (w. timeout) until
wake_up - 1 messages, 1 author
http://groups.google.com/group/linux.kernel/t/50fb971fa6a1b3a6?hl=en
* i2c: fix xiic build error - 1 messages, 1 author
http://groups.google.com/group/linux.kernel/t/7e6d27f917b2a08e?hl=en
* snet: Security for NETwork syscalls - 5 messages, 1 author
http://groups.google.com/group/linux.kernel/t/2ba3cee1400ac233?hl=en
* linux-next: build failure after merge of the final tree - 1 messages, 1
author
http://groups.google.com/group/linux.kernel/t/cbcc46666b20ce23?hl=en
* binfmt_elf: plug a memory leak situation on dump_seek() - 1 messages, 1
author
http://groups.google.com/group/linux.kernel/t/5bec5866c9bd2261?hl=en
* linux-next: Tree for March 2 (watchdog) - 1 messages, 1 author
http://groups.google.com/group/linux.kernel/t/9c4fcb17427b7c42?hl=en

==============================================================================
TOPIC: 'sar' issue or core dump issue?
http://groups.google.com/group/linux.kernel/t/7de13e8ac7c5c85d?hl=en
==============================================================================

== 1 of 1 ==
Date: Tues, Mar 2 2010 12:10 pm
From: Lizhang Qin


Hi,

I am experience some performance issue for user space app, when
looking at 'sar' result, it showed things like below.

CPU %user %nice %system %iowait %steal %idle
08:30:02 all 3.29 0.00 9.16 0.01
0.00 87.54
08:30:12 all 0.38 0.00 2.40 0.38
0.00 96.84
08:43:39 all 0.28 0.00 1.17 0.87
0.00 97.68

It shows all the records between 08:30:12 to 08:43:39 are missing.
Does it mean kernel actually lose all the statistic data during that
period? How could that happen though?

I notice there is a big core dump file were written for a crash app
running in the machine.
Could a core dump interfere all the kernel scheduling on all cores (I
have 4 physical CPU adn 8 virtual cores).

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

==============================================================================
TOPIC: DMAENGINE: COH 901 318 lli sg offset fix
http://groups.google.com/group/linux.kernel/t/b72551fee789c39f?hl=en
==============================================================================

== 1 of 1 ==
Date: Tues, Mar 2 2010 12:20 pm
From: Linus Walleij


This makes the COH 901 318 respect the scatter offset field by using
the sg_phys() rather than the sg_dma_address() so we get a pointer
to the actual data we want to send rather than the beginning of the
buffer. Also initialize the lli:s a bit more thoroughly.

Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
---
drivers/dma/coh901318_lli.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/dma/coh901318_lli.c b/drivers/dma/coh901318_lli.c
index 5f9af19..71d58c1 100644
--- a/drivers/dma/coh901318_lli.c
+++ b/drivers/dma/coh901318_lli.c
@@ -74,6 +74,8 @@ coh901318_lli_alloc(struct coh901318_pool *pool, unsigned int len)

lli = head;
lli->phy_this = phy;
+ lli->link_addr = 0x00000000;
+ lli->virt_link_addr = 0x00000000U;

for (i = 1; i < len; i++) {
lli_prev = lli;
@@ -85,13 +87,13 @@ coh901318_lli_alloc(struct coh901318_pool *pool, unsigned int len)

DEBUGFS_POOL_COUNTER_ADD(pool, 1);
lli->phy_this = phy;
+ lli->link_addr = 0x00000000;
+ lli->virt_link_addr = 0x00000000U;

lli_prev->link_addr = phy;
lli_prev->virt_link_addr = lli;
}

- lli->link_addr = 0x00000000U;
-
spin_unlock(&pool->lock);

return head;
@@ -268,10 +270,10 @@ coh901318_lli_fill_sg(struct coh901318_pool *pool,

if (dir == DMA_TO_DEVICE)
/* increment source address */
- src = sg_dma_address(sg);
+ src = sg_phys(sg);
else
/* increment destination address */
- dst = sg_dma_address(sg);
+ dst = sg_phys(sg);

bytes_to_transfer = sg_dma_len(sg);

--
1.6.3.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

==============================================================================
TOPIC: DMAENGINE: COH 901 318 cleanups
http://groups.google.com/group/linux.kernel/t/2c9ff4fdb6df76fc?hl=en
==============================================================================

== 1 of 1 ==
Date: Tues, Mar 2 2010 12:20 pm
From: Linus Walleij


This cleans up the some debug code that was not working in the
COH 901 318 driver, adds some helpful comments and rearrange the
code a bit.

Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
---
drivers/dma/coh901318.c | 42 ++++++++++++++++++++++++++++--------------
1 files changed, 28 insertions(+), 14 deletions(-)

diff --git a/drivers/dma/coh901318.c b/drivers/dma/coh901318.c
index 64a9372..b962cf1 100644
--- a/drivers/dma/coh901318.c
+++ b/drivers/dma/coh901318.c
@@ -80,18 +80,16 @@ struct coh901318_chan {
static void coh901318_list_print(struct coh901318_chan *cohc,
struct coh901318_lli *lli)
{
- struct coh901318_lli *l;
- dma_addr_t addr = virt_to_phys(lli);
+ struct coh901318_lli *l = lli;
int i = 0;

- while (addr) {
- l = phys_to_virt(addr);
+ while (l) {
dev_vdbg(COHC_2_DEV(cohc), "i %d, lli %p, ctrl 0x%x, src 0x%x"
- ", dst 0x%x, link 0x%x link_virt 0x%p\n",
+ ", dst 0x%x, link 0x%x virt_link_addr 0x%p\n",
i, l, l->control, l->src_addr, l->dst_addr,
- l->link_addr, phys_to_virt(l->link_addr));
+ l->link_addr, l->virt_link_addr);
i++;
- addr = l->link_addr;
+ l = l->virt_link_addr;
}
}

@@ -125,7 +123,7 @@ static int coh901318_debugfs_read(struct file *file, char __user *buf,
goto err_kmalloc;
tmp = dev_buf;

- tmp += sprintf(tmp, "DMA -- enable dma channels\n");
+ tmp += sprintf(tmp, "DMA -- enabled dma channels\n");

for (i = 0; i < debugfs_dma_base->platform->max_channels; i++)
if (started_channels & (1 << i))
@@ -592,6 +590,10 @@ static struct coh901318_desc *coh901318_queue_start(struct coh901318_chan *cohc)
return cohd_que;
}

+/*
+ * This tasklet is called from the interrupt handler to
+ * handle each descriptor (DMA job) that is sent to a channel.
+ */
static void dma_tasklet(unsigned long data)
{
struct coh901318_chan *cohc = (struct coh901318_chan *) data;
@@ -600,9 +602,13 @@ static void dma_tasklet(unsigned long data)
dma_async_tx_callback callback;
void *callback_param;

+ dev_vdbg(COHC_2_DEV(cohc), "[%s] chan_id %d"
+ " nbr_active_done %ld\n", __func__,
+ cohc->id, cohc->nbr_active_done);
+
spin_lock_irqsave(&cohc->lock, flags);

- /* get first active entry from list */
+ /* get first active descriptor entry from list */
cohd_fin = coh901318_first_active_get(cohc);

BUG_ON(cohd_fin->pending_irqs == 0);
@@ -637,9 +643,18 @@ static void dma_tasklet(unsigned long data)
}

if (cohc->nbr_active_done)
+ /*
+ * If another interrupt fired while the tasklet was scheduling,
+ * we don't get called twice, so we have this number of active
+ * counter that keep track of the number of IRQs expected to
+ * be handled for this channel. If there happen to be more than
+ * one IRQ to be ack:ed, we simply schedule this tasklet again.
+ */
cohc->nbr_active_done--;

if (cohc->nbr_active_done) {
+ dev_dbg(COHC_2_DEV(cohc), "scheduling tasklet again, new IRQs "
+ "came in while we were scheduling this tasklet\n");
if (cohc_chan_conf(cohc)->priority_high)
tasklet_hi_schedule(&cohc->tasklet);
else
@@ -994,6 +1009,7 @@ coh901318_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
len += factor;
}

+ pr_debug("Allocate %d lli:s for this transfer\n", len);
data = coh901318_lli_alloc(&cohc->base->pool, len);

if (data == NULL)
@@ -1092,9 +1108,8 @@ coh901318_terminate_all(struct dma_chan *chan)
/* release the lli allocation*/
coh901318_lli_free(&cohc->base->pool, &cohd->data);

- coh901318_desc_remove(cohd);
-
/* return desc to free-list */
+ coh901318_desc_remove(cohd);
coh901318_desc_free(cohc, cohd);
}

@@ -1102,9 +1117,8 @@ coh901318_terminate_all(struct dma_chan *chan)
/* release the lli allocation*/
coh901318_lli_free(&cohc->base->pool, &cohd->data);

- coh901318_desc_remove(cohd);
-
/* return desc to free-list */
+ coh901318_desc_remove(cohd);
coh901318_desc_free(cohc, cohd);
}

@@ -1259,7 +1273,7 @@ static int __init coh901318_probe(struct platform_device *pdev)
if (err)
goto err_register_memcpy;

- dev_dbg(&pdev->dev, "Initialized COH901318 DMA on virtual base 0x%08x\n",
+ dev_info(&pdev->dev, "Initialized COH901318 DMA on virtual base 0x%08x\n",
(u32) base->virtbase);

return err;
--
1.6.3.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

==============================================================================
TOPIC: DMAENGINE: COH 901 318 remove irq counting
http://groups.google.com/group/linux.kernel/t/d6d2a9322b862053?hl=en
==============================================================================

== 1 of 1 ==
Date: Tues, Mar 2 2010 12:20 pm
From: Linus Walleij


This removes the pointless irq counting for the COH 901 318, as
it turns out the hardware will only ever fire one IRQ for a linked
list anyway. In the process also a missing spinlock was introduced.

Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
---
drivers/dma/coh901318.c | 76 +++++++++++++++++-------------------------
drivers/dma/coh901318_lli.c | 13 ++------
2 files changed, 34 insertions(+), 55 deletions(-)

diff --git a/drivers/dma/coh901318.c b/drivers/dma/coh901318.c
index 00398ca..544c462 100644
--- a/drivers/dma/coh901318.c
+++ b/drivers/dma/coh901318.c
@@ -39,7 +39,6 @@ struct coh901318_desc {
unsigned int sg_len;
struct coh901318_lli *data;
enum dma_data_direction dir;
- int pending_irqs;
unsigned long flags;
};

@@ -72,7 +71,6 @@ struct coh901318_chan {

unsigned long nbr_active_done;
unsigned long busy;
- int pending_irqs;

struct coh901318_base *base;
};
@@ -368,10 +366,6 @@ static void
coh901318_desc_submit(struct coh901318_chan *cohc, struct coh901318_desc *desc)
{
list_add_tail(&desc->node, &cohc->active);
-
- BUG_ON(cohc->pending_irqs != 0);
-
- cohc->pending_irqs = desc->pending_irqs;
}

static struct coh901318_desc *
@@ -617,38 +611,31 @@ static void dma_tasklet(unsigned long data)
/* get first active descriptor entry from list */
cohd_fin = coh901318_first_active_get(cohc);

- BUG_ON(cohd_fin->pending_irqs == 0);
-
if (cohd_fin == NULL)
goto err;

- cohd_fin->pending_irqs--;
- cohc->completed = cohd_fin->desc.cookie;
+ /* locate callback to client */
+ callback = cohd_fin->desc.callback;
+ callback_param = cohd_fin->desc.callback_param;

- if (cohc->nbr_active_done == 0)
- return;
+ /* sign this job as completed on the channel */
+ cohc->completed = cohd_fin->desc.cookie;

- if (!cohd_fin->pending_irqs) {
- /* release the lli allocation*/
- coh901318_lli_free(&cohc->base->pool, &cohd_fin->data);
- }
+ /* release the lli allocation and remove the descriptor */
+ coh901318_lli_free(&cohc->base->pool, &cohd_fin->data);

- dev_vdbg(COHC_2_DEV(cohc), "[%s] chan_id %d pending_irqs %d"
- " nbr_active_done %ld\n", __func__,
- cohc->id, cohc->pending_irqs, cohc->nbr_active_done);
+ /* return desc to free-list */
+ coh901318_desc_remove(cohd_fin);
+ coh901318_desc_free(cohc, cohd_fin);

- /* callback to client */
- callback = cohd_fin->desc.callback;
- callback_param = cohd_fin->desc.callback_param;
+ spin_unlock_irqrestore(&cohc->lock, flags);

- if (!cohd_fin->pending_irqs) {
- coh901318_desc_remove(cohd_fin);
+ /* Call the callback when we're done */
+ if (callback)
+ callback(callback_param);

- /* return desc to free-list */
- coh901318_desc_free(cohc, cohd_fin);
- }
+ spin_lock_irqsave(&cohc->lock, flags);

- if (cohc->nbr_active_done)
/*
* If another interrupt fired while the tasklet was scheduling,
* we don't get called twice, so we have this number of active
@@ -656,8 +643,7 @@ static void dma_tasklet(unsigned long data)
* be handled for this channel. If there happen to be more than
* one IRQ to be ack:ed, we simply schedule this tasklet again.
*/
- cohc->nbr_active_done--;
-
+ cohc->nbr_active_done--;
if (cohc->nbr_active_done) {
dev_dbg(COHC_2_DEV(cohc), "scheduling tasklet again, new IRQs "
"came in while we were scheduling this tasklet\n");
@@ -666,10 +652,8 @@ static void dma_tasklet(unsigned long data)
else
tasklet_schedule(&cohc->tasklet);
}
- spin_unlock_irqrestore(&cohc->lock, flags);

- if (callback)
- callback(callback_param);
+ spin_unlock_irqrestore(&cohc->lock, flags);

return;

@@ -688,16 +672,17 @@ static void dma_tc_handle(struct coh901318_chan *cohc)
if (!cohc->allocated)
return;

- BUG_ON(cohc->pending_irqs == 0);
+ spin_lock(&cohc->lock);

- cohc->pending_irqs--;
cohc->nbr_active_done++;

- if (cohc->pending_irqs == 0 && coh901318_queue_start(cohc) == NULL)
+ if (coh901318_queue_start(cohc) == NULL)
cohc->busy = 0;

BUG_ON(list_empty(&cohc->active));

+ spin_unlock(&cohc->lock);
+
if (cohc_chan_conf(cohc)->priority_high)
tasklet_hi_schedule(&cohc->tasklet);
else
@@ -951,6 +936,7 @@ coh901318_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
u32 ctrl = cohc_chan_param(cohc)->ctrl_lli;
u32 ctrl_last = cohc_chan_param(cohc)->ctrl_lli_last;
unsigned long flg;
+ int ret;

if (!sgl)
goto out;
@@ -1010,13 +996,14 @@ coh901318_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
goto err_dma_alloc;

/* initiate allocated data list */
- cohd->pending_irqs =
- coh901318_lli_fill_sg(&cohc->base->pool, data, sgl, sg_len,
- cohc_dev_addr(cohc),
- ctrl_chained,
- ctrl,
- ctrl_last,
- direction, COH901318_CX_CTRL_TC_IRQ_ENABLE);
+ ret = coh901318_lli_fill_sg(&cohc->base->pool, data, sgl, sg_len,
+ cohc_dev_addr(cohc),
+ ctrl_chained,
+ ctrl,
+ ctrl_last,
+ direction, COH901318_CX_CTRL_TC_IRQ_ENABLE);
+ if (ret)
+ goto err_lli_fill;

COH_DBG(coh901318_list_print(cohc, data));

@@ -1030,6 +1017,7 @@ coh901318_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
spin_unlock_irqrestore(&cohc->lock, flg);

return &cohd->desc;
+ err_lli_fill:
err_dma_alloc:
err_direction:
spin_unlock_irqrestore(&cohc->lock, flg);
@@ -1121,7 +1109,6 @@ coh901318_terminate_all(struct dma_chan *chan)

cohc->nbr_active_done = 0;
cohc->busy = 0;
- cohc->pending_irqs = 0;

spin_unlock_irqrestore(&cohc->lock, flags);
}
@@ -1148,7 +1135,6 @@ void coh901318_base_init(struct dma_device *dma, const int *pick_chans,

spin_lock_init(&cohc->lock);

- cohc->pending_irqs = 0;
cohc->nbr_active_done = 0;
cohc->busy = 0;
INIT_LIST_HEAD(&cohc->free);
diff --git a/drivers/dma/coh901318_lli.c b/drivers/dma/coh901318_lli.c
index f5120f2..5f9af19 100644
--- a/drivers/dma/coh901318_lli.c
+++ b/drivers/dma/coh901318_lli.c
@@ -166,8 +166,7 @@ coh901318_lli_fill_memcpy(struct coh901318_pool *pool,
lli->src_addr = src;
lli->dst_addr = dst;

- /* One irq per single transfer */
- return 1;
+ return 0;
}

int
@@ -223,8 +222,7 @@ coh901318_lli_fill_single(struct coh901318_pool *pool,
lli->src_addr = src;
lli->dst_addr = dst;

- /* One irq per single transfer */
- return 1;
+ return 0;
}

int
@@ -240,7 +238,6 @@ coh901318_lli_fill_sg(struct coh901318_pool *pool,
u32 ctrl_sg;
dma_addr_t src = 0;
dma_addr_t dst = 0;
- int nbr_of_irq = 0;
u32 bytes_to_transfer;
u32 elem_size;

@@ -269,9 +266,6 @@ coh901318_lli_fill_sg(struct coh901318_pool *pool,
ctrl_sg = ctrl ? ctrl : ctrl_last;


- if ((ctrl_sg & ctrl_irq_mask))
- nbr_of_irq++;
-
if (dir == DMA_TO_DEVICE)
/* increment source address */
src = sg_dma_address(sg);
@@ -310,8 +304,7 @@ coh901318_lli_fill_sg(struct coh901318_pool *pool,
}
spin_unlock(&pool->lock);

- /* There can be many IRQs per sg transfer */
- return nbr_of_irq;
+ return 0;
err:
spin_unlock(&pool->lock);
return -EINVAL;
--
1.6.3.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

==============================================================================
TOPIC: This patch fixes the "no connectors reported" bug on Sony VGN-BX196VP
and
http://groups.google.com/group/linux.kernel/t/d53d504a4eb354bb?hl=en
==============================================================================

== 1 of 1 ==
Date: Tues, Mar 2 2010 12:20 pm
From: Surbhi Palande


Thanks !

Regards,
Surbhi.

From 47edbf7437388b23562f12888c36af6b59f56eec Mon Sep 17 00:00:00 2001
From: Surbhi Palande <surbhi.palande@canonical.com>
Date: Mon, 22 Feb 2010 22:39:28 +0200
Subject: [PATCH] drm/i915: blacklist lid status: Sony VGN-BX196VP, Dell Inspiron 700m

BugLink: https://bugs.launchpad.net/bugs/515246

Sony VGN-BX196VP and Dell Inspiron 700m report lid status as closed
when it is open. This leads to a "no connectors reported" error at startup.
Blacklisting them, to always return a connected status for the default
lvds connector.

Signed-off-by: Surbhi Palande <surbhi.palande@canonical.com>
---
drivers/gpu/drm/i915/intel_lvds.c | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
index c2e8a45..b94a5e5 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -643,6 +643,20 @@ static const struct dmi_system_id bad_lid_status[] = {
DMI_MATCH(DMI_BOARD_NAME, "M5x0N"),
},
},
+ {
+ .ident = "Sony VGN-BX196VP",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
+ DMI_MATCH(DMI_BOARD_NAME, "VGN-BX196VP"),
+ },
+ },
+ {
+ .ident = "Dell Inspiron 700m",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc"),
+ DMI_MATCH(DMI_BOARD_NAME, "Inspiron 700m"),
+ },
+ },
{ }
};

--
1.6.3.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

==============================================================================
TOPIC: DMAENGINE: COH 901 318 configure channel direction
http://groups.google.com/group/linux.kernel/t/35b769d8d44e337d?hl=en
==============================================================================

== 1 of 1 ==
Date: Tues, Mar 2 2010 12:20 pm
From: Linus Walleij


This makes the COH 901 318 configure channel direction (to or from
device) dynamically, instead of being passed in from the platform
data. This was necessary in order to get the MMC/SD-card channel
bidirectional (all other channels on the U300 were either RX or
TX but this one was both). This also sets memcpy() alignent to
even 2^2 (32bit) boundaries, which makes the memcpy() stress tests
start working.

Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
---
drivers/dma/coh901318.c | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/drivers/dma/coh901318.c b/drivers/dma/coh901318.c
index 544c462..1656fdc 100644
--- a/drivers/dma/coh901318.c
+++ b/drivers/dma/coh901318.c
@@ -928,6 +928,7 @@ coh901318_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
struct coh901318_chan *cohc = to_coh901318_chan(chan);
struct coh901318_lli *data;
struct coh901318_desc *cohd;
+ const struct coh901318_params *params;
struct scatterlist *sg;
int len = 0;
int size;
@@ -935,6 +936,7 @@ coh901318_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
u32 ctrl_chained = cohc_chan_param(cohc)->ctrl_lli_chained;
u32 ctrl = cohc_chan_param(cohc)->ctrl_lli;
u32 ctrl_last = cohc_chan_param(cohc)->ctrl_lli_last;
+ u32 config;
unsigned long flg;
int ret;

@@ -952,10 +954,14 @@ coh901318_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
/* Trigger interrupt after last lli */
ctrl_last |= COH901318_CX_CTRL_TC_IRQ_ENABLE;

+ params = cohc_chan_param(cohc);
+ config = params->config;
+
if (direction == DMA_TO_DEVICE) {
u32 tx_flags = COH901318_CX_CTRL_PRDD_SOURCE |
COH901318_CX_CTRL_SRC_ADDR_INC_ENABLE;

+ config |= COH901318_CX_CFG_RM_MEMORY_TO_PRIMARY;
ctrl_chained |= tx_flags;
ctrl_last |= tx_flags;
ctrl |= tx_flags;
@@ -963,12 +969,15 @@ coh901318_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
u32 rx_flags = COH901318_CX_CTRL_PRDD_DEST |
COH901318_CX_CTRL_DST_ADDR_INC_ENABLE;

+ config |= COH901318_CX_CFG_RM_PRIMARY_TO_MEMORY;
ctrl_chained |= rx_flags;
ctrl_last |= rx_flags;
ctrl |= rx_flags;
} else
goto err_direction;

+ coh901318_set_conf(cohc, config);
+
/* The dma only supports transmitting packages up to
* MAX_DMA_PACKET_SIZE. Calculate to total number of
* dma elemts required to send the entire sg list
@@ -1250,6 +1259,11 @@ static int __init coh901318_probe(struct platform_device *pdev)
base->dma_memcpy.device_issue_pending = coh901318_issue_pending;
base->dma_memcpy.device_terminate_all = coh901318_terminate_all;
base->dma_memcpy.dev = &pdev->dev;
+ /*
+ * This controller can only access address at even 32bit boundaries,
+ * i.e. 2^2
+ */
+ base->dma_memcpy.copy_align = 2;
err = dma_async_device_register(&base->dma_memcpy);

if (err)
--
1.6.3.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

==============================================================================
TOPIC: [PATCH 3/7] xen/hvm: Xen PV extension of HVM initialization
http://groups.google.com/group/linux.kernel/t/fbe37dafcb007f26?hl=en
==============================================================================

== 1 of 1 ==
Date: Tues, Mar 2 2010 12:20 pm
From: Jeremy Fitzhardinge


On 03/02/2010 01:22 AM, Ian Campbell wrote:
> On Tue, 2010-03-02 at 01:38 +0000, Sheng Yang wrote:
>
>> A annoy thing in pv drivers is that it would test if the domain type
>> is _NOT_ XEN_NATIVE. So set the domain to XEN_HVM_DOMAIN would result
>> in PV driver initialization then probably panic.
>>
> What _actually_ panics?
>
> Registration of the frontend devices should be completely harmless
> (apart from a little wasted RAM) unless a xenbus driver manages to come
> up and enumerate the xen bus and cause the ->probe function run.
>
> You should be gating the xenbus startup on the availability of PV
> functionality not the individual driver registrations. This keeps the
> test in a single easy to maintain place.
>
> Compare with pci_register_driver and all of the callers of that function
> -- not a single one of them has an "is_pci_available" test anywhere.
>

The problem is that it currently assumes xenbus is initialized by the
time the PV drivers init, because in a PV boot xenbus gets initted very
early. We need to change it so that it can cope with drivers being
initialized and registering with xenbus before it has been initialized.

We have the same problem with plain PV-on-HVM drivers as xenbus only
comes up as a result of probing the Xen PCI platform device, which may
be after the PV drivers' init functions have been called.

J
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

==============================================================================
TOPIC: DMAENGINE: COH 901 318 descriptor pool refactoring
http://groups.google.com/group/linux.kernel/t/e0a623ed9e188724?hl=en
==============================================================================

== 1 of 1 ==
Date: Tues, Mar 2 2010 12:20 pm
From: Linus Walleij


This centralize some spread-out initialization of descriptors into
one function and cleans up the error paths.

Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
---
arch/arm/mach-u300/include/mach/coh901318.h | 2 +-
drivers/dma/coh901318.c | 54 ++++++++++++--------------
2 files changed, 26 insertions(+), 30 deletions(-)

diff --git a/arch/arm/mach-u300/include/mach/coh901318.h b/arch/arm/mach-u300/include/mach/coh901318.h
index f4cfee9..b8155b4 100644
--- a/arch/arm/mach-u300/include/mach/coh901318.h
+++ b/arch/arm/mach-u300/include/mach/coh901318.h
@@ -53,7 +53,7 @@ struct coh901318_params {
* struct coh_dma_channel - dma channel base
* @name: ascii name of dma channel
* @number: channel id number
- * @desc_nbr_max: number of preallocated descriptortors
+ * @desc_nbr_max: number of preallocated descriptors
* @priority_high: prio of channel, 0 low otherwise high.
* @param: configuration parameters
* @dev_addr: physical address of periphal connected to channel
diff --git a/drivers/dma/coh901318.c b/drivers/dma/coh901318.c
index b962cf1..00398ca 100644
--- a/drivers/dma/coh901318.c
+++ b/drivers/dma/coh901318.c
@@ -335,16 +335,22 @@ coh901318_desc_get(struct coh901318_chan *cohc)
* TODO: alloc a pile of descs instead of just one,
* avoid many small allocations.
*/
- desc = kmalloc(sizeof(struct coh901318_desc), GFP_NOWAIT);
+ desc = kzalloc(sizeof(struct coh901318_desc), GFP_NOWAIT);
if (desc == NULL)
goto out;
INIT_LIST_HEAD(&desc->node);
+ dma_async_tx_descriptor_init(&desc->desc, &cohc->chan);
} else {
/* Reuse an old desc. */
desc = list_first_entry(&cohc->free,
struct coh901318_desc,
node);
list_del(&desc->node);
+ /* Initialize it a bit so it's not insane */
+ desc->sg = NULL;
+ desc->sg_len = 0;
+ desc->desc.callback = NULL;
+ desc->desc.callback_param = NULL;
}

out:
@@ -885,6 +891,7 @@ coh901318_prep_memcpy(struct dma_chan *chan, dma_addr_t dest, dma_addr_t src,
struct coh901318_chan *cohc = to_coh901318_chan(chan);
int lli_len;
u32 ctrl_last = cohc_chan_param(cohc)->ctrl_lli_last;
+ int ret;

spin_lock_irqsave(&cohc->lock, flg);

@@ -905,22 +912,19 @@ coh901318_prep_memcpy(struct dma_chan *chan, dma_addr_t dest, dma_addr_t src,
if (data == NULL)
goto err;

- cohd = coh901318_desc_get(cohc);
- cohd->sg = NULL;
- cohd->sg_len = 0;
- cohd->data = data;
-
- cohd->pending_irqs =
- coh901318_lli_fill_memcpy(
- &cohc->base->pool, data, src, size, dest,
- cohc_chan_param(cohc)->ctrl_lli_chained,
- ctrl_last);
- cohd->flags = flags;
+ ret = coh901318_lli_fill_memcpy(
+ &cohc->base->pool, data, src, size, dest,
+ cohc_chan_param(cohc)->ctrl_lli_chained,
+ ctrl_last);
+ if (ret)
+ goto err;

COH_DBG(coh901318_list_print(cohc, data));

- dma_async_tx_descriptor_init(&cohd->desc, chan);
-
+ /* Pick a descriptor to handle this transfer */
+ cohd = coh901318_desc_get(cohc);
+ cohd->data = data;
+ cohd->flags = flags;
cohd->desc.tx_submit = coh901318_tx_submit;

spin_unlock_irqrestore(&cohc->lock, flg);
@@ -962,11 +966,6 @@ coh901318_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
/* Trigger interrupt after last lli */
ctrl_last |= COH901318_CX_CTRL_TC_IRQ_ENABLE;

- cohd = coh901318_desc_get(cohc);
- cohd->sg = NULL;
- cohd->sg_len = 0;
- cohd->dir = direction;
-
if (direction == DMA_TO_DEVICE) {
u32 tx_flags = COH901318_CX_CTRL_PRDD_SOURCE |
COH901318_CX_CTRL_SRC_ADDR_INC_ENABLE;
@@ -984,11 +983,6 @@ coh901318_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
} else
goto err_direction;

- dma_async_tx_descriptor_init(&cohd->desc, chan);
-
- cohd->desc.tx_submit = coh901318_tx_submit;
-
-
/* The dma only supports transmitting packages up to
* MAX_DMA_PACKET_SIZE. Calculate to total number of
* dma elemts required to send the entire sg list
@@ -1023,19 +1017,21 @@ coh901318_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
ctrl,
ctrl_last,
direction, COH901318_CX_CTRL_TC_IRQ_ENABLE);
- cohd->data = data;
-
- cohd->flags = flags;

COH_DBG(coh901318_list_print(cohc, data));

+ /* Pick a descriptor to handle this transfer */
+ cohd = coh901318_desc_get(cohc);
+ cohd->dir = direction;
+ cohd->flags = flags;
+ cohd->desc.tx_submit = coh901318_tx_submit;
+ cohd->data = data;
+
spin_unlock_irqrestore(&cohc->lock, flg);

return &cohd->desc;
err_dma_alloc:
err_direction:
- coh901318_desc_remove(cohd);
- coh901318_desc_free(cohc, cohd);
spin_unlock_irqrestore(&cohc->lock, flg);
out:
return NULL;
--
1.6.3.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

==============================================================================
TOPIC: nfs: use 4*rsize readahead size
http://groups.google.com/group/linux.kernel/t/0ded33f7779e13c7?hl=en
==============================================================================

== 1 of 1 ==
Date: Tues, Mar 2 2010 12:20 pm
From: Bret Towe


On Mon, Mar 1, 2010 at 7:10 PM, Wu Fengguang <fengguang.wu@intel.com> wrote:
> Dave,
>
> Here is one more test on a big ext4 disk file:
>
> � � � � � 16k �39.7 MB/s
> � � � � � 32k �54.3 MB/s
> � � � � � 64k �63.6 MB/s
> � � � � �128k �72.6 MB/s
> � � � � �256k �71.7 MB/s
> rsize ==> 512k �71.7 MB/s
> � � � � 1024k �72.2 MB/s
> � � � � 2048k �71.0 MB/s
> � � � � 4096k �73.0 MB/s
> � � � � 8192k �74.3 MB/s
> � � � �16384k �74.5 MB/s
>
> It shows that >=128k client side readahead is enough for single disk
> case :) As for RAID configurations, I guess big server side readahead
> should be enough.
>
> #!/bin/sh
>
> file=/mnt/ext4_test/zero
> BDI=0:24
>
> for rasize in 16 32 64 128 256 512 1024 2048 4096 8192 16384
> do
> � � � �echo $rasize > /sys/devices/virtual/bdi/$BDI/read_ahead_kb
> � � � �echo readahead_size=${rasize}k
> � � � �fadvise $file 0 0 dontneed
> � � � �ssh p9 "fadvise $file 0 0 dontneed"
> � � � �dd if=$file of=/dev/null bs=4k count=402400
> done

how do you determine which bdi to use? I skimmed thru
the filesystem in /sys and didn't see anything that says which is what

> Thanks,
> Fengguang
>
> On Fri, Feb 26, 2010 at 03:49:16PM +0800, Wu Fengguang wrote:
>> On Wed, Feb 24, 2010 at 03:39:40PM +0800, Dave Chinner wrote:
>> > On Wed, Feb 24, 2010 at 02:12:47PM +0800, Wu Fengguang wrote:
>> > > On Wed, Feb 24, 2010 at 01:22:15PM +0800, Dave Chinner wrote:
>> > > > What I'm trying to say is that while I agree with your premise that
>> > > > a 7.8MB readahead window is probably far larger than was ever
>> > > > intended, I disagree with your methodology and environment for
>> > > > selecting a better default value. �The default readahead value needs
>> > > > to work well in as many situations as possible, not just in perfect
>> > > > 1:1 client/server environment.
>> > >
>> > > Good points. It's imprudent to change a default value based on one
>> > > single benchmark. Need to collect more data, which may take time..
>> >
>> > Agreed - better to spend time now to get it right...
>>
>> I collected more data with large network latency as well as rsize=32k,
>> and updates the readahead size accordingly to 4*rsize.
>>
>> ===
>> nfs: use 2*rsize readahead size
>>
>> With default rsize=512k and NFS_MAX_READAHEAD=15, the current NFS
>> readahead size 512k*15=7680k is too large than necessary for typical
>> clients.
>>
>> On a e1000e--e1000e connection, I got the following numbers
>> (this reads sparse file from server and involves no disk IO)
>>
>> readahead size � � � �normal � � � � �1ms+1ms � � � � 5ms+5ms � � � � 10ms+10ms(*)
>> � � � � �16k �35.5 MB/s � � � �4.8 MB/s � � � �2.1 MB/s � � � 1.2 MB/s
>> � � � � �32k �54.3 MB/s � � � �6.7 MB/s � � � �3.6 MB/s � � � 2.3 MB/s
>> � � � � �64k �64.1 MB/s � � � 12.6 MB/s � � � �6.5 MB/s � � � 4.7 MB/s
>> � � � � 128k �70.5 MB/s � � � 20.1 MB/s � � � 11.9 MB/s � � � 8.7 MB/s
>> � � � � 256k �74.6 MB/s � � � 38.6 MB/s � � � 21.3 MB/s � � �15.0 MB/s
>> rsize ==> 512k � � � �77.4 MB/s � � � 59.4 MB/s � � � 39.8 MB/s � � �25.5 MB/s
>> � � � �1024k �85.5 MB/s � � � 77.9 MB/s � � � 65.7 MB/s � � �43.0 MB/s
>> � � � �2048k �86.8 MB/s � � � 81.5 MB/s � � � 84.1 MB/s � � �59.7 MB/s
>> � � � �4096k �87.9 MB/s � � � 77.4 MB/s � � � 56.2 MB/s � � �59.2 MB/s
>> � � � �8192k �89.0 MB/s � � � 81.2 MB/s � � � 78.0 MB/s � � �41.2 MB/s
>> � � � 16384k �87.7 MB/s � � � 85.8 MB/s � � � 62.0 MB/s � � �56.5 MB/s
>>
>> readahead size � � � �normal � � � � �1ms+1ms � � � � 5ms+5ms � � � � 10ms+10ms(*)
>> � � � � �16k �37.2 MB/s � � � �6.4 MB/s � � � �2.1 MB/s � � � �1.2 MB/s
>> rsize ==> �32k � � � �56.6 MB/s � � � �6.8 MB/s � � � �3.6 MB/s � � � �2.3 MB/s
>> � � � � �64k �66.1 MB/s � � � 12.7 MB/s � � � �6.6 MB/s � � � �4.7 MB/s
>> � � � � 128k �69.3 MB/s � � � 22.0 MB/s � � � 12.2 MB/s � � � �8.9 MB/s
>> � � � � 256k �69.6 MB/s � � � 41.8 MB/s � � � 20.7 MB/s � � � 14.7 MB/s
>> � � � � 512k �71.3 MB/s � � � 54.1 MB/s � � � 25.0 MB/s � � � 16.9 MB/s
>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>> � � � �1024k �71.5 MB/s � � � 48.4 MB/s � � � 26.0 MB/s � � � 16.7 MB/s
>> � � � �2048k �71.7 MB/s � � � 53.2 MB/s � � � 25.3 MB/s � � � 17.6 MB/s
>> � � � �4096k �71.5 MB/s � � � 50.4 MB/s � � � 25.7 MB/s � � � 17.1 MB/s
>> � � � �8192k �71.1 MB/s � � � 52.3 MB/s � � � 26.3 MB/s � � � 16.9 MB/s
>> � � � 16384k �70.2 MB/s � � � 56.6 MB/s � � � 27.0 MB/s � � � 16.8 MB/s
>>
>> (*) 10ms+10ms means to add delay on both client & server sides with
>> � � # /sbin/tc qdisc change dev eth0 root netem delay 10ms
>> � � The total >=20ms delay is so large for NFS, that a simple `vi some.sh`
>> � � command takes a dozen seconds. Note that the actual delay reported
>> � � by ping is larger, eg. for the 1ms+1ms case:
>> � � � � rtt min/avg/max/mdev = 7.361/8.325/9.710/0.837 ms
>>
>>
>> So it seems that readahead_size=4*rsize (ie. keep 4 RPC requests in
>> flight) is able to get near full NFS bandwidth. Reducing the mulriple
>> from 15 to 4 not only makes the client side readahead size more sane
>> (2MB by default), but also reduces the disorderness of the server side
>> RPC read requests, which yeilds better server side readahead behavior.
>>
>> To avoid small readahead when the client mount with "-o rsize=32k" or
>> the server only supports rsize <= 32k, we take the max of 2*rsize and
>> default_backing_dev_info.ra_pages. The latter defaults to 512K, and can
>> be explicitly changed by user with kernel parameter "readahead=" and
>> runtime tunable "/sys/devices/virtual/bdi/default/read_ahead_kb" (which
>> takes effective for future NFS mounts).
>>
>> The test script is:
>>
>> #!/bin/sh
>>
>> file=/mnt/sparse
>> BDI=0:15
>>
>> for rasize in 16 32 64 128 256 512 1024 2048 4096 8192 16384
>> do
>> � � � echo 3 > /proc/sys/vm/drop_caches
>> � � � echo $rasize > /sys/devices/virtual/bdi/$BDI/read_ahead_kb
>> � � � echo readahead_size=${rasize}k
>> � � � dd if=$file of=/dev/null bs=4k count=1024000
>> done
>>
>> CC: Dave Chinner <david@fromorbit.com>
>> CC: Trond Myklebust <Trond.Myklebust@netapp.com>
>> Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
>> ---
>> �fs/nfs/client.c � | � �4 +++-
>> �fs/nfs/internal.h | � �8 --------
>> �2 files changed, 3 insertions(+), 9 deletions(-)
>>
>> --- linux.orig/fs/nfs/client.c � � � �2010-02-26 10:10:46.000000000 +0800
>> +++ linux/fs/nfs/client.c � � 2010-02-26 11:07:22.000000000 +0800
>> @@ -889,7 +889,9 @@ static void nfs_server_set_fsinfo(struct
>> � � � server->rpages = (server->rsize + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
>>
>> � � � server->backing_dev_info.name = "nfs";
>> - � � server->backing_dev_info.ra_pages = server->rpages * NFS_MAX_READAHEAD;
>> + � � server->backing_dev_info.ra_pages = max_t(unsigned long,
>> + � � � � � � � � � � � � � � � � � � � � � default_backing_dev_info.ra_pages,
>> + � � � � � � � � � � � � � � � � � � � � � 4 * server->rpages);
>> � � � server->backing_dev_info.capabilities |= BDI_CAP_ACCT_UNSTABLE;
>>
>> � � � if (server->wsize > max_rpc_payload)
>> --- linux.orig/fs/nfs/internal.h � � �2010-02-26 10:10:46.000000000 +0800
>> +++ linux/fs/nfs/internal.h � 2010-02-26 11:07:07.000000000 +0800
>> @@ -10,14 +10,6 @@
>>
>> �struct nfs_string;
>>
>> -/* Maximum number of readahead requests
>> - * FIXME: this should really be a sysctl so that users may tune it to suit
>> - * � � � �their needs. People that do NFS over a slow network, might for
>> - * � � � �instance want to reduce it to something closer to 1 for improved
>> - * � � � �interactive response.
>> - */
>> -#define NFS_MAX_READAHEAD � �(RPC_DEF_SLOT_TABLE - 1)
>> -
>> �/*
>> � * Determine if sessions are in use.
>> � */
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at �http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at �http://www.tux.org/lkml/
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

==============================================================================
TOPIC: slab: add memory hotplug support
http://groups.google.com/group/linux.kernel/t/a8beda1232363b5e?hl=en
==============================================================================

== 1 of 1 ==
Date: Tues, Mar 2 2010 12:30 pm
From: Christoph Lameter

Not sure how this would sync with slab use during node bootstrap and
shutdown. Kame-san?

Otherwise

Acked-by: Christoph Lameter <cl@linux-foundation.org>


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

==============================================================================
TOPIC: Revert "lsm: Remove the socket_post_accept() hook"
http://groups.google.com/group/linux.kernel/t/c533f45a163fc63a?hl=en
==============================================================================

== 1 of 6 ==
Date: Tues, Mar 2 2010 12:40 pm
From: Samir Bellabes


This reverts commit 8651d5c0b1f874c5b8307ae2b858bc40f9f02482.

snet needs to reintroduce this hook, as it was designed to be: a hook for
updating security informations on objects.

Signed-off-by: Samir Bellabes <sam@synack.fr>
Acked-by: Serge Hallyn <serue@us.ibm.com>
---
include/linux/security.h | 13 +++++++++++++
net/socket.c | 2 ++
security/capability.c | 5 +++++
security/security.c | 5 +++++
4 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/include/linux/security.h b/include/linux/security.h
index 74e564b..d8ad624 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -938,6 +938,11 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
* @sock contains the listening socket structure.
* @newsock contains the newly created server socket for connection.
* Return 0 if permission is granted.
+ * @socket_post_accept:
+ * This hook allows a security module to copy security
+ * information into the newly created socket's inode.
+ * @sock contains the listening socket structure.
+ * @newsock contains the newly created server socket for connection.
* @socket_sendmsg:
* Check permission before transmitting a message to another socket.
* @sock contains the socket structure.
@@ -1674,6 +1679,8 @@ struct security_operations {
struct sockaddr *address, int addrlen);
int (*socket_listen) (struct socket *sock, int backlog);
int (*socket_accept) (struct socket *sock, struct socket *newsock);
+ void (*socket_post_accept) (struct socket *sock,
+ struct socket *newsock);
int (*socket_sendmsg) (struct socket *sock,
struct msghdr *msg, int size);
int (*socket_recvmsg) (struct socket *sock,
@@ -2696,6 +2703,7 @@ int security_socket_bind(struct socket *sock, struct sockaddr *address, int addr
int security_socket_connect(struct socket *sock, struct sockaddr *address, int addrlen);
int security_socket_listen(struct socket *sock, int backlog);
int security_socket_accept(struct socket *sock, struct socket *newsock);
+void security_socket_post_accept(struct socket *sock, struct socket *newsock);
int security_socket_sendmsg(struct socket *sock, struct msghdr *msg, int size);
int security_socket_recvmsg(struct socket *sock, struct msghdr *msg,
int size, int flags);
@@ -2778,6 +2786,11 @@ static inline int security_socket_accept(struct socket *sock,
return 0;
}

+static inline void security_socket_post_accept(struct socket *sock,
+ struct socket *newsock)
+{
+}
+
static inline int security_socket_sendmsg(struct socket *sock,
struct msghdr *msg, int size)
{
diff --git a/net/socket.c b/net/socket.c
index b4eb361..2e66a5a 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -1538,6 +1538,8 @@ SYSCALL_DEFINE4(accept4, int, fd, struct sockaddr __user *, upeer_sockaddr,
fd_install(newfd, newfile);
err = newfd;

+ security_socket_post_accept(sock, newsock);
+
out_put:
fput_light(sock->file, fput_needed);
out:
diff --git a/security/capability.c b/security/capability.c
index a9810dc..61eae40 100644
--- a/security/capability.c
+++ b/security/capability.c
@@ -641,6 +641,10 @@ static int cap_socket_accept(struct socket *sock, struct socket *newsock)
return 0;
}

+static void cap_socket_post_accept(struct socket *sock, struct socket *newsock)
+{
+}
+
static int cap_socket_sendmsg(struct socket *sock, struct msghdr *msg, int size)
{
return 0;
@@ -1081,6 +1085,7 @@ void security_fixup_ops(struct security_operations *ops)
set_to_cap_if_null(ops, socket_connect);
set_to_cap_if_null(ops, socket_listen);
set_to_cap_if_null(ops, socket_accept);
+ set_to_cap_if_null(ops, socket_post_accept);
set_to_cap_if_null(ops, socket_sendmsg);
set_to_cap_if_null(ops, socket_recvmsg);
set_to_cap_if_null(ops, socket_getsockname);
diff --git a/security/security.c b/security/security.c
index 288c3a8..673979f 100644
--- a/security/security.c
+++ b/security/security.c
@@ -1082,6 +1082,11 @@ int security_socket_accept(struct socket *sock, struct socket *newsock)
return security_ops->socket_accept(sock, newsock);
}

+void security_socket_post_accept(struct socket *sock, struct socket *newsock)
+{
+ security_ops->socket_post_accept(sock, newsock);
+}
+
int security_socket_sendmsg(struct socket *sock, struct msghdr *msg, int size)
{
return security_ops->socket_sendmsg(sock, msg, size);
--
1.6.3.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


== 2 of 6 ==
Date: Tues, Mar 2 2010 12:40 pm
From: Samir Bellabes


This patch provides helper functions for other subsystems

Signed-off-by: Samir Bellabes <sam@synack.fr>
---
security/snet/snet_utils.c | 38 ++++++++++++++++++++++++++++++++++++++
security/snet/snet_utils.h | 10 ++++++++++
2 files changed, 48 insertions(+), 0 deletions(-)
create mode 100644 security/snet/snet_utils.c
create mode 100644 security/snet/snet_utils.h

diff --git a/security/snet/snet_utils.c b/security/snet/snet_utils.c
new file mode 100644
index 0000000..e9178d7
--- /dev/null
+++ b/security/snet/snet_utils.c
@@ -0,0 +1,38 @@
+#include <linux/types.h>
+#include <linux/snet.h>
+
+const char *snet_verdict_name(const enum snet_verdict cmd)
+{
+ static const char *const verdict_name[] = {
+ [SNET_VERDICT_GRANT] = "Grant",
+ [SNET_VERDICT_DENY] = "Deny",
+ [SNET_VERDICT_PENDING] = "Pending",
+ [SNET_VERDICT_NONE] = "None",
+ };
+
+ if (cmd >= SNET_NR_VERDICT_TYPES)
+ return "INVALID";
+ else
+ return verdict_name[cmd];
+}
+
+const char *snet_syscall_name(const enum snet_syscall sys)
+{
+ static const char *const syscall_name[] = {
+ [SNET_SOCKET_CREATE] = "Create",
+ [SNET_SOCKET_BIND] = "Bind",
+ [SNET_SOCKET_CONNECT] = "Connect",
+ [SNET_SOCKET_LISTEN] = "Listen",
+ [SNET_SOCKET_ACCEPT] = "Accept",
+ [SNET_SOCKET_POST_ACCEPT] = "Post Accept",
+ [SNET_SOCKET_SENDMSG] = "Sendmsg",
+ [SNET_SOCKET_RECVMSG] = "Recvmsg",
+ [SNET_SOCKET_SOCK_RCV_SKB] = "Sock Rcv Skb",
+ [SNET_SOCKET_CLOSE] = "Close",
+ };
+
+ if (sys >= SNET_NR_SOCKET_TYPES)
+ return "INVALID";
+ else
+ return syscall_name[sys];
+}
diff --git a/security/snet/snet_utils.h b/security/snet/snet_utils.h
new file mode 100644
index 0000000..4dad18b
--- /dev/null
+++ b/security/snet/snet_utils.h
@@ -0,0 +1,10 @@
+#ifndef _SNET_UTILS_H
+#define _SNET_UTILS_H
+
+#include <linux/skbuff.h>
+
+int snet_data_fill(struct sk_buff *skb_rsp, struct snet_info *info);
+const char *snet_verdict_name(const enum snet_verdict cmd);
+const char *snet_syscall_name(const enum snet_syscall sys);
+
+

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate