* [patch 0/5] latest fixes for s390.
@ 2008-10-15 17:42 Martin Schwidefsky
2008-10-15 17:42 ` [patch 1/5] qdio: prevent double qdio shutdown in case of I/O errors Martin Schwidefsky
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Martin Schwidefsky @ 2008-10-15 17:42 UTC (permalink / raw)
To: linux-kernel, linux-s390; +Cc: Heiko Carstens
Five new bug fixes for s390:
Christian Borntraeger (2):
[S390] vmcp: remove BKL
[S390] pgtables: Fix race in enable_sie vs. page table ops
Heiko Carstens (1):
[S390] Fix sysdev class file creation.
Jan Glauber (2):
[S390] qdio: prevent double qdio shutdown in case of I/O errors
[S390] qdio: remove incorrect memset
--
blue skies,
Martin.
"Reality continues to ruin my life." - Calvin.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [patch 1/5] qdio: prevent double qdio shutdown in case of I/O errors
2008-10-15 17:42 [patch 0/5] latest fixes for s390 Martin Schwidefsky
@ 2008-10-15 17:42 ` Martin Schwidefsky
2008-10-15 17:42 ` [patch 2/5] qdio: remove incorrect memset Martin Schwidefsky
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Martin Schwidefsky @ 2008-10-15 17:42 UTC (permalink / raw)
To: linux-kernel, linux-s390; +Cc: Heiko Carstens, Jan Glauber, Martin Schwidefsky
[-- Attachment #1: 001-qdio-shutdown.diff --]
[-- Type: text/plain, Size: 1017 bytes --]
From: Jan Glauber <jang@linux.vnet.ibm.com>
In case of I/O errors on a qdio subchannel qdio_shutdown may be
called twice by the qdio driver and by zfcp. Remove the
superfluous shutdown from qdio and let the upper layer driver
handle the error condition.
Signed-off-by: Jan Glauber <jang@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
---
drivers/s390/cio/qdio_main.c | 1 -
1 file changed, 1 deletion(-)
Index: quilt-2.6/drivers/s390/cio/qdio_main.c
===================================================================
--- quilt-2.6.orig/drivers/s390/cio/qdio_main.c
+++ quilt-2.6/drivers/s390/cio/qdio_main.c
@@ -1083,7 +1083,6 @@ void qdio_int_handler(struct ccw_device
case -EIO:
sprintf(dbf_text, "ierr%4x", irq_ptr->schid.sch_no);
QDIO_DBF_TEXT2(1, setup, dbf_text);
- qdio_int_error(cdev);
return;
case -ETIMEDOUT:
sprintf(dbf_text, "qtoh%4x", irq_ptr->schid.sch_no);
--
blue skies,
Martin.
"Reality continues to ruin my life." - Calvin.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [patch 2/5] qdio: remove incorrect memset
2008-10-15 17:42 [patch 0/5] latest fixes for s390 Martin Schwidefsky
2008-10-15 17:42 ` [patch 1/5] qdio: prevent double qdio shutdown in case of I/O errors Martin Schwidefsky
@ 2008-10-15 17:42 ` Martin Schwidefsky
2008-10-15 17:42 ` [patch 3/5] vmcp: remove BKL Martin Schwidefsky
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Martin Schwidefsky @ 2008-10-15 17:42 UTC (permalink / raw)
To: linux-kernel, linux-s390; +Cc: Heiko Carstens, Jan Glauber, Martin Schwidefsky
[-- Attachment #1: 002-qdio-strlen.diff --]
[-- Type: text/plain, Size: 2041 bytes --]
From: Jan Glauber <jang@linux.vnet.ibm.com>
Remove the memset since zeroing the string is not needed and use
snprintf instead of sprintf.
Signed-off-by: Jan Glauber <jang@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
---
drivers/s390/cio/qdio_debug.c | 19 ++++++-------------
1 file changed, 6 insertions(+), 13 deletions(-)
Index: quilt-2.6/drivers/s390/cio/qdio_debug.c
===================================================================
--- quilt-2.6.orig/drivers/s390/cio/qdio_debug.c
+++ quilt-2.6/drivers/s390/cio/qdio_debug.c
@@ -20,6 +20,7 @@ static struct dentry *debugfs_root;
#define MAX_DEBUGFS_QUEUES 32
static struct dentry *debugfs_queues[MAX_DEBUGFS_QUEUES] = { NULL };
static DEFINE_MUTEX(debugfs_mutex);
+#define QDIO_DEBUGFS_NAME_LEN 40
void qdio_allocate_do_dbf(struct qdio_initialize *init_data)
{
@@ -152,17 +153,6 @@ static int qstat_seq_open(struct inode *
filp->f_path.dentry->d_inode->i_private);
}
-static void get_queue_name(struct qdio_q *q, struct ccw_device *cdev, char *name)
-{
- memset(name, 0, sizeof(name));
- sprintf(name, "%s", dev_name(&cdev->dev));
- if (q->is_input_q)
- sprintf(name + strlen(name), "_input");
- else
- sprintf(name + strlen(name), "_output");
- sprintf(name + strlen(name), "_%d", q->nr);
-}
-
static void remove_debugfs_entry(struct qdio_q *q)
{
int i;
@@ -189,14 +179,17 @@ static struct file_operations debugfs_fo
static void setup_debugfs_entry(struct qdio_q *q, struct ccw_device *cdev)
{
int i = 0;
- char name[40];
+ char name[QDIO_DEBUGFS_NAME_LEN];
while (debugfs_queues[i] != NULL) {
i++;
if (i >= MAX_DEBUGFS_QUEUES)
return;
}
- get_queue_name(q, cdev, name);
+ snprintf(name, QDIO_DEBUGFS_NAME_LEN, "%s_%s_%d",
+ dev_name(&cdev->dev),
+ q->is_input_q ? "input" : "output",
+ q->nr);
debugfs_queues[i] = debugfs_create_file(name, S_IFREG | S_IRUGO | S_IWUSR,
debugfs_root, q, &debugfs_fops);
}
--
blue skies,
Martin.
"Reality continues to ruin my life." - Calvin.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [patch 3/5] vmcp: remove BKL
2008-10-15 17:42 [patch 0/5] latest fixes for s390 Martin Schwidefsky
2008-10-15 17:42 ` [patch 1/5] qdio: prevent double qdio shutdown in case of I/O errors Martin Schwidefsky
2008-10-15 17:42 ` [patch 2/5] qdio: remove incorrect memset Martin Schwidefsky
@ 2008-10-15 17:42 ` Martin Schwidefsky
2008-10-15 17:42 ` [patch 4/5] pgtables: Fix race in enable_sie vs. page table ops Martin Schwidefsky
2008-10-15 17:42 ` [patch 5/5] Fix sysdev class file creation Martin Schwidefsky
4 siblings, 0 replies; 6+ messages in thread
From: Martin Schwidefsky @ 2008-10-15 17:42 UTC (permalink / raw)
To: linux-kernel, linux-s390
Cc: Heiko Carstens, Christian Borntraeger, Martin Schwidefsky
[-- Attachment #1: 003-vmcp-bkl.diff --]
[-- Type: text/plain, Size: 1421 bytes --]
From: Christian Borntraeger <borntraeger@de.ibm.com>
The vmcp driver uses the session->mutex for concurrent access of the data
structures. Therefore, the BKL in vmcp_open does not protect against any
other function in the driver.
The BLK in vmcp_open would protect concurrent access to the module init
but all necessary steps ave finished before misc_register is called.
We can safely remove the lock_kernel from vcmp.
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
---
drivers/s390/char/vmcp.c | 3 ---
1 file changed, 3 deletions(-)
Index: quilt-2.6/drivers/s390/char/vmcp.c
===================================================================
--- quilt-2.6.orig/drivers/s390/char/vmcp.c
+++ quilt-2.6/drivers/s390/char/vmcp.c
@@ -16,7 +16,6 @@
#include <linux/kernel.h>
#include <linux/miscdevice.h>
#include <linux/module.h>
-#include <linux/smp_lock.h>
#include <asm/cpcmd.h>
#include <asm/debug.h>
#include <asm/uaccess.h>
@@ -41,13 +40,11 @@ static int vmcp_open(struct inode *inode
if (!session)
return -ENOMEM;
- lock_kernel();
session->bufsize = PAGE_SIZE;
session->response = NULL;
session->resp_size = 0;
mutex_init(&session->mutex);
file->private_data = session;
- unlock_kernel();
return nonseekable_open(inode, file);
}
--
blue skies,
Martin.
"Reality continues to ruin my life." - Calvin.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [patch 4/5] pgtables: Fix race in enable_sie vs. page table ops
2008-10-15 17:42 [patch 0/5] latest fixes for s390 Martin Schwidefsky
` (2 preceding siblings ...)
2008-10-15 17:42 ` [patch 3/5] vmcp: remove BKL Martin Schwidefsky
@ 2008-10-15 17:42 ` Martin Schwidefsky
2008-10-15 17:42 ` [patch 5/5] Fix sysdev class file creation Martin Schwidefsky
4 siblings, 0 replies; 6+ messages in thread
From: Martin Schwidefsky @ 2008-10-15 17:42 UTC (permalink / raw)
To: linux-kernel, linux-s390
Cc: Heiko Carstens, Christian Borntraeger, Martin Schwidefsky
[-- Attachment #1: 004-pgste-alloc.diff --]
[-- Type: text/plain, Size: 6525 bytes --]
From: Christian Borntraeger <borntraeger@de.ibm.com>
The current enable_sie code sets the mm->context.pgstes bit to tell
dup_mm that the new mm should have extended page tables. This bit is also
used by the s390 specific page table primitives to decide about the page
table layout - which means context.pgstes has two meanings. This can cause
any kind of bugs. For example - e.g. shrink_zone can call
ptep_clear_flush_young while enable_sie is running. ptep_clear_flush_young
will test for context.pgstes. Since enable_sie changed that value of the old
struct mm without changing the page table layout ptep_clear_flush_young will
do the wrong thing.
The solution is to split pgstes into two bits
- one for the allocation
- one for the current state
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
---
arch/s390/include/asm/mmu.h | 3 ++-
arch/s390/include/asm/mmu_context.h | 19 ++++++++++++++++---
arch/s390/include/asm/pgtable.h | 8 ++++----
arch/s390/mm/pgtable.c | 16 ++++++++--------
4 files changed, 30 insertions(+), 16 deletions(-)
Index: quilt-2.6/arch/s390/include/asm/mmu_context.h
===================================================================
--- quilt-2.6.orig/arch/s390/include/asm/mmu_context.h
+++ quilt-2.6/arch/s390/include/asm/mmu_context.h
@@ -20,12 +20,25 @@ static inline int init_new_context(struc
#ifdef CONFIG_64BIT
mm->context.asce_bits |= _ASCE_TYPE_REGION3;
#endif
- if (current->mm->context.pgstes) {
+ if (current->mm->context.alloc_pgste) {
+ /*
+ * alloc_pgste indicates, that any NEW context will be created
+ * with extended page tables. The old context is unchanged. The
+ * page table allocation and the page table operations will
+ * look at has_pgste to distinguish normal and extended page
+ * tables. The only way to create extended page tables is to
+ * set alloc_pgste and then create a new context (e.g. dup_mm).
+ * The page table allocation is called after init_new_context
+ * and if has_pgste is set, it will create extended page
+ * tables.
+ */
mm->context.noexec = 0;
- mm->context.pgstes = 1;
+ mm->context.has_pgste = 1;
+ mm->context.alloc_pgste = 1;
} else {
mm->context.noexec = s390_noexec;
- mm->context.pgstes = 0;
+ mm->context.has_pgste = 0;
+ mm->context.alloc_pgste = 0;
}
mm->context.asce_limit = STACK_TOP_MAX;
crst_table_init((unsigned long *) mm->pgd, pgd_entry_type(mm));
Index: quilt-2.6/arch/s390/include/asm/mmu.h
===================================================================
--- quilt-2.6.orig/arch/s390/include/asm/mmu.h
+++ quilt-2.6/arch/s390/include/asm/mmu.h
@@ -7,7 +7,8 @@ typedef struct {
unsigned long asce_bits;
unsigned long asce_limit;
int noexec;
- int pgstes;
+ int has_pgste; /* The mmu context has extended page tables */
+ int alloc_pgste; /* cloned contexts will have extended page tables */
} mm_context_t;
#endif
Index: quilt-2.6/arch/s390/include/asm/pgtable.h
===================================================================
--- quilt-2.6.orig/arch/s390/include/asm/pgtable.h
+++ quilt-2.6/arch/s390/include/asm/pgtable.h
@@ -679,7 +679,7 @@ static inline void pmd_clear(pmd_t *pmd)
static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
{
- if (mm->context.pgstes)
+ if (mm->context.has_pgste)
ptep_rcp_copy(ptep);
pte_val(*ptep) = _PAGE_TYPE_EMPTY;
if (mm->context.noexec)
@@ -763,7 +763,7 @@ static inline int kvm_s390_test_and_clea
struct page *page;
unsigned int skey;
- if (!mm->context.pgstes)
+ if (!mm->context.has_pgste)
return -EINVAL;
rcp_lock(ptep);
pgste = (unsigned long *) (ptep + PTRS_PER_PTE);
@@ -794,7 +794,7 @@ static inline int ptep_test_and_clear_yo
int young;
unsigned long *pgste;
- if (!vma->vm_mm->context.pgstes)
+ if (!vma->vm_mm->context.has_pgste)
return 0;
physpage = pte_val(*ptep) & PAGE_MASK;
pgste = (unsigned long *) (ptep + PTRS_PER_PTE);
@@ -844,7 +844,7 @@ static inline void __ptep_ipte(unsigned
static inline void ptep_invalidate(struct mm_struct *mm,
unsigned long address, pte_t *ptep)
{
- if (mm->context.pgstes) {
+ if (mm->context.has_pgste) {
rcp_lock(ptep);
__ptep_ipte(address, ptep);
ptep_rcp_copy(ptep);
Index: quilt-2.6/arch/s390/mm/pgtable.c
===================================================================
--- quilt-2.6.orig/arch/s390/mm/pgtable.c
+++ quilt-2.6/arch/s390/mm/pgtable.c
@@ -169,7 +169,7 @@ unsigned long *page_table_alloc(struct m
unsigned long *table;
unsigned long bits;
- bits = (mm->context.noexec || mm->context.pgstes) ? 3UL : 1UL;
+ bits = (mm->context.noexec || mm->context.has_pgste) ? 3UL : 1UL;
spin_lock(&mm->page_table_lock);
page = NULL;
if (!list_empty(&mm->context.pgtable_list)) {
@@ -186,7 +186,7 @@ unsigned long *page_table_alloc(struct m
pgtable_page_ctor(page);
page->flags &= ~FRAG_MASK;
table = (unsigned long *) page_to_phys(page);
- if (mm->context.pgstes)
+ if (mm->context.has_pgste)
clear_table_pgstes(table);
else
clear_table(table, _PAGE_TYPE_EMPTY, PAGE_SIZE);
@@ -210,7 +210,7 @@ void page_table_free(struct mm_struct *m
struct page *page;
unsigned long bits;
- bits = (mm->context.noexec || mm->context.pgstes) ? 3UL : 1UL;
+ bits = (mm->context.noexec || mm->context.has_pgste) ? 3UL : 1UL;
bits <<= (__pa(table) & (PAGE_SIZE - 1)) / 256 / sizeof(unsigned long);
page = pfn_to_page(__pa(table) >> PAGE_SHIFT);
spin_lock(&mm->page_table_lock);
@@ -257,7 +257,7 @@ int s390_enable_sie(void)
struct mm_struct *mm, *old_mm;
/* Do we have pgstes? if yes, we are done */
- if (tsk->mm->context.pgstes)
+ if (tsk->mm->context.has_pgste)
return 0;
/* lets check if we are allowed to replace the mm */
@@ -269,14 +269,14 @@ int s390_enable_sie(void)
}
task_unlock(tsk);
- /* we copy the mm with pgstes enabled */
- tsk->mm->context.pgstes = 1;
+ /* we copy the mm and let dup_mm create the page tables with_pgstes */
+ tsk->mm->context.alloc_pgste = 1;
mm = dup_mm(tsk);
- tsk->mm->context.pgstes = 0;
+ tsk->mm->context.alloc_pgste = 0;
if (!mm)
return -ENOMEM;
- /* Now lets check again if somebody attached ptrace etc */
+ /* Now lets check again if something happened */
task_lock(tsk);
if (!tsk->mm || atomic_read(&tsk->mm->mm_users) > 1 ||
tsk->mm != tsk->active_mm || tsk->mm->ioctx_list) {
--
blue skies,
Martin.
"Reality continues to ruin my life." - Calvin.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [patch 5/5] Fix sysdev class file creation.
2008-10-15 17:42 [patch 0/5] latest fixes for s390 Martin Schwidefsky
` (3 preceding siblings ...)
2008-10-15 17:42 ` [patch 4/5] pgtables: Fix race in enable_sie vs. page table ops Martin Schwidefsky
@ 2008-10-15 17:42 ` Martin Schwidefsky
4 siblings, 0 replies; 6+ messages in thread
From: Martin Schwidefsky @ 2008-10-15 17:42 UTC (permalink / raw)
To: linux-kernel, linux-s390; +Cc: Heiko Carstens, stable, Martin Schwidefsky
[-- Attachment #1: 005-smp-sysdev.diff --]
[-- Type: text/plain, Size: 2924 bytes --]
From: Heiko Carstens <heiko.carstens@de.ibm.com>
Use sysdev_class_create_file() to create create sysdev class attributes
instead of sysfs_create_file(). Using sysfs_create_file() wasn't a very
good idea since the show and store functions have a different amount of
parameters for sysfs files and sysdev class files.
In particular the pointer to the buffer is the last argument and
therefore accesses to random memory regions happened.
Still worked surprisingly well until we got a kernel panic.
Cc: stable@kernel.org
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
---
arch/s390/kernel/smp.c | 24 +++++++++---------------
1 file changed, 9 insertions(+), 15 deletions(-)
Index: quilt-2.6/arch/s390/kernel/smp.c
===================================================================
--- quilt-2.6.orig/arch/s390/kernel/smp.c
+++ quilt-2.6/arch/s390/kernel/smp.c
@@ -1119,9 +1119,7 @@ out:
return rc;
}
-static ssize_t __ref rescan_store(struct sys_device *dev,
- struct sysdev_attribute *attr,
- const char *buf,
+static ssize_t __ref rescan_store(struct sysdev_class *class, const char *buf,
size_t count)
{
int rc;
@@ -1129,12 +1127,10 @@ static ssize_t __ref rescan_store(struct
rc = smp_rescan_cpus();
return rc ? rc : count;
}
-static SYSDEV_ATTR(rescan, 0200, NULL, rescan_store);
+static SYSDEV_CLASS_ATTR(rescan, 0200, NULL, rescan_store);
#endif /* CONFIG_HOTPLUG_CPU */
-static ssize_t dispatching_show(struct sys_device *dev,
- struct sysdev_attribute *attr,
- char *buf)
+static ssize_t dispatching_show(struct sysdev_class *class, char *buf)
{
ssize_t count;
@@ -1144,9 +1140,8 @@ static ssize_t dispatching_show(struct s
return count;
}
-static ssize_t dispatching_store(struct sys_device *dev,
- struct sysdev_attribute *attr,
- const char *buf, size_t count)
+static ssize_t dispatching_store(struct sysdev_class *dev, const char *buf,
+ size_t count)
{
int val, rc;
char delim;
@@ -1168,7 +1163,8 @@ out:
put_online_cpus();
return rc ? rc : count;
}
-static SYSDEV_ATTR(dispatching, 0644, dispatching_show, dispatching_store);
+static SYSDEV_CLASS_ATTR(dispatching, 0644, dispatching_show,
+ dispatching_store);
static int __init topology_init(void)
{
@@ -1178,13 +1174,11 @@ static int __init topology_init(void)
register_cpu_notifier(&smp_cpu_nb);
#ifdef CONFIG_HOTPLUG_CPU
- rc = sysfs_create_file(&cpu_sysdev_class.kset.kobj,
- &attr_rescan.attr);
+ rc = sysdev_class_create_file(&cpu_sysdev_class, &attr_rescan);
if (rc)
return rc;
#endif
- rc = sysfs_create_file(&cpu_sysdev_class.kset.kobj,
- &attr_dispatching.attr);
+ rc = sysdev_class_create_file(&cpu_sysdev_class, &attr_dispatching);
if (rc)
return rc;
for_each_present_cpu(cpu) {
--
blue skies,
Martin.
"Reality continues to ruin my life." - Calvin.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2008-10-15 17:49 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-15 17:42 [patch 0/5] latest fixes for s390 Martin Schwidefsky
2008-10-15 17:42 ` [patch 1/5] qdio: prevent double qdio shutdown in case of I/O errors Martin Schwidefsky
2008-10-15 17:42 ` [patch 2/5] qdio: remove incorrect memset Martin Schwidefsky
2008-10-15 17:42 ` [patch 3/5] vmcp: remove BKL Martin Schwidefsky
2008-10-15 17:42 ` [patch 4/5] pgtables: Fix race in enable_sie vs. page table ops Martin Schwidefsky
2008-10-15 17:42 ` [patch 5/5] Fix sysdev class file creation Martin Schwidefsky
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox